We're currently decrementing early in checkForDeferredSave(), but that
means we break the getSaveCount() invariant during willSave() dispatch.
Instead, we can defer to doSave(), until after willSave() is called.
This allows overriders to call getSaveCount().
R=reed@google.com,robertphillips@google.com
Review URL: https://codereview.chromium.org/
1113603002
void SkCanvas::checkForDeferredSave() {
if (fMCRec->fDeferredSaveCount > 0) {
- fMCRec->fDeferredSaveCount -= 1;
this->doSave();
}
}
void SkCanvas::doSave() {
this->willSave();
+
+ SkASSERT(fMCRec->fDeferredSaveCount > 0);
+ fMCRec->fDeferredSaveCount -= 1;
this->internalSave();
}