From 069a55a7fe2c3ae6f5049843b3fc1a167b51215c Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Wed, 12 Mar 2014 15:08:22 +0000 Subject: Revert of Revert of Revert "De-virtualize SkCanvas save/restore." (https://codereview.chromium.org/196323003/) Reason for revert: Pulling out to rename the virtuals. Original issue's description: > Revert of Revert "De-virtualize SkCanvas save/restore." (https://codereview.chromium.org/194923008/) > > Reason for revert: > Re-landing after roll fix. > > Original issue's description: > > Revert "De-virtualize SkCanvas save/restore." > > > > (To allow a roll fix into the tree). > > > > This reverts commit edf702204be42c945254191f9f9cd6585b3d189b. > > > > R=halcanary@google.com > > > > Committed: https://code.google.com/p/skia/source/detail?r=13748 > > TBR=halcanary@google.com,fmalita@chromium.org > NOTREECHECKS=true > NOTRY=true > > Committed: http://code.google.com/p/skia/source/detail?r=13754 R=halcanary@google.com, fmalita@chromium.org TBR=fmalita@chromium.org, halcanary@google.com NOTREECHECKS=true NOTRY=true Author: fmalita@google.com Review URL: https://codereview.chromium.org/197553002 git-svn-id: http://skia.googlecode.com/svn/trunk@13765 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/core/SkCanvas.h | 18 +++++------------- include/utils/SkDeferredCanvas.h | 8 ++++---- include/utils/SkDumpCanvas.h | 9 +++++---- include/utils/SkLuaCanvas.h | 9 +++++---- include/utils/SkNWayCanvas.h | 8 ++++---- include/utils/SkProxyCanvas.h | 9 +++++---- 6 files changed, 28 insertions(+), 33 deletions(-) (limited to 'include') diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index 50d319c772..773df89d78 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -358,7 +358,7 @@ public: by calls to save/restore. @return The value to pass to restoreToCount() to balance this save() */ - int save(SaveFlags flags = kMatrixClip_SaveFlag); + virtual int save(SaveFlags flags = kMatrixClip_SaveFlag); /** This behaves the same as save(), but in addition it allocates an offscreen bitmap. All drawing calls are directed there, and only when @@ -373,8 +373,8 @@ public: @param flags LayerFlags @return The value to pass to restoreToCount() to balance this save() */ - int saveLayer(const SkRect* bounds, const SkPaint* paint, - SaveFlags flags = kARGB_ClipLayer_SaveFlag); + virtual int saveLayer(const SkRect* bounds, const SkPaint* paint, + SaveFlags flags = kARGB_ClipLayer_SaveFlag); /** This behaves the same as save(), but in addition it allocates an offscreen bitmap. All drawing calls are directed there, and only when @@ -396,7 +396,7 @@ public: call. It is an error to call restore() more times than save() was called. */ - void restore(); + virtual void restore(); /** Returns the number of matrix/clip states on the SkCanvas' private stack. This will equal # save() calls - # restore() calls + 1. The save count on @@ -1178,14 +1178,6 @@ protected: // default impl defers to its device virtual const void* onPeekPixels(SkImageInfo*, size_t* rowBytes); - // Subclass save/restore notifiers. These are called *before* updating the canvas state. - // Overriders should call the corresponding INHERITED method up the inheritance chain. - // For onSaveLayer(), returning false suppresses full layer allocation (and forces - // the base impl to only perform a state save + bounds clip). - virtual void onSave(SaveFlags); - virtual bool onSaveLayer(const SkRect*, const SkPaint*, SaveFlags); - virtual void onRestore(); - virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&); enum ClipEdgeStyle { @@ -1285,7 +1277,7 @@ private: const SkRect& dst, const SkPaint* paint); void internalDrawPaint(const SkPaint& paint); int internalSaveLayer(const SkRect* bounds, const SkPaint* paint, - SaveFlags, bool justForImageFilter, bool skipLayer); + SaveFlags, bool justForImageFilter); void internalDrawDevice(SkBaseDevice*, int x, int y, const SkPaint*); // shared by save() and saveLayer() diff --git a/include/utils/SkDeferredCanvas.h b/include/utils/SkDeferredCanvas.h index 210b7fb189..b26ddbc952 100644 --- a/include/utils/SkDeferredCanvas.h +++ b/include/utils/SkDeferredCanvas.h @@ -138,6 +138,10 @@ public: void silentFlush(); // Overrides of the SkCanvas interface + virtual int save(SaveFlags flags) SK_OVERRIDE; + virtual int saveLayer(const SkRect* bounds, const SkPaint* paint, + SaveFlags flags) 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; @@ -189,10 +193,6 @@ public: virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter) 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 onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE; diff --git a/include/utils/SkDumpCanvas.h b/include/utils/SkDumpCanvas.h index c990690d94..5e3249cbee 100644 --- a/include/utils/SkDumpCanvas.h +++ b/include/utils/SkDumpCanvas.h @@ -74,6 +74,11 @@ public: int getNestLevel() const { return fNestLevel; } + virtual int save(SaveFlags) SK_OVERRIDE; + virtual int saveLayer(const SkRect* bounds, const SkPaint* paint, + 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; @@ -119,10 +124,6 @@ public: virtual void endCommentGroup() 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 onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE; virtual void onPushCull(const SkRect& cullRect) SK_OVERRIDE; virtual void onPopCull() SK_OVERRIDE; diff --git a/include/utils/SkLuaCanvas.h b/include/utils/SkLuaCanvas.h index ae76ec2911..a4f30bc349 100644 --- a/include/utils/SkLuaCanvas.h +++ b/include/utils/SkLuaCanvas.h @@ -20,6 +20,11 @@ public: SkLuaCanvas(int width, int height, lua_State*, const char function[]); virtual ~SkLuaCanvas(); + virtual int save(SaveFlags flags) SK_OVERRIDE; + virtual int saveLayer(const SkRect* bounds, const SkPaint* paint, + SaveFlags flags) 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; @@ -62,10 +67,6 @@ public: virtual void drawData(const void* data, size_t length) 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 onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE; virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; diff --git a/include/utils/SkNWayCanvas.h b/include/utils/SkNWayCanvas.h index 56cad84bb6..84f4b4a177 100644 --- a/include/utils/SkNWayCanvas.h +++ b/include/utils/SkNWayCanvas.h @@ -23,6 +23,10 @@ public: /////////////////////////////////////////////////////////////////////////// // These are forwarded to the N canvases we're referencing + 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; @@ -77,10 +81,6 @@ public: protected: SkTDArray fList; - 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; diff --git a/include/utils/SkProxyCanvas.h b/include/utils/SkProxyCanvas.h index 329d7e367f..d682ba3b44 100644 --- a/include/utils/SkProxyCanvas.h +++ b/include/utils/SkProxyCanvas.h @@ -26,6 +26,11 @@ public: SkCanvas* getProxy() const { return fProxy; } void setProxy(SkCanvas* proxy); + 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; @@ -75,10 +80,6 @@ public: virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter) 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 onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE; virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; -- cgit v1.2.3