Index: src/core/SkPictureContentInfo.cpp |
diff --git a/src/core/SkPictureContentInfo.cpp b/src/core/SkPictureContentInfo.cpp |
index 8185d850b8d9b0b81f1c97a2dfe7d4819ab21663..1d19f352f4adf806527e6c4fbe33f38a2f19339c 100644 |
--- a/src/core/SkPictureContentInfo.cpp |
+++ b/src/core/SkPictureContentInfo.cpp |
@@ -71,6 +71,62 @@ void SkPictureContentInfo::onAddPaintPtr(const SkPaint* paint) { |
} |
} |
+void SkPictureContentInfo::onSaveLayer() { |
+ *fSaveStack.append() = kSaveLayer_Flag; |
+} |
+ |
+void SkPictureContentInfo::onSave() { |
+ *fSaveStack.append() = kSave_Flag; |
+} |
+ |
+void SkPictureContentInfo::onRestore() { |
+ SkASSERT(fSaveStack.count() > 0); |
+ |
+ bool containedSaveLayer = fSaveStack.top() & kContainedSaveLayer_Flag; |
+ |
+ if (fSaveStack.top() & kSaveLayer_Flag) { |
+ ++fNumLayers; |
+ if (containedSaveLayer) { |
+ ++fNumInteriorLayers; |
+ } else { |
+ ++fNumLeafLayers; |
+ } |
+ containedSaveLayer = true; |
+ } |
+ |
+ fSaveStack.pop(); |
+ |
+ if (containedSaveLayer && fSaveStack.count() > 0) { |
+ fSaveStack.top() |= kContainedSaveLayer_Flag; |
+ } |
+} |
+ |
+void SkPictureContentInfo::rescindLastSave() { |
+ SkASSERT(fSaveStack.count() > 0); |
+ SkASSERT(fSaveStack.top() & kSave_Flag); |
+ |
+ bool containedSaveLayer = fSaveStack.top() & kContainedSaveLayer_Flag; |
+ |
+ fSaveStack.pop(); |
+ |
+ if (containedSaveLayer && fSaveStack.count() > 0) { |
+ fSaveStack.top() |= kContainedSaveLayer_Flag; |
+ } |
+} |
+ |
+void SkPictureContentInfo::rescindLastSaveLayer() { |
+ SkASSERT(fSaveStack.count() > 0); |
+ SkASSERT(fSaveStack.top() & kSaveLayer_Flag); |
+ |
+ bool containedSaveLayer = fSaveStack.top() & kContainedSaveLayer_Flag; |
+ |
+ fSaveStack.pop(); |
+ |
+ if (containedSaveLayer && fSaveStack.count() > 0) { |
+ fSaveStack.top() |= kContainedSaveLayer_Flag; |
+ } |
+} |
+ |
void SkPictureContentInfo::set(const SkPictureContentInfo& src) { |
fNumOperations = src.fNumOperations; |
fNumTexts = src.fNumTexts; |
@@ -78,6 +134,10 @@ void SkPictureContentInfo::set(const SkPictureContentInfo& src) { |
fNumFastPathDashEffects = src.fNumFastPathDashEffects; |
fNumAAConcavePaths = src.fNumAAConcavePaths; |
fNumAAHairlineConcavePaths = src.fNumAAHairlineConcavePaths; |
+ fNumLayers = src.fNumLayers; |
+ fNumInteriorLayers = src.fNumInteriorLayers; |
+ fNumLeafLayers = src.fNumLeafLayers; |
+ fSaveStack = src.fSaveStack; |
} |
void SkPictureContentInfo::reset() { |
@@ -87,6 +147,10 @@ void SkPictureContentInfo::reset() { |
fNumFastPathDashEffects = 0; |
fNumAAConcavePaths = 0; |
fNumAAHairlineConcavePaths = 0; |
+ fNumLayers = 0; |
+ fNumInteriorLayers = 0; |
+ fNumLeafLayers = 0; |
+ fSaveStack.rewind(); |
} |
void SkPictureContentInfo::swap(SkPictureContentInfo* other) { |
@@ -96,4 +160,8 @@ void SkPictureContentInfo::swap(SkPictureContentInfo* other) { |
SkTSwap(fNumFastPathDashEffects, other->fNumFastPathDashEffects); |
SkTSwap(fNumAAConcavePaths, other->fNumAAConcavePaths); |
SkTSwap(fNumAAHairlineConcavePaths, other->fNumAAHairlineConcavePaths); |
+ SkTSwap(fNumLayers, other->fNumLayers); |
+ SkTSwap(fNumInteriorLayers, other->fNumInteriorLayers); |
+ SkTSwap(fNumLeafLayers, other->fNumLeafLayers); |
+ fSaveStack.swap(other->fSaveStack); |
} |