diff options
author | fmalita <fmalita@chromium.org> | 2014-06-05 12:40:07 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-06-05 12:40:07 -0700 |
commit | c3b589a24eb4d567a906189f882c259ecf5c2f58 (patch) | |
tree | b685282e7cba61088e2cb08da7c13bff764878cf /include/core/SkCanvas.h | |
parent | 5d3f9c765f18f35232176473909b667928fd4378 (diff) | |
download | skia-c3b589a24eb4d567a906189f882c259ecf5c2f58.tar.gz |
SkClipStack::Element tweaks.
(
This is intended to facilitate efficient kMatrix_SaveFlags emulation
on restore():
* collect all clip stack elements for the current save count into a
side clip stack
* canvas.restore(everything)
* replay the collected clip ops to restore the initial clip state
=> we restored the matrix but the clip state is unchanged
)
Two main changes:
* expose the save count for SkClipStack::Element
* expose a replay method for the same (logic relocated from
SkCanvas::replayClips)
The SkCanvas::ClipVisitor shuffling is to enable forward decl
in SkClipStack.h (cannot fwdecl a nested class).
R=reed@google.com, robertphillips@google.com
TBR=reed@google.com
Author: fmalita@chromium.org
Review URL: https://codereview.chromium.org/269693003
Diffstat (limited to 'include/core/SkCanvas.h')
-rw-r--r-- | include/core/SkCanvas.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index ee8ad250d..b92b1460f 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -24,6 +24,7 @@ #define SK_LEGACY_DRAWTEXT_VIRTUAL #endif +class SkCanvasClipVisitor; class SkBaseDevice; class SkDraw; class SkDrawFilter; @@ -1134,14 +1135,7 @@ public: return &fClipStack; } - class ClipVisitor { - public: - virtual ~ClipVisitor(); - virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; - virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; - virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; - }; - + typedef SkCanvasClipVisitor ClipVisitor; /** * Replays the clip operations, back to front, that have been applied to * the canvas, calling the appropriate method on the visitor for each @@ -1504,5 +1498,12 @@ static inline SkCanvas::SaveFlags& operator|=(SkCanvas::SaveFlags& lhs, return lhs; } +class SkCanvasClipVisitor { +public: + virtual ~SkCanvasClipVisitor(); + virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; + virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; + virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; +}; #endif |