Index: include/core/SkCanvas.h |
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h |
index 91fb642a8f1807431be8015061f75ab72d5154eb..f763be48f4c77ccfe05daf9d053399d402d7f02e 100644 |
--- a/include/core/SkCanvas.h |
+++ b/include/core/SkCanvas.h |
@@ -300,6 +300,9 @@ public: |
/////////////////////////////////////////////////////////////////////////// |
+#ifndef SK_SUPPORT_LEGACY_SAVEFLAGS |
+protected: |
+#endif |
enum SaveFlags { |
/** save the matrix state, restoring it on restore() */ |
kMatrix_SaveFlag = 0x01, |
@@ -323,6 +326,7 @@ public: |
#endif |
kARGB_ClipLayer_SaveFlag = 0x1F |
}; |
+public: |
/** This call saves the current matrix, clip, and drawFilter, and pushes a |
copy onto a private stack. Subsequent calls to translate, scale, |
@@ -330,7 +334,7 @@ public: |
operate on this copy. |
When the balancing call to restore() is made, the previous matrix, clip, |
and drawFilter are restored. |
- @param flags The flags govern what portion of the Matrix/Clip/drawFilter |
+ @param flags (deprecated) The flags govern what portion of the Matrix/Clip/drawFilter |
state the save (and matching restore) effect. For example, |
if only kMatrix is specified, then only the matrix state |
will be pushed and popped. Likewise for the clip if kClip |
@@ -338,7 +342,11 @@ public: |
by calls to save/restore. |
@return The value to pass to restoreToCount() to balance this save() |
*/ |
+#ifdef SK_SUPPORT_LEGACY_SAVEFLAGS |
int save(SaveFlags flags = kMatrixClip_SaveFlag); |
+#else |
+ int save(); |
+#endif |
/** This behaves the same as save(), but in addition it allocates an |
offscreen bitmap. All drawing calls are directed there, and only when |
@@ -350,11 +358,15 @@ public: |
happen. If exact clipping is desired, use clipRect(). |
@param paint (may be null) This is copied, and is applied to the |
offscreen when restore() is called |
- @param flags LayerFlags |
+ @param flags (deprecated) LayerFlags |
@return The value to pass to restoreToCount() to balance this save() |
*/ |
+#ifdef SK_SUPPORT_LEGACY_SAVEFLAGS |
int saveLayer(const SkRect* bounds, const SkPaint* paint, |
SaveFlags flags = kARGB_ClipLayer_SaveFlag); |
+#else |
+ int saveLayer(const SkRect* bounds, const SkPaint* paint); |
+#endif |
/** This behaves the same as save(), but in addition it allocates an |
offscreen bitmap. All drawing calls are directed there, and only when |
@@ -365,11 +377,15 @@ public: |
clipped to it, though that clipping is not guaranteed to |
happen. If exact clipping is desired, use clipRect(). |
@param alpha This is applied to the offscreen when restore() is called. |
- @param flags LayerFlags |
+ @param flags (deprecated) LayerFlags |
@return The value to pass to restoreToCount() to balance this save() |
*/ |
+#ifdef SK_SUPPORT_LEGACY_SAVEFLAGS |
int saveLayerAlpha(const SkRect* bounds, U8CPU alpha, |
SaveFlags flags = kARGB_ClipLayer_SaveFlag); |
+#else |
+ int saveLayerAlpha(const SkRect* bounds, U8CPU alpha); |
+#endif |
/** This call balances a previous call to save(), and is used to remove all |
modifications to the matrix/clip/drawFilter state since the last save |
@@ -1277,6 +1293,11 @@ private: |
friend class SkLua; // needs top layer size and offset |
friend class SkDeferredDevice; // needs getTopDevice() |
+ // These want to play with SaveFlags |
+ friend class SkMatrixClipStateMgr; |
+ friend class SkDrawCommand; |
+ friend class SkObjectParser; |
+ |
SkBaseDevice* createLayerDevice(const SkImageInfo&); |
SkBaseDevice* init(SkBaseDevice*); |
@@ -1319,6 +1340,8 @@ private: |
const char text[], size_t byteLength, |
SkScalar x, SkScalar y); |
+ static bool bounds_affects_clip(SaveFlags); |
+ |
/* These maintain a cache of the clip bounds in local coordinates, |
(converted to 2s-compliment if floats are slow). |
*/ |