aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkCanvas.h
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-11 23:47:35 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-11 23:47:35 +0000
commit4fcd92d0bf09dc9c28643e83b95b6cbf9f1ff2b2 (patch)
tree322b798b8c00af454caa4508320eaac1fad0a96e /include/core/SkCanvas.h
parentab373bd459b91ccf5c7a286eb4a13f4a79b0f60d (diff)
Revert of Revert "De-virtualize SkCanvas save/restore." (https://codereview.chromium.org/194923008/)
Reason for revert: Re-landing after roll fix. Original issue's description: > Revert "De-virtualize SkCanvas save/restore." > > (To allow a roll fix into the tree). > > This reverts commit edf702204be42c945254191f9f9cd6585b3d189b. > > R=halcanary@google.com > > Committed: https://code.google.com/p/skia/source/detail?r=13748 R=halcanary@google.com, fmalita@chromium.org TBR=fmalita@chromium.org, halcanary@google.com NOTREECHECKS=true NOTRY=true Author: fmalita@google.com Review URL: https://codereview.chromium.org/196323003 git-svn-id: http://skia.googlecode.com/svn/trunk@13754 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core/SkCanvas.h')
-rw-r--r--include/core/SkCanvas.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 773df89d78..50d319c772 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -358,7 +358,7 @@ public:
by calls to save/restore.
@return The value to pass to restoreToCount() to balance this save()
*/
- virtual int save(SaveFlags flags = kMatrixClip_SaveFlag);
+ int save(SaveFlags flags = kMatrixClip_SaveFlag);
/** This behaves the same as save(), but in addition it allocates an
offscreen bitmap. All drawing calls are directed there, and only when
@@ -373,8 +373,8 @@ public:
@param flags LayerFlags
@return The value to pass to restoreToCount() to balance this save()
*/
- virtual int saveLayer(const SkRect* bounds, const SkPaint* paint,
- SaveFlags flags = kARGB_ClipLayer_SaveFlag);
+ int saveLayer(const SkRect* bounds, const SkPaint* paint,
+ SaveFlags flags = kARGB_ClipLayer_SaveFlag);
/** This behaves the same as save(), but in addition it allocates an
offscreen bitmap. All drawing calls are directed there, and only when
@@ -396,7 +396,7 @@ public:
call.
It is an error to call restore() more times than save() was called.
*/
- virtual void restore();
+ void restore();
/** Returns the number of matrix/clip states on the SkCanvas' private stack.
This will equal # save() calls - # restore() calls + 1. The save count on
@@ -1178,6 +1178,14 @@ protected:
// default impl defers to its device
virtual const void* onPeekPixels(SkImageInfo*, size_t* rowBytes);
+ // Subclass save/restore notifiers. These are called *before* updating the canvas state.
+ // Overriders should call the corresponding INHERITED method up the inheritance chain.
+ // For onSaveLayer(), returning false suppresses full layer allocation (and forces
+ // the base impl to only perform a state save + bounds clip).
+ virtual void onSave(SaveFlags);
+ virtual bool onSaveLayer(const SkRect*, const SkPaint*, SaveFlags);
+ virtual void onRestore();
+
virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&);
enum ClipEdgeStyle {
@@ -1277,7 +1285,7 @@ private:
const SkRect& dst, const SkPaint* paint);
void internalDrawPaint(const SkPaint& paint);
int internalSaveLayer(const SkRect* bounds, const SkPaint* paint,
- SaveFlags, bool justForImageFilter);
+ SaveFlags, bool justForImageFilter, bool skipLayer);
void internalDrawDevice(SkBaseDevice*, int x, int y, const SkPaint*);
// shared by save() and saveLayer()