aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar fmalita@google.com <fmalita@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-11 21:46:56 +0000
committerGravatar fmalita@google.com <fmalita@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-11 21:46:56 +0000
commitf1292bc01fa3a2e398454b0cf03d36b23b6912f7 (patch)
treea72c9edff4726a1b50fc72f8328ad5454de1e085 /src
parent80b10518a27a47b25a7dbf3591b425a741ebf406 (diff)
Revert "De-virtualize SkCanvas save/restore."
(To allow a roll fix into the tree). This reverts commit edf702204be42c945254191f9f9cd6585b3d189b. R=halcanary@google.com Review URL: https://codereview.chromium.org/194923008 git-svn-id: http://skia.googlecode.com/svn/trunk@13748 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/core/SkBBoxHierarchyRecord.cpp14
-rw-r--r--src/core/SkBBoxHierarchyRecord.h9
-rw-r--r--src/core/SkCanvas.cpp28
-rw-r--r--src/core/SkPictureRecord.cpp24
-rw-r--r--src/core/SkPictureRecord.h8
-rw-r--r--src/pipe/SkGPipeWrite.cpp31
-rw-r--r--src/utils/SkDeferredCanvas.cpp21
-rw-r--r--src/utils/SkDumpCanvas.cpp14
-rw-r--r--src/utils/SkLuaCanvas.cpp17
-rw-r--r--src/utils/SkNWayCanvas.cpp18
-rw-r--r--src/utils/SkNoSaveLayerCanvas.h18
-rw-r--r--src/utils/SkProxyCanvas.cpp17
-rw-r--r--src/utils/debugger/SkDebugCanvas.cpp21
-rw-r--r--src/utils/debugger/SkDebugCanvas.h10
14 files changed, 112 insertions, 138 deletions
diff --git a/src/core/SkBBoxHierarchyRecord.cpp b/src/core/SkBBoxHierarchyRecord.cpp
index e7a30f61f1..5d310be7bc 100644
--- a/src/core/SkBBoxHierarchyRecord.cpp
+++ b/src/core/SkBBoxHierarchyRecord.cpp
@@ -26,20 +26,20 @@ void SkBBoxHierarchyRecord::handleBBox(const SkRect& bounds) {
fBoundingHierarchy->insert(draw, r, true);
}
-void SkBBoxHierarchyRecord::onSave(SaveFlags flags) {
+int SkBBoxHierarchyRecord::save(SaveFlags flags) {
fStateTree->appendSave();
- this->INHERITED::onSave(flags);
+ return INHERITED::save(flags);
}
-bool SkBBoxHierarchyRecord::onSaveLayer(const SkRect* bounds, const SkPaint* paint,
- SaveFlags flags) {
+int SkBBoxHierarchyRecord::saveLayer(const SkRect* bounds, const SkPaint* paint,
+ SaveFlags flags) {
fStateTree->appendSaveLayer(this->writeStream().bytesWritten());
- return this->INHERITED::onSaveLayer(bounds, paint, flags);
+ return INHERITED::saveLayer(bounds, paint, flags);
}
-void SkBBoxHierarchyRecord::onRestore() {
+void SkBBoxHierarchyRecord::restore() {
fStateTree->appendRestore();
- this->INHERITED::onRestore();
+ INHERITED::restore();
}
bool SkBBoxHierarchyRecord::translate(SkScalar dx, SkScalar dy) {
diff --git a/src/core/SkBBoxHierarchyRecord.h b/src/core/SkBBoxHierarchyRecord.h
index 80c809cfbd..80f59c3907 100644
--- a/src/core/SkBBoxHierarchyRecord.h
+++ b/src/core/SkBBoxHierarchyRecord.h
@@ -23,6 +23,11 @@ public:
virtual void handleBBox(const SkRect& bounds) SK_OVERRIDE;
+ virtual int save(SaveFlags flags = kMatrixClip_SaveFlag) SK_OVERRIDE;
+ virtual int saveLayer(const SkRect* bounds, const SkPaint* paint,
+ SaveFlags flags = kARGB_ClipLayer_SaveFlag) SK_OVERRIDE;
+ virtual void restore() SK_OVERRIDE;
+
virtual bool translate(SkScalar dx, SkScalar dy) SK_OVERRIDE;
virtual bool scale(SkScalar sx, SkScalar sy) SK_OVERRIDE;
virtual bool rotate(SkScalar degrees) SK_OVERRIDE;
@@ -34,10 +39,6 @@ public:
virtual bool shouldRewind(void* data) SK_OVERRIDE;
protected:
- virtual void onSave(SaveFlags) SK_OVERRIDE;
- virtual bool onSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK_OVERRIDE;
- virtual void onRestore() SK_OVERRIDE;
-
virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index bd75f7dbde..0888a01fa4 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -348,7 +348,7 @@ public:
SkPaint tmp;
tmp.setImageFilter(fOrigPaint.getImageFilter());
(void)canvas->internalSaveLayer(bounds, &tmp,
- SkCanvas::kARGB_ClipLayer_SaveFlag, true, false);
+ SkCanvas::kARGB_ClipLayer_SaveFlag, true);
// we'll clear the imageFilter for the actual draws in next(), so
// it will only be applied during the restore().
fDoClearImageFilter = true;
@@ -806,12 +806,7 @@ int SkCanvas::internalSave(SaveFlags flags) {
return saveCount;
}
-void SkCanvas::onSave(SaveFlags) {
- // Do nothing. Subclasses may do something.
-}
-
int SkCanvas::save(SaveFlags flags) {
- this->onSave(flags);
// call shared impl
return this->internalSave(flags);
}
@@ -868,16 +863,9 @@ bool SkCanvas::clipRectBounds(const SkRect* bounds, SaveFlags flags,
return true;
}
-bool SkCanvas::onSaveLayer(const SkRect*, const SkPaint*, SaveFlags) {
- // Do nothing. Subclasses may do something.
- return true;
-}
-
int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint,
SaveFlags flags) {
- // Overriding classes may return false to signal that we don't need to create a layer.
- bool skipLayer = !this->onSaveLayer(bounds, paint, flags);
- return this->internalSaveLayer(bounds, paint, flags, false, skipLayer);
+ return this->internalSaveLayer(bounds, paint, flags, false);
}
static SkBaseDevice* createCompatibleDevice(SkCanvas* canvas,
@@ -887,7 +875,7 @@ static SkBaseDevice* createCompatibleDevice(SkCanvas* canvas,
}
int SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint,
- SaveFlags flags, bool justForImageFilter, bool skipLayer) {
+ SaveFlags flags, bool justForImageFilter) {
#ifndef SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
flags = (SaveFlags)(flags | kClipToLayer_SaveFlag);
#endif
@@ -903,11 +891,6 @@ int SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint,
return count;
}
- // FIXME: do onSaveLayer() overriders returning false really care about the clipRectBounds()
- // call above?
- if (skipLayer)
- return count;
-
// Kill the imagefilter if our device doesn't allow it
SkLazyPaint lazyP;
if (paint && paint->getImageFilter()) {
@@ -960,14 +943,9 @@ int SkCanvas::saveLayerAlpha(const SkRect* bounds, U8CPU alpha,
}
}
-void SkCanvas::onRestore() {
- // Do nothing. Subclasses may do something.
-}
-
void SkCanvas::restore() {
// check for underflow
if (fMCStack.count() > 1) {
- this->onRestore();
this->internalRestore();
}
}
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 497ce8ec54..08b69b8527 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -146,7 +146,7 @@ static inline uint32_t getPaintOffset(DrawType op, uint32_t opSize) {
return gPaintOffsets[op] * sizeof(uint32_t) + overflow;
}
-void SkPictureRecord::onSave(SaveFlags flags) {
+int SkPictureRecord::save(SaveFlags flags) {
#ifdef SK_COLLAPSE_MATRIX_CLIP_STATE
fMCMgr.save(flags);
@@ -156,8 +156,7 @@ void SkPictureRecord::onSave(SaveFlags flags) {
fRestoreOffsetStack.push(-(int32_t)fWriter.bytesWritten());
this->recordSave(flags);
#endif
-
- this->INHERITED::onSave(flags);
+ return this->INHERITED::save(flags);
}
void SkPictureRecord::recordSave(SaveFlags flags) {
@@ -169,11 +168,12 @@ void SkPictureRecord::recordSave(SaveFlags flags) {
this->validate(initialOffset, size);
}
-bool SkPictureRecord::onSaveLayer(const SkRect* bounds, const SkPaint* paint,
- SaveFlags flags) {
+int SkPictureRecord::saveLayer(const SkRect* bounds, const SkPaint* paint,
+ SaveFlags flags) {
+ int count;
#ifdef SK_COLLAPSE_MATRIX_CLIP_STATE
- fMCMgr.saveLayer(bounds, paint, flags);
+ count = fMCMgr.saveLayer(bounds, paint, flags);
#else
// record the offset to us, making it non-positive to distinguish a save
// from a clip entry.
@@ -184,13 +184,15 @@ bool SkPictureRecord::onSaveLayer(const SkRect* bounds, const SkPaint* paint,
}
#endif
- this->INHERITED::onSaveLayer(bounds, paint, flags);
- /* No need for a (potentially very big) layer which we don't actually need
+ /* Don't actually call INHERITED::saveLayer, because that will try to allocate
+ an offscreen device (potentially very big) which we don't actually need
at this time (and may not be able to afford since during record our
clip starts out the size of the picture, which is often much larger
than the size of the actual device we'll use during playback).
*/
- return false;
+ count = this->INHERITED::save(flags);
+ this->clipRectBounds(bounds, flags, NULL);
+ return count;
}
void SkPictureRecord::recordSaveLayer(const SkRect* bounds, const SkPaint* paint,
@@ -603,7 +605,7 @@ static void apply_optimization_to_bbh(PictureRecordOptType opt, SkPictureStateTr
}
}
-void SkPictureRecord::onRestore() {
+void SkPictureRecord::restore() {
// FIXME: SkDeferredCanvas needs to be refactored to respect
// save/restore balancing so that the following test can be
// turned on permanently.
@@ -651,7 +653,7 @@ void SkPictureRecord::onRestore() {
fRestoreOffsetStack.pop();
#endif
- this->INHERITED::onRestore();
+ return this->INHERITED::restore();
}
void SkPictureRecord::recordRestore(bool fillInSkips) {
diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h
index ccb1d08163..e91c1c5c12 100644
--- a/src/core/SkPictureRecord.h
+++ b/src/core/SkPictureRecord.h
@@ -37,6 +37,9 @@ public:
SkPictureRecord(const SkISize& dimensions, uint32_t recordFlags);
virtual ~SkPictureRecord();
+ virtual int save(SaveFlags) SK_OVERRIDE;
+ virtual int saveLayer(const SkRect* bounds, const SkPaint*, SaveFlags) SK_OVERRIDE;
+ virtual void restore() SK_OVERRIDE;
virtual bool translate(SkScalar dx, SkScalar dy) SK_OVERRIDE;
virtual bool scale(SkScalar sx, SkScalar sy) SK_OVERRIDE;
virtual bool rotate(SkScalar degrees) SK_OVERRIDE;
@@ -224,11 +227,6 @@ protected:
const void* onPeekPixels(SkImageInfo*, size_t*) SK_OVERRIDE {
return NULL;
}
-
- virtual void onSave(SaveFlags) SK_OVERRIDE;
- virtual bool onSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK_OVERRIDE;
- virtual void onRestore() SK_OVERRIDE;
-
virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
virtual void onPushCull(const SkRect&) SK_OVERRIDE;
virtual void onPopCull() SK_OVERRIDE;
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index 146f49cf9c..43209f644b 100644
--- a/src/pipe/SkGPipeWrite.cpp
+++ b/src/pipe/SkGPipeWrite.cpp
@@ -229,6 +229,10 @@ public:
}
// overrides from SkCanvas
+ virtual int save(SaveFlags) SK_OVERRIDE;
+ virtual int saveLayer(const SkRect* bounds, const SkPaint*,
+ SaveFlags) SK_OVERRIDE;
+ virtual void restore() SK_OVERRIDE;
virtual bool isDrawingToLayer() const SK_OVERRIDE;
virtual bool translate(SkScalar dx, SkScalar dy) SK_OVERRIDE;
virtual bool scale(SkScalar sx, SkScalar sy) SK_OVERRIDE;
@@ -283,10 +287,6 @@ public:
bool shuttleBitmap(const SkBitmap&, int32_t slot);
protected:
- virtual void onSave(SaveFlags) SK_OVERRIDE;
- virtual bool onSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK_OVERRIDE;
- virtual void onRestore() SK_OVERRIDE;
-
virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
@@ -514,17 +514,16 @@ uint32_t SkGPipeCanvas::getTypefaceID(SkTypeface* face) {
#define NOTIFY_SETUP(canvas) \
AutoPipeNotify apn(canvas)
-void SkGPipeCanvas::onSave(SaveFlags flags) {
+int SkGPipeCanvas::save(SaveFlags flags) {
NOTIFY_SETUP(this);
if (this->needOpBytes()) {
this->writeOp(kSave_DrawOp, 0, flags);
}
-
- this->INHERITED::onSave(flags);
+ return this->INHERITED::save(flags);
}
-bool SkGPipeCanvas::onSaveLayer(const SkRect* bounds, const SkPaint* paint,
- SaveFlags saveFlags) {
+int SkGPipeCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint,
+ SaveFlags saveFlags) {
NOTIFY_SETUP(this);
size_t size = 0;
unsigned opFlags = 0;
@@ -548,23 +547,21 @@ bool SkGPipeCanvas::onSaveLayer(const SkRect* bounds, const SkPaint* paint,
if (kNoSaveLayer == fFirstSaveLayerStackLevel){
fFirstSaveLayerStackLevel = this->getSaveCount();
}
-
- this->INHERITED::onSaveLayer(bounds, paint, saveFlags);
- // we don't create a layer
- return false;
+ // we just pass on the save, so we don't create a layer
+ return this->INHERITED::save(saveFlags);
}
-void SkGPipeCanvas::onRestore() {
+void SkGPipeCanvas::restore() {
NOTIFY_SETUP(this);
if (this->needOpBytes()) {
this->writeOp(kRestore_DrawOp);
}
- if (this->getSaveCount() - 1 == fFirstSaveLayerStackLevel){
+ this->INHERITED::restore();
+
+ if (this->getSaveCount() == fFirstSaveLayerStackLevel){
fFirstSaveLayerStackLevel = kNoSaveLayer;
}
-
- this->INHERITED::onRestore();
}
bool SkGPipeCanvas::isDrawingToLayer() const {
diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp
index 8b617b30e8..efe750188e 100644
--- a/src/utils/SkDeferredCanvas.cpp
+++ b/src/utils/SkDeferredCanvas.cpp
@@ -739,25 +739,28 @@ bool SkDeferredCanvas::isFullFrame(const SkRect* rect,
SkIntToScalar(canvasSize.fWidth), SkIntToScalar(canvasSize.fHeight)));
}
-void SkDeferredCanvas::onSave(SaveFlags flags) {
+int SkDeferredCanvas::save(SaveFlags flags) {
this->drawingCanvas()->save(flags);
+ int val = this->INHERITED::save(flags);
this->recordedDrawCommand();
- this->INHERITED::onSave(flags);
+
+ return val;
}
-bool SkDeferredCanvas::onSaveLayer(const SkRect* bounds, const SkPaint* paint,
- SaveFlags flags) {
+int SkDeferredCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint,
+ SaveFlags flags) {
this->drawingCanvas()->saveLayer(bounds, paint, flags);
+ int count = this->INHERITED::save(flags);
+ this->clipRectBounds(bounds, flags, NULL);
this->recordedDrawCommand();
- this->INHERITED::onSaveLayer(bounds, paint, flags);
- // No need for a full layer.
- return false;
+
+ return count;
}
-void SkDeferredCanvas::onRestore() {
+void SkDeferredCanvas::restore() {
this->drawingCanvas()->restore();
+ this->INHERITED::restore();
this->recordedDrawCommand();
- this->INHERITED::onRestore();
}
bool SkDeferredCanvas::isDrawingToLayer() const {
diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp
index ccc5124f30..4805d6287c 100644
--- a/src/utils/SkDumpCanvas.cpp
+++ b/src/utils/SkDumpCanvas.cpp
@@ -192,13 +192,13 @@ void SkDumpCanvas::dump(Verb verb, const SkPaint* paint,
///////////////////////////////////////////////////////////////////////////////
-void SkDumpCanvas::onSave(SaveFlags flags) {
+int SkDumpCanvas::save(SaveFlags flags) {
this->dump(kSave_Verb, NULL, "save(0x%X)", flags);
- this->INHERITED::onSave(flags);
+ return this->INHERITED::save(flags);
}
-bool SkDumpCanvas::onSaveLayer(const SkRect* bounds, const SkPaint* paint,
- SaveFlags flags) {
+int SkDumpCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint,
+ SaveFlags flags) {
SkString str;
str.printf("saveLayer(0x%X)", flags);
if (bounds) {
@@ -214,12 +214,12 @@ bool SkDumpCanvas::onSaveLayer(const SkRect* bounds, const SkPaint* paint,
}
}
this->dump(kSave_Verb, paint, str.c_str());
- return this->INHERITED::onSaveLayer(bounds, paint, flags);
+ return this->INHERITED::saveLayer(bounds, paint, flags);
}
-void SkDumpCanvas::onRestore() {
+void SkDumpCanvas::restore() {
+ this->INHERITED::restore();
this->dump(kRestore_Verb, NULL, "restore");
- this->INHERITED::onRestore();
}
bool SkDumpCanvas::translate(SkScalar dx, SkScalar dy) {
diff --git a/src/utils/SkLuaCanvas.cpp b/src/utils/SkLuaCanvas.cpp
index 2679fd25bd..0f13073049 100644
--- a/src/utils/SkLuaCanvas.cpp
+++ b/src/utils/SkLuaCanvas.cpp
@@ -81,13 +81,13 @@ SkLuaCanvas::SkLuaCanvas(int width, int height, lua_State* L, const char func[])
SkLuaCanvas::~SkLuaCanvas() {}
-void SkLuaCanvas::onSave(SaveFlags flags) {
+int SkLuaCanvas::save(SaveFlags flags) {
AUTO_LUA("save");
- this->INHERITED::onSave(flags);
+ return this->INHERITED::save(flags);
}
-bool SkLuaCanvas::onSaveLayer(const SkRect* bounds, const SkPaint* paint,
- SaveFlags flags) {
+int SkLuaCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint,
+ SaveFlags flags) {
AUTO_LUA("saveLayer");
if (bounds) {
lua.pushRect(*bounds, "bounds");
@@ -95,15 +95,12 @@ bool SkLuaCanvas::onSaveLayer(const SkRect* bounds, const SkPaint* paint,
if (paint) {
lua.pushPaint(*paint, "paint");
}
-
- this->INHERITED::onSaveLayer(bounds, paint, flags);
- // No need for a layer.
- return false;
+ return this->INHERITED::save(flags);
}
-void SkLuaCanvas::onRestore() {
+void SkLuaCanvas::restore() {
AUTO_LUA("restore");
- this->INHERITED::onRestore();
+ this->INHERITED::restore();
}
bool SkLuaCanvas::translate(SkScalar dx, SkScalar dy) {
diff --git a/src/utils/SkNWayCanvas.cpp b/src/utils/SkNWayCanvas.cpp
index 6fbec96204..a9543f9c02 100644
--- a/src/utils/SkNWayCanvas.cpp
+++ b/src/utils/SkNWayCanvas.cpp
@@ -57,33 +57,29 @@ private:
SkCanvas* fCanvas;
};
-void SkNWayCanvas::onSave(SaveFlags flags) {
+int SkNWayCanvas::save(SaveFlags flags) {
Iter iter(fList);
while (iter.next()) {
iter->save(flags);
}
-
- this->INHERITED::onSave(flags);
+ return this->INHERITED::save(flags);
}
-bool SkNWayCanvas::onSaveLayer(const SkRect* bounds, const SkPaint* paint,
- SaveFlags flags) {
+int SkNWayCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint,
+ SaveFlags flags) {
Iter iter(fList);
while (iter.next()) {
iter->saveLayer(bounds, paint, flags);
}
-
- this->INHERITED::onSaveLayer(bounds, paint, flags);
- // No need for a layer.
- return false;
+ return this->INHERITED::saveLayer(bounds, paint, flags);
}
-void SkNWayCanvas::onRestore() {
+void SkNWayCanvas::restore() {
Iter iter(fList);
while (iter.next()) {
iter->restore();
}
- this->INHERITED::onRestore();
+ this->INHERITED::restore();
}
bool SkNWayCanvas::translate(SkScalar dx, SkScalar dy) {
diff --git a/src/utils/SkNoSaveLayerCanvas.h b/src/utils/SkNoSaveLayerCanvas.h
index 037fcecab5..60fad87237 100644
--- a/src/utils/SkNoSaveLayerCanvas.h
+++ b/src/utils/SkNoSaveLayerCanvas.h
@@ -18,13 +18,21 @@ class SkNoSaveLayerCanvas : public SkCanvas {
public:
SkNoSaveLayerCanvas(SkBaseDevice* device) : INHERITED(device) {}
-protected:
- virtual bool onSaveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags flags)
- SK_OVERRIDE {
- this->INHERITED::onSaveLayer(bounds, paint, flags);
- return false;
+ // turn saveLayer() into save() for speed, should not affect correctness.
+ virtual int saveLayer(const SkRect* bounds,
+ const SkPaint* paint,
+ SaveFlags flags) SK_OVERRIDE {
+
+ // Like SkPictureRecord, we don't want to create layers, but we do need
+ // to respect the save and (possibly) its rect-clip.
+ int count = this->INHERITED::save(flags);
+ if (NULL != bounds) {
+ this->INHERITED::clipRectBounds(bounds, flags, NULL);
+ }
+ return count;
}
+protected:
// disable aa for speed
virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle) SK_OVERRIDE {
this->INHERITED::onClipRect(rect, op, kHard_ClipEdgeStyle);
diff --git a/src/utils/SkProxyCanvas.cpp b/src/utils/SkProxyCanvas.cpp
index f61a31d9b3..0a9d7a80c2 100644
--- a/src/utils/SkProxyCanvas.cpp
+++ b/src/utils/SkProxyCanvas.cpp
@@ -21,22 +21,17 @@ void SkProxyCanvas::setProxy(SkCanvas* proxy) {
///////////////////////////////// Overrides ///////////
-void SkProxyCanvas::onSave(SaveFlags flags) {
- fProxy->save(flags);
- this->INHERITED::onSave(flags);
+int SkProxyCanvas::save(SaveFlags flags) {
+ return fProxy->save(flags);
}
-bool SkProxyCanvas::onSaveLayer(const SkRect* bounds, const SkPaint* paint,
- SaveFlags flags) {
- fProxy->saveLayer(bounds, paint, flags);
- this->INHERITED::onSaveLayer(bounds, paint, flags);
- // No need for a layer.
- return false;
+int SkProxyCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint,
+ SaveFlags flags) {
+ return fProxy->saveLayer(bounds, paint, flags);
}
-void SkProxyCanvas::onRestore() {
+void SkProxyCanvas::restore() {
fProxy->restore();
- this->INHERITED::onRestore();
}
bool SkProxyCanvas::translate(SkScalar dx, SkScalar dy) {
diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp
index 67ecc65b08..08e6d94f9e 100644
--- a/src/utils/debugger/SkDebugCanvas.cpp
+++ b/src/utils/debugger/SkDebugCanvas.cpp
@@ -530,9 +530,8 @@ void SkDebugCanvas::onPopCull() {
this->addDrawCommand(new SkPopCullCommand());
}
-void SkDebugCanvas::onRestore() {
- this->addDrawCommand(new SkRestoreCommand());
- this->INHERITED::onRestore();
+void SkDebugCanvas::restore() {
+ addDrawCommand(new SkRestoreCommand());
}
bool SkDebugCanvas::rotate(SkScalar degrees) {
@@ -540,17 +539,15 @@ bool SkDebugCanvas::rotate(SkScalar degrees) {
return true;
}
-void SkDebugCanvas::onSave(SaveFlags flags) {
- this->addDrawCommand(new SkSaveCommand(flags));
- this->INHERITED::onSave(flags);
+int SkDebugCanvas::save(SaveFlags flags) {
+ addDrawCommand(new SkSaveCommand(flags));
+ return true;
}
-bool SkDebugCanvas::onSaveLayer(const SkRect* bounds, const SkPaint* paint,
- SaveFlags flags) {
- this->addDrawCommand(new SkSaveLayerCommand(bounds, paint, flags));
- this->INHERITED::onSaveLayer(bounds, paint, flags);
- // No need for a full layer.
- return false;
+int SkDebugCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint,
+ SaveFlags flags) {
+ addDrawCommand(new SkSaveLayerCommand(bounds, paint, flags));
+ return true;
}
bool SkDebugCanvas::scale(SkScalar sx, SkScalar sy) {
diff --git a/src/utils/debugger/SkDebugCanvas.h b/src/utils/debugger/SkDebugCanvas.h
index 24824c964d..0bbb640a98 100644
--- a/src/utils/debugger/SkDebugCanvas.h
+++ b/src/utils/debugger/SkDebugCanvas.h
@@ -206,8 +206,14 @@ public:
const uint16_t indices[], int indexCount,
const SkPaint&) SK_OVERRIDE;
+ virtual void restore() SK_OVERRIDE;
+
virtual bool rotate(SkScalar degrees) SK_OVERRIDE;
+ virtual int save(SaveFlags) SK_OVERRIDE;
+
+ virtual int saveLayer(const SkRect* bounds, const SkPaint*, SaveFlags) SK_OVERRIDE;
+
virtual bool scale(SkScalar sx, SkScalar sy) SK_OVERRIDE;
virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE;
@@ -242,10 +248,6 @@ public:
}
protected:
- virtual void onSave(SaveFlags) SK_OVERRIDE;
- virtual bool onSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK_OVERRIDE;
- virtual void onRestore() SK_OVERRIDE;
-
virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
virtual void onPushCull(const SkRect& cullRect) SK_OVERRIDE;
virtual void onPopCull() SK_OVERRIDE;