[go: nahoru, domu]

[paint] Add PaintCanvas::drawVertices()

Introduce the interface and SkiaPaintCanvas/RecordPaintCanvas
implementation for the equivalent of Skia's SkCanvas::drawVertices().

This will be used in follow-up CLs as the rendering mechanism for
Canvas Mesh2D.

Bug: 1486511
Change-Id: I5584f6805e101e9d9d9b4eb240199cfa32abdf9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4981106
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1246602}
diff --git a/cc/paint/paint_canvas.h b/cc/paint/paint_canvas.h
index 06cd77e..601f5344 100644
--- a/cc/paint/paint_canvas.h
+++ b/cc/paint/paint_canvas.h
@@ -13,6 +13,7 @@
 #include "cc/paint/node_id.h"
 #include "cc/paint/paint_export.h"
 #include "cc/paint/paint_image.h"
+#include "cc/paint/refcounted_buffer.h"
 #include "cc/paint/skottie_color_map.h"
 #include "cc/paint/skottie_frame_data.h"
 #include "cc/paint/skottie_text_property_value.h"
@@ -179,6 +180,11 @@
     drawImageRect(image, src, dst, SkSamplingOptions(), nullptr, constraint);
   }
 
+  virtual void drawVertices(scoped_refptr<RefCountedBuffer<SkPoint>> vertices,
+                            scoped_refptr<RefCountedBuffer<SkPoint>> uvs,
+                            scoped_refptr<RefCountedBuffer<uint16_t>> indices,
+                            const PaintFlags& flags) = 0;
+
   // Draws the frame of the |skottie| animation specified by the normalized time
   // t [0->first frame..1->last frame] at the destination bounds given by |dst|
   // onto the canvas. |images| is a map from asset id to the corresponding image