-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] Remove impeller::Path copy constructor. #48616
Changes from 6 commits
a69159b
897a915
c39a994
c64c04e
482b53f
bde7992
312c08a
a2fa543
60242ec
961cc01
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,6 +91,16 @@ class CanvasRecorder { | |
| return (canvas_.*canvasMethod)(std::forward<Args>(args)...); | ||
| } | ||
|
|
||
| template <typename FuncType, typename... Args> | ||
| auto ExecuteAndSkipArgSerialize(CanvasRecorderOp op, | ||
| FuncType canvasMethod, | ||
| Args&&... args) | ||
| -> decltype((std::declval<Canvas>().* | ||
| canvasMethod)(std::forward<Args>(args)...)) { | ||
| serializer_.Write(op); | ||
| return (canvas_.*canvasMethod)(std::forward<Args>(args)...); | ||
| } | ||
|
|
||
| ////////////////////////////////////////////////////////////////////////////// | ||
| // Canvas Static Polymorphism | ||
| // //////////////////////////////////////////////// | ||
|
|
@@ -169,9 +179,11 @@ class CanvasRecorder { | |
| return ExecuteAndSerialize(FLT_CANVAS_RECORDER_OP_ARG(Rotate), radians); | ||
| } | ||
|
|
||
| void DrawPath(const Path& path, const Paint& paint) { | ||
| return ExecuteAndSerialize(FLT_CANVAS_RECORDER_OP_ARG(DrawPath), path, | ||
| paint); | ||
| void DrawPath(Path path, const Paint& paint) { | ||
| serializer_.Write(path.Clone()); | ||
| serializer_.Write(paint); | ||
| return ExecuteAndSkipArgSerialize(FLT_CANVAS_RECORDER_OP_ARG(DrawPath), | ||
| std::move(path), paint); | ||
| } | ||
|
|
||
| void DrawPaint(const Paint& paint) { | ||
|
|
@@ -219,10 +231,12 @@ class CanvasRecorder { | |
| } | ||
|
|
||
| void ClipPath( | ||
| const Path& path, | ||
| Path path, | ||
| Entity::ClipOperation clip_op = Entity::ClipOperation::kIntersect) { | ||
| return ExecuteAndSerialize(FLT_CANVAS_RECORDER_OP_ARG(ClipPath), path, | ||
| clip_op); | ||
| serializer_.Write(path.Clone()); | ||
|
||
| serializer_.Write(clip_op); | ||
| return ExecuteAndSkipArgSerialize(FLT_CANVAS_RECORDER_OP_ARG(ClipPath), | ||
| std::move(path), clip_op); | ||
| } | ||
|
|
||
| void ClipRect( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -778,7 +778,7 @@ void DlDispatcher::drawOval(const SkRect& bounds) { | |
| .AddOval(skia_conversions::ToRect(bounds)) | ||
| .SetConvexity(Convexity::kConvex) | ||
| .TakePath(); | ||
| canvas_.DrawPath(path, paint_); | ||
| canvas_.DrawPath(std::move(path), paint_); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm guessing the linter isn't helping us here if we miss the std::move too?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we don't move its actually a compile error!
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh right, nice! |
||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This takes in a reference, no need to clone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done