Made clarifying renamings to SkClipStack's iterators (and added to unit test)
http://codereview.appspot.com/6423051/
git-svn-id: http://skia.googlecode.com/svn/trunk@4692 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/core/SkClipStack.h b/include/core/SkClipStack.h
index 60c4421..daeb826 100644
--- a/include/core/SkClipStack.h
+++ b/include/core/SkClipStack.h
@@ -45,8 +45,8 @@
class Iter {
public:
enum IterStart {
- kFront_IterStart = SkDeque::Iter::kFront_IterStart,
- kBack_IterStart = SkDeque::Iter::kBack_IterStart
+ kBottom_IterStart = SkDeque::Iter::kFront_IterStart,
+ kTop_IterStart = SkDeque::Iter::kBack_IterStart
};
/**
@@ -80,11 +80,11 @@
const Clip* prev();
/**
- * Moves the iterator to the last clip with the specified RegionOp
+ * Moves the iterator to the topmost clip with the specified RegionOp
* and returns that clip. If no clip with that op is found,
* returns NULL.
*/
- const Clip* skipToLast(SkRegion::Op op);
+ const Clip* skipToTopmost(SkRegion::Op op);
/**
* Restarts the iterator on a clip stack.
@@ -103,17 +103,20 @@
const Clip* updateClip(const SkClipStack::Rec* rec);
};
- // Inherit privately from Iter to prevent access to reverse iteration
- class B2FIter : private Iter {
+ /**
+ * The B2TIter iterates from the bottom of the stack to the top.
+ * It inherits privately from Iter to prevent access to reverse iteration.
+ */
+ class B2TIter : private Iter {
public:
- B2FIter() {}
+ B2TIter() {}
/**
* Wrap Iter's 2 parameter ctor to force initialization to the
- * beginning of the deque
+ * beginning of the deque/bottom of the stack
*/
- B2FIter(const SkClipStack& stack)
- : INHERITED(stack, kFront_IterStart) {
+ B2TIter(const SkClipStack& stack)
+ : INHERITED(stack, kBottom_IterStart) {
}
using Iter::Clip;
@@ -121,10 +124,10 @@
/**
* Wrap Iter::reset to force initialization to the
- * beginning of the deque
+ * beginning of the deque/bottom of the stack
*/
void reset(const SkClipStack& stack) {
- this->INHERITED::reset(stack, kFront_IterStart);
+ this->INHERITED::reset(stack, kBottom_IterStart);
}
private: