aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/core/SkCanvas.h8
-rw-r--r--src/core/SkCanvas.cpp7
2 files changed, 15 insertions, 0 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 6ca9fa08a9..73fd7200ad 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -768,6 +768,14 @@ public:
const SkRegion& getTotalClip() const;
/**
+ * Return true if the current clip is non-empty.
+ *
+ * If bounds is not NULL, set it to the bounds of the current clip
+ * in global coordinates.
+ */
+ bool getTotalClipBounds(SkIRect* bounds) const;
+
+ /**
* Return the current clipstack. This mirrors the result in getTotalClip()
* but is represented as a stack of geometric clips + region-ops.
*/
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index f563cd1211..89c6e5b79d 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1151,6 +1151,13 @@ SkCanvas::ClipType SkCanvas::getClipType() const {
return kComplex_ClipType;
}
+bool SkCanvas::getTotalClipBounds(SkIRect* bounds) const {
+ if (bounds) {
+ *bounds = fMCRec->fRegion->getBounds();
+ }
+ return !fMCRec->fRegion->isEmpty();
+}
+
const SkRegion& SkCanvas::getTotalClip() const {
return *fMCRec->fRegion;
}