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

Unified Diff: src/utils/SkNoSaveLayerCanvas.h

Issue 197553002: Revert of 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/utils/SkNWayCanvas.cpp ('k') | src/utils/SkProxyCanvas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkNoSaveLayerCanvas.h
diff --git a/src/utils/SkNoSaveLayerCanvas.h b/src/utils/SkNoSaveLayerCanvas.h
index 037fcecab5fe47737623dd3b9dfa9725c9d25622..60fad87237b91818a7517abea5abd4076432aac2 100644
--- a/src/utils/SkNoSaveLayerCanvas.h
+++ b/src/utils/SkNoSaveLayerCanvas.h
@@ -18,13 +18,21 @@
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);
« no previous file with comments | « src/utils/SkNWayCanvas.cpp ('k') | src/utils/SkProxyCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698