aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-01-23 14:09:13 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-23 20:56:13 +0000
commit42e8c53b3ef58f887a623b410d9783b4d4ab4921 (patch)
treea6b9f9aa477c9aab16c69db2b9ab9c00ad1fed30 /include
parentab23acf4fac009c08588dd9e37b8dd6bf384c9ee (diff)
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 <reed@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/core/SkCanvas.h35
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&);