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/SkNoSaveLayerCanvas.h b/src/utils/SkNoSaveLayerCanvas.h
index 60fad87..6b34684 100644
--- a/src/utils/SkNoSaveLayerCanvas.h
+++ b/src/utils/SkNoSaveLayerCanvas.h
@@ -18,21 +18,13 @@
public:
SkNoSaveLayerCanvas(SkBaseDevice* device) : INHERITED(device) {}
- // 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:
+ virtual SaveLayerStrategy willSaveLayer(const SkRect* bounds, const SkPaint* paint,
+ SaveFlags flags) SK_OVERRIDE {
+ this->INHERITED::willSaveLayer(bounds, paint, flags);
+ return kNoLayer_SaveLayerStrategy;
}
-protected:
// disable aa for speed
virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle) SK_OVERRIDE {
this->INHERITED::onClipRect(rect, op, kHard_ClipEdgeStyle);