aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkClipStack.h
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-24 13:54:00 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-24 13:54:00 +0000
commit607fe077c893fdb230e29631be096de614a14e2a (patch)
tree35af1f7d6542059ca8d1bc3f64305bcccf71881f /include/core/SkClipStack.h
parent7866228f06e402d37f8fcab70a688e1f34c1d27b (diff)
Added bound computation to SkClipStack
http://codereview.appspot.com/6419048/ This will require re-baselining of complexclip* and filltypespersp git-svn-id: http://skia.googlecode.com/svn/trunk@4730 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core/SkClipStack.h')
-rw-r--r--include/core/SkClipStack.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/core/SkClipStack.h b/include/core/SkClipStack.h
index daeb82629a..fbdcb36c84 100644
--- a/include/core/SkClipStack.h
+++ b/include/core/SkClipStack.h
@@ -30,6 +30,27 @@ public:
void save();
void restore();
+ enum BoundsType {
+ // The bounding box contains all the pixels that can be written to
+ kNormal_BoundsType,
+ // The bounding box contains all the pixels that cannot be written to.
+ // The real bound extends out to infinity and all the pixels outside
+ // of the bound can be written to. Note that some of the pixels inside
+ // the bound may also be writeable but all pixels that cannot be
+ // written to are guaranteed to be inside.
+ kInsideOut_BoundsType
+ };
+
+ /**
+ * getBounds places the current finite bound in its first parameter. In its
+ * second, it indicates which kind of bound is being returned. If
+ * 'finiteBound' is a normal bounding box then it encloses are writeable
+ * pixels. If 'finiteBound' is an inside out bounding box then it
+ * encloses all the un-writeable pixels and the true/normal bound is the
+ * infinite plane.
+ */
+ void getBounds(SkRect* finiteBound, BoundsType* boundType) const;
+
void clipDevRect(const SkIRect& ir, SkRegion::Op op) {
SkRect r;
r.set(ir);
@@ -135,6 +156,22 @@ public:
typedef Iter INHERITED;
};
+ /**
+ * GetConservativeBounds returns a conservative bound of the current clip.
+ * Since this could be the infinite plane (if inverse fills were involved) the
+ * maxWidth and maxHeight parameters can be used to limit the returned bound
+ * to the expected drawing area. Similarly, the offsetX and offsetY parameters
+ * allow the caller to offset the returned bound to account for translated
+ * drawing areas (i.e., those resulting from a saveLayer). For finite bounds,
+ * the translation (+offsetX, +offsetY) is applied before the clamp to the
+ * maximum rectangle: [0,maxWidth) x [0,maxHeight).
+ */
+ void getConservativeBounds(int offsetX,
+ int offsetY,
+ int maxWidth,
+ int maxHeight,
+ SkRect* bounds) const;
+
private:
friend class Iter;