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

Unified Diff: src/pipe/SkGPipeWrite.cpp

Issue 196323003: Revert of 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 43209f644b9e64743d02f02e1e24800fe3959e55..146f49cf9cf75311e42b516db3683a6bb0efc147 100644
--- a/src/pipe/SkGPipeWrite.cpp
+++ b/src/pipe/SkGPipeWrite.cpp
@@ -229,10 +229,6 @@
}
// 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;
@@ -287,6 +283,10 @@
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,16 +514,17 @@
#define NOTIFY_SETUP(canvas) \
AutoPipeNotify apn(canvas)
-int SkGPipeCanvas::save(SaveFlags flags) {
+void SkGPipeCanvas::onSave(SaveFlags flags) {
NOTIFY_SETUP(this);
if (this->needOpBytes()) {
this->writeOp(kSave_DrawOp, 0, flags);
}
- return this->INHERITED::save(flags);
-}
-
-int SkGPipeCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint,
- SaveFlags saveFlags) {
+
+ this->INHERITED::onSave(flags);
+}
+
+bool SkGPipeCanvas::onSaveLayer(const SkRect* bounds, const SkPaint* paint,
+ SaveFlags saveFlags) {
NOTIFY_SETUP(this);
size_t size = 0;
unsigned opFlags = 0;
@@ -547,21 +548,23 @@
if (kNoSaveLayer == fFirstSaveLayerStackLevel){
fFirstSaveLayerStackLevel = this->getSaveCount();
}
- // we just pass on the save, so we don't create a layer
- return this->INHERITED::save(saveFlags);
-}
-
-void SkGPipeCanvas::restore() {
+
+ this->INHERITED::onSaveLayer(bounds, paint, saveFlags);
+ // we don't create a layer
+ return false;
+}
+
+void SkGPipeCanvas::onRestore() {
NOTIFY_SETUP(this);
if (this->needOpBytes()) {
this->writeOp(kRestore_DrawOp);
}
- this->INHERITED::restore();
-
- if (this->getSaveCount() == fFirstSaveLayerStackLevel){
+ if (this->getSaveCount() - 1 == 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