De-virtualize SkCanvas save/restore.
This moves the state management logic into non-virtual SkCanvas methods,
and turns the virtuals into protected notifiers.
R=reed@google.com, robertphillips@google.com
Author: fmalita@chromium.org
Review URL: https://codereview.chromium.org/194713008
git-svn-id: http://skia.googlecode.com/svn/trunk@13776 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp
index 4805d62..af59cd638 100644
--- a/src/utils/SkDumpCanvas.cpp
+++ b/src/utils/SkDumpCanvas.cpp
@@ -192,13 +192,13 @@
///////////////////////////////////////////////////////////////////////////////
-int SkDumpCanvas::save(SaveFlags flags) {
+void SkDumpCanvas::willSave(SaveFlags flags) {
this->dump(kSave_Verb, NULL, "save(0x%X)", flags);
- return this->INHERITED::save(flags);
+ this->INHERITED::willSave(flags);
}
-int SkDumpCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint,
- SaveFlags flags) {
+SkCanvas::SaveLayerStrategy SkDumpCanvas::willSaveLayer(const SkRect* bounds, const SkPaint* paint,
+ SaveFlags flags) {
SkString str;
str.printf("saveLayer(0x%X)", flags);
if (bounds) {
@@ -214,12 +214,12 @@
}
}
this->dump(kSave_Verb, paint, str.c_str());
- return this->INHERITED::saveLayer(bounds, paint, flags);
+ return this->INHERITED::willSaveLayer(bounds, paint, flags);
}
-void SkDumpCanvas::restore() {
- this->INHERITED::restore();
+void SkDumpCanvas::willRestore() {
this->dump(kRestore_Verb, NULL, "restore");
+ this->INHERITED::willRestore();
}
bool SkDumpCanvas::translate(SkScalar dx, SkScalar dy) {