From e8ca6c6e3a55634ac76efe5aceafaf8d669f43ba Mon Sep 17 00:00:00 2001 From: "bsalomon@google.com" Date: Wed, 7 Nov 2012 21:19:10 +0000 Subject: Combine multiple intersecting rects in SkClipStack::Iter. R=robertphillips@google.com Review URL: https://codereview.appspot.com/6816104 git-svn-id: http://skia.googlecode.com/svn/trunk@6339 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/core/SkClipStack.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'include/core') diff --git a/include/core/SkClipStack.h b/include/core/SkClipStack.h index 79fd2c9dd4..443e6ad7d9 100644 --- a/include/core/SkClipStack.h +++ b/include/core/SkClipStack.h @@ -103,7 +103,7 @@ public: /** * The generation ID has three reserved values to indicate special - * (potentially ignoreable) cases + * (potentially ignorable) cases */ static const int32_t kInvalidGenID = 0; static const int32_t kEmptyGenID = 1; // no pixels writeable @@ -158,6 +158,14 @@ public: const Clip* next(); const Clip* prev(); + /** + * This is a variant of next() that greedily attempts to combine elements when possible. + * Currently it attempts to combine intersecting rectangles, though it may do more in the + * future. The returned Clip may not refer to a single element in the stack, so its + * generation ID may be invalid. + */ + const Clip* nextCombined(); + /** * Moves the iterator to the topmost clip with the specified RegionOp * and returns that clip. If no clip with that op is found, @@ -174,7 +182,7 @@ public: const SkClipStack* fStack; Clip fClip; SkDeque::Iter fIter; - + SkRect fCombinedRect; // used for nextCombined() /** * updateClip updates fClip to the current state of fIter. It unifies * functionality needed by both next() and prev(). -- cgit v1.2.3