Repository: FlaxEngine/FlaxEngine
File: Source/Engine/Render2D/Render2D.h (C/C++)

Code before:
    /// <param name="rect">The target rectangle to draw.</param>
    /// <param name="color">The color to use.</param>
    API_FUNCTION() static void DrawMaterial(MaterialBase* material, const Rectangle& rect, const Color& color);

    /// <summary>
    /// Draws the background blur.
    /// </summary>
    /// <param name="rect">The target rectangle to draw (blurs its background).</param>
    /// <param name="blurStrength">The blur strength defines how blurry the background is. Larger numbers increase blur, resulting in a larger runtime cost on the GPU.</param>
    API_FUNCTION() static void DrawBlur(const Rectangle& rect, float blurStrength);

    /// <summary>
    /// Draws vertices array.
    /// </summary>
    /// <param name="t">The texture.</param>
    /// <param name="vertices">The vertices array.</param>
    /// <param name="uvs">The uvs array.</param>
    API_FUNCTION() static void DrawVertices(GPUTexture* t, Array<Vector2> vertices, Array<Vector2> uvs);
    
    /// <summary>
    /// Draws vertices array.
    /// </summary>
    /// <param name="vertices">The vertices array.</param>
    /// <param name="colors">The colors array.</param>
    /// <param name="useAlpha">If true alpha blending will be enabled.</param>
    API_FUNCTION() static void DrawVertices(Array<Vector2> vertices, Array<Color> colors, bool useAlpha);

    /// <summary>
    /// Fills a triangular area.
    /// </summary>
    /// <param name="p0">The first point.</param>
    /// <param name="p1">The second point.</param>
    /// <param name="p2">The third point.</param>
    /// <param name="color">The color.</param>
    API_FUNCTION() static void FillTriangle(const Vector2& p0, const Vector2& p1, const Vector2& p2, const Color& color);
};


Review comment (performance):
I would name it `FillTriangles` and use `const Span<Vector2>& vertices` +` const Span<Color>& colors` to make it more optimized (calling from C# won't allocate memory but just pass span as a pointer to fixed C# buffer).

Code after:
    /// <param name="rect">The target rectangle to draw.</param>
    /// <param name="color">The color to use.</param>
    API_FUNCTION() static void DrawMaterial(MaterialBase* material, const Rectangle& rect, const Color& color);

    /// <summary>
    /// Draws the background blur.
    /// </summary>
    /// <param name="rect">The target rectangle to draw (blurs its background).</param>
    /// <param name="blurStrength">The blur strength defines how blurry the background is. Larger numbers increase blur, resulting in a larger runtime cost on the GPU.</param>
    API_FUNCTION() static void DrawBlur(const Rectangle& rect, float blurStrength);

    /// <summary>
    /// Draws vertices array.
    /// </summary>
    /// <param name="t">The texture.</param>
    /// <param name="vertices">The vertices array.</param>
    /// <param name="uvs">The uvs array.</param>
    API_FUNCTION() static void DrawTexturedTriangles(GPUTexture* t, const Span<Vector2>& vertices, const Span<Vector2>& uvs);
    
    /// <summary>
    /// Draws vertices array.
    /// </summary>
    /// <param name="vertices">The vertices array.</param>
    /// <param name="colors">The colors array.</param>
    /// <param name="useAlpha">If true alpha blending will be enabled.</param>
    API_FUNCTION() static void FillTriangles(const Span<Vector2>& vertices, const Span<Color>& colors, bool useAlpha);

    /// <summary>
    /// Fills a triangular area.
    /// </summary>
    /// <param name="p0">The first point.</param>
    /// <param name="p1">The second point.</param>
    /// <param name="p2">The third point.</param>
    /// <param name="color">The color.</param>
    API_FUNCTION() static void FillTriangle(const Vector2& p0, const Vector2& p1, const Vector2& p2, const Color& color);
};