[go: nahoru, domu]

Add setMatrix with SkM44 as an argument

This is step one of a multistep process to move the paint_op_buffer from
SkMatrix->SkM44. The steps are
1. Add setMatrix(SkM44) <- this step
2. Add concat(SkM44)
2a. Add helper functions to SkM44 to allow it to do stuff like this:
  https://source.chromium.org/chromium/chromium/src/+/master:cc/paint/display_item_list.cc;l=412?q=display_item_list&sq=package:chromium&ct=os
3. Change setMatrix(SkMatrix) to use the SkM44 function
4. Change concat(SkMatrix) to use the SkM44 function
5. Remove the early-outs for checking identity in the ::Serialize
functions and see if they have perf impact.

SkCanvas now supports this
https://skia-review.googlesource.com/c/skia/+/338596

It's necessary for perspective transforms
https://bugs.chromium.org/p/chromium/issues/detail?id=1140535

It needs to be serializable due to the record paint canvas.

Bug: 1153330, 1140535, 1155544
Change-Id: I0920b848386e003b6a18e9332a4f400484b68349
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2562783
Reviewed-by: Joe Mason <joenotcharles@chromium.org>
Reviewed-by: Khushal <khushalsagar@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Juanmi Huertas <juanmihd@chromium.org>
Commit-Queue: Aaron Krajeski <aaronhk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833962}
diff --git a/cc/paint/paint_canvas.h b/cc/paint/paint_canvas.h
index 2b9c34a..4bcee9f 100644
--- a/cc/paint/paint_canvas.h
+++ b/cc/paint/paint_canvas.h
@@ -76,9 +76,13 @@
   virtual void translate(SkScalar dx, SkScalar dy) = 0;
   virtual void scale(SkScalar sx, SkScalar sy) = 0;
   virtual void rotate(SkScalar degrees) = 0;
+  // TODO(aaronhk): crbug.com/1153330 deprecate these in favor of the SkM44
+  // versions. Also add concat with a SkM44 argument
   virtual void concat(const SkMatrix& matrix) = 0;
   virtual void setMatrix(const SkMatrix& matrix) = 0;
 
+  virtual void setMatrix(const SkM44& matrix) = 0;
+
   virtual void clipRect(const SkRect& rect,
                         SkClipOp op,
                         bool do_anti_alias) = 0;