diff options
Diffstat (limited to 'include/core/SkCanvas.h')
-rw-r--r-- | include/core/SkCanvas.h | 35 |
1 files changed, 22 insertions, 13 deletions
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&); |