From 42e8c53b3ef58f887a623b410d9783b4d4ab4921 Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Mon, 23 Jan 2017 14:09:13 -0500 Subject: rename virtuals for clipbounds, and deprecate older bool/var-arg pattern BUG=skia: Change-Id: I08bcc2d0559e02838772538816b928e0716dd3aa Reviewed-on: https://skia-review.googlesource.com/7412 Commit-Queue: Mike Reed Reviewed-by: Robert Phillips --- include/core/SkCanvas.h | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'include') diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index a52ad1230a..a1d652db06 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -530,25 +530,30 @@ public: * Return the bounds of the current clip in local coordinates. If the clip is empty, * return { 0, 0, 0, 0 }. */ - SkRect getLocalClipBounds() const { - SkRect bounds; - this->getClipBounds(&bounds); - return bounds; - } - // TODO: move this to protected and rename to onGetLocalClipBounds - virtual bool getClipBounds(SkRect* bounds) const; + SkRect getLocalClipBounds() const { return this->onGetLocalClipBounds(); } /** * Return the bounds of the current clip in device coordinates. If the clip is empty, * return { 0, 0, 0, 0 }. */ - SkIRect getDeviceClipBounds() const { - SkIRect bounds; - this->getClipDeviceBounds(&bounds); - return bounds; + SkIRect getDeviceClipBounds() const { return this->onGetDeviceClipBounds(); } + +#ifdef SK_SUPPORT_LEGACY_GETCLIPBOUNDS + bool getClipBounds(SkRect* bounds) const { + SkRect r = this->getLocalClipBounds(); + if (bounds) { + *bounds = r; + } + return !r.isEmpty(); + } + bool getClipDeviceBounds(SkIRect* bounds) const { + SkIRect r = this->getDeviceClipBounds(); + if (bounds) { + *bounds = r; + } + return !r.isEmpty(); } - // TODO: move this to protected and rename to onGetDeviceClipBounds - virtual bool getClipDeviceBounds(SkIRect* bounds) const; +#endif /** Fill the entire canvas' bitmap (restricted to the current clip) with the specified ARGB color, using the specified mode. @@ -1378,6 +1383,10 @@ protected: virtual void didTranslateZ(SkScalar) {} #endif + virtual SkRect onGetLocalClipBounds() const; + virtual SkIRect onGetDeviceClipBounds() const; + + virtual void onDrawAnnotation(const SkRect&, const char key[], SkData* value); virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&); -- cgit v1.2.3