Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Overview of changes: - PaintOp::SerializeOptions.canvas is removed entirely. - PaintOpBufferSerializer::Serialize() variants create a new SkCanvas at their start, instead of asserting the canvas was left in the initial state. - The Serializer uses this canvas for text analysis and tracking of the total canvas matrix, but does not expose the canvas to any of the ops being serialized. - PaintOp::Serialize adds a parameter for the current ctm; up to this point it was the only piece of information ever accessed from the SerializeOptions's canvas by paint ops. - PaintOpWriter's Write() functions for PaintFlags, shaders, and filters add a parameter for the current ctm since these are the only types that need to modify what's being serialized based on the transform. Rational: - I wanted to improve ownership/lifetime management of the analysis canvas. - I wanted to clarify what state from the canvas was important during serialization. - I wanted to reduce the future chance of adding additional dependencies on the canvas's state beyond just the current transform. - I wanted to ensure that PaintOps did not modify the canvas's state during serialization outside of the controlled playback handled by PaintOpBufferSerializer::PlaybackOnAnalysisCanvas. I had put together another CL: https://chromium-review.googlesource.com/c/chromium/src/+/2800511 that tried to achieve the same goals outlined in rational but did it by moving the analysis canvas creation and ownership into SerializeOptions (vs. removing it from Options entirely). This was a much smaller change but preserves the status quo where PaintOps can access/use the canvas during serialization, and leads to a somewhat tricky lifetime issue where the Options has to live longer than the Serializer using the options. Bug: 1194701 Change-Id: I065253b9be89469f964ba6836ba6a995be7578b4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2845730 Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Stephen Chenney <schenney@chromium.org> Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org> Commit-Queue: Michael Ludwig <michaelludwig@google.com> Cr-Commit-Position: refs/heads/master@{#877058}
- Loading branch information