Index: src/core/SkCanvas.cpp |
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp |
index 8426f090ec5949653ab516ffca3f7d33a317c338..ac909def6a662f8445c456a2bf4527395567c1d2 100644 |
--- a/src/core/SkCanvas.cpp |
+++ b/src/core/SkCanvas.cpp |
@@ -795,7 +795,6 @@ void SkCanvas::restore() { |
if (fMCStack.count() > 1) { |
this->willRestore(); |
SkASSERT(fSaveCount > 1); |
- fSaveCount -= 1; |
this->internalRestore(); |
this->didRestore(); |
} |
@@ -879,7 +878,6 @@ int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint) { |
bounds = NULL; |
} |
SaveLayerStrategy strategy = this->willSaveLayer(bounds, paint, kARGB_ClipLayer_SaveFlag); |
- fSaveCount += 1; |
this->internalSaveLayer(bounds, paint, kARGB_ClipLayer_SaveFlag, strategy); |
return this->getSaveCount() - 1; |
} |
@@ -889,7 +887,6 @@ int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags fl |
bounds = NULL; |
} |
SaveLayerStrategy strategy = this->willSaveLayer(bounds, paint, flags); |
- fSaveCount += 1; |
this->internalSaveLayer(bounds, paint, flags, strategy); |
return this->getSaveCount() - 1; |
} |
@@ -900,6 +897,8 @@ void SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint, Sav |
flags |= kClipToLayer_SaveFlag; |
#endif |
+ fSaveCount += 1; |
+ |
// do this before we create the layer. We don't call the public save() since |
// that would invoke a possibly overridden virtual |
this->internalSave(); |
@@ -978,6 +977,8 @@ int SkCanvas::saveLayerAlpha(const SkRect* bounds, U8CPU alpha, |
void SkCanvas::internalRestore() { |
SkASSERT(fMCStack.count() != 0); |
+ fSaveCount -= 1; |
+ |
fDeviceCMDirty = true; |
fCachedLocalClipBoundsDirty = true; |