aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/utils
diff options
context:
space:
mode:
authorGravatar Adrienne Walker <enne@chromium.org>2017-05-01 13:45:01 -0700
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-02 13:52:09 +0000
commit6a280a50eddc30c6b2a090d9e8e7df78afe7a457 (patch)
tree8b239c8a431ac716d1fdacc7c7e75e41e0f344e9 /include/utils
parent687cc6c033506c767a960eb57b4d703a76424bfd (diff)
Expose resetForNextPicture in SkNoDrawCanvas
SkRecorder has some private Skia behavior with the way it handles an SkNoDrawCanvas that is not exposed. In particular, it's able to create an arbitrary SkIRect device clip at construction time. This is a performance optimization when reusing SkNoDrawCanvas across multiple recordings instead of reconstructing a new canvas every time. https://codereview.chromium.org/2768143002 is trying to implement another version of SkPictureBuilder/SkRecorder and so wants to be able to use similar SkNoDrawCanvas behavior. Change-Id: I0ac5f0eef8f0548cefd7354062311667cf448b07 Reviewed-on: https://skia-review.googlesource.com/11320 Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'include/utils')
-rw-r--r--include/utils/SkNoDrawCanvas.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/utils/SkNoDrawCanvas.h b/include/utils/SkNoDrawCanvas.h
index d21d678f16..7b3eaf6b18 100644
--- a/include/utils/SkNoDrawCanvas.h
+++ b/include/utils/SkNoDrawCanvas.h
@@ -28,6 +28,11 @@ public:
// TODO: investigate the users of this ctor.
SkNoDrawCanvas(const SkIRect&);
+ // Optimization to reset state to be the same as after construction.
+ void resetCanvas(int width, int height) {
+ resetForNextPicture(SkIRect::MakeWH(width, height));
+ }
+
protected:
SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec& rec) override;