Index: include/core/SkCanvas.h |
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h |
index 773df89d789843ee4ef5b042403c57136afb94e6..5ab41656d086949703bd6ad5f7edb6e2d13a4124 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,7 +373,7 @@ public: |
@param flags LayerFlags |
@return The value to pass to restoreToCount() to balance this save() |
*/ |
- virtual int saveLayer(const SkRect* bounds, const SkPaint* paint, |
+ int saveLayer(const SkRect* bounds, const SkPaint* paint, |
robertphillips
2014/03/11 15:49:44
line up?
f(malita)
2014/03/11 16:38:08
Done.
|
SaveFlags flags = kARGB_ClipLayer_SaveFlag); |
/** This behaves the same as save(), but in addition it allocates an |
@@ -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) { } |
reed1
2014/03/11 15:49:39
nit: lets always put the impl of virtuals in the .
f(malita)
2014/03/11 16:38:08
Since we're always up-calling INHERITED::on* from
reed1
2014/03/11 16:53:38
I see your point, and I'm trying to recall all of
|
+ virtual bool onSaveLayer(const SkRect*, const SkPaint*, SaveFlags) { return true; } |
+ 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); |
reed1
2014/03/11 15:49:39
Can the caller(s) cleanly do whatever internalSave
f(malita)
2014/03/11 16:38:08
They probably could, but they still have to signal
reed1
2014/03/11 16:53:38
Are derived classes allowed to call internalSaveLa
|
void internalDrawDevice(SkBaseDevice*, int x, int y, const SkPaint*); |
// shared by save() and saveLayer() |