Index: src/gpu/GrReducedClip.cpp |
diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp |
index 2b6583e3e328f2a5454620a3c2ae68b3a992c7de..9a7fc97529566b3a6324bcd35c0df07775875e03 100644 |
--- a/src/gpu/GrReducedClip.cpp |
+++ b/src/gpu/GrReducedClip.cpp |
@@ -70,7 +70,9 @@ void ReduceClipStack(const SkClipStack& stack, |
SkRect scalarTighterBounds = SkRect::MakeFromIRect(*tighterBounds); |
if (scalarTighterBounds == isectRect) { |
// the round-out didn't add any area outside the clip rect. |
- *requiresAA = false; |
+ if (NULL != requiresAA) { |
+ *requiresAA = false; |
+ } |
*initialState = kAllIn_InitialState; |
return; |
} |
@@ -78,7 +80,12 @@ void ReduceClipStack(const SkClipStack& stack, |
// iior should only be true if aa/non-aa status matches among all elements. |
SkClipStack::Iter iter(stack, SkClipStack::Iter::kTop_IterStart); |
bool doAA = iter.prev()->isAA(); |
- SkNEW_INSERT_AT_LLIST_HEAD(result, Element, (isectRect, SkRegion::kReplace_Op, doAA)); |
+ // The clip established by the element list might be cached based on the last |
+ // generation id. Without walking the stack, we do not knoow what was the generation |
+ // id that lead to this state. Make a conservative guess. |
+ SkNEW_INSERT_AT_LLIST_HEAD(result, Element, (isectRect, SkRegion::kReplace_Op, doAA, |
bsalomon
2013/10/30 14:25:59
Rather than assigning a genID to the manufactured
Kimmo Kinnunen
2013/11/01 12:12:20
Done.
|
+ stack.getTopmostGenID())); |
+ |
if (NULL != requiresAA) { |
*requiresAA = doAA; |
} |
@@ -124,6 +131,10 @@ void ReduceClipStack(const SkClipStack& stack, |
// Now that we have determined the bounds to use and filtered out the trivial cases, call the |
// helper that actually walks the stack. |
reduced_stack_walker(stack, scalarBounds, result, initialState, requiresAA); |
+ |
+ // The list that was computed in this function may be cached based on the gen id of the last |
+ // element. |
+ SkASSERT(0 == result->count() || SkClipStack::kInvalidGenID != result->tail()->getGenID()); |
} |
void reduced_stack_walker(const SkClipStack& stack, |
@@ -318,7 +329,7 @@ void reduced_stack_walker(const SkClipStack& stack, |
SkRegion::kReverseDifference_Op == element->getOp()); |
SkNEW_INSERT_AT_LLIST_HEAD(result, |
Element, |
- (queryBounds, SkRegion::kReverseDifference_Op, false)); |
+ (queryBounds, SkRegion::kReverseDifference_Op, false, element->getGenID())); |
} else { |
Element* newElement = result->addToHead(*element); |
if (newElement->isAA()) { |