Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(917)

Unified Diff: src/pipe/SkGPipeWrite.cpp

Issue 194923008: Revert "De-virtualize SkCanvas save/restore." (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkPictureRecord.cpp ('k') | src/utils/SkDeferredCanvas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pipe/SkGPipeWrite.cpp
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index 146f49cf9cf75311e42b516db3683a6bb0efc147..43209f644b9e64743d02f02e1e24800fe3959e55 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 {
« no previous file with comments | « src/core/SkPictureRecord.cpp ('k') | src/utils/SkDeferredCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698