aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-01-23 11:39:45 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-23 17:14:53 +0000
commit918e144408ba218df919528f8b48c544f4767883 (patch)
treeaf398e3c3a1f779024a0d60d6db43aadb58e29ac /include
parent9adfef8680c22ce8980031b4bcb9f1fadd066a80 (diff)
change clip-bounds getters to always return the rect
(actually fixes undefined result in getClipBounds) future CLs - update all callers to new apis - move/rename virtuals BUG=skia: DOCS_PREVIEW= https://skia.org/?cl=7400 Change-Id: I45b93014e915c0d1c36d97d948c9ac8931f23258 Reviewed-on: https://skia-review.googlesource.com/7400 Reviewed-by: Brian Salomon <bsalomon@google.com> Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/core/SkCanvas.h29
1 files changed, 20 insertions, 9 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 6b3d6aa719..a52ad1230a 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -526,17 +526,28 @@ public:
*/
bool quickReject(const SkPath& path) const;
- /** Return the bounds of the current clip (in local coordinates) in the
- bounds parameter, and return true if it is non-empty. This can be useful
- in a way similar to quickReject, in that it tells you that drawing
- outside of these bounds will be clipped out.
- */
+ /**
+ * 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;
- /** Return the bounds of the current clip, in device coordinates; returns
- true if non-empty. Maybe faster than getting the clip explicitly and
- then taking its bounds.
- */
+ /**
+ * 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;
+ }
+ // TODO: move this to protected and rename to onGetDeviceClipBounds
virtual bool getClipDeviceBounds(SkIRect* bounds) const;
/** Fill the entire canvas' bitmap (restricted to the current clip) with the