Revert of Make the canvas draw looper setup update the canvas save count (patchset #1 id:1 of https://codereview.chromium.org/1034033004/)
Reason for revert:
makes internalSave and internalSaveLayer inconsistent. Need to find a different solution.
Original issue's description:
> Make the canvas draw looper setup update the canvas save count
>
> Image filter in a paint would leave save count in wrong state
> for normal draws. This could be observed through the canvas
> references during the draw call. An example of this is
> inspecting the canvas during a draw looper.
>
> patch from issue 993863002 at patchset 20001 (http://crrev.com/993863002#ps20001)
>
> BUG=skia:
> TBR=kkinnunen@nvidia.com
>
> Committed: https://skia.googlesource.com/skia/+/fd3a91e1fc4de69611b5297f624a1cd65db4ced1
TBR=kkinnunen@nvidia.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/1037653004
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index ac909de..8426f09 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -795,6 +795,7 @@
if (fMCStack.count() > 1) {
this->willRestore();
SkASSERT(fSaveCount > 1);
+ fSaveCount -= 1;
this->internalRestore();
this->didRestore();
}
@@ -878,6 +879,7 @@
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;
}
@@ -887,6 +889,7 @@
bounds = NULL;
}
SaveLayerStrategy strategy = this->willSaveLayer(bounds, paint, flags);
+ fSaveCount += 1;
this->internalSaveLayer(bounds, paint, flags, strategy);
return this->getSaveCount() - 1;
}
@@ -897,8 +900,6 @@
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();
@@ -977,8 +978,6 @@
void SkCanvas::internalRestore() {
SkASSERT(fMCStack.count() != 0);
- fSaveCount -= 1;
-
fDeviceCMDirty = true;
fCachedLocalClipBoundsDirty = true;