diff options
Diffstat (limited to 'src/gpu/GrReducedClip.cpp')
-rw-r--r-- | src/gpu/GrReducedClip.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp index a82048b2f9..c5d764d3b7 100644 --- a/src/gpu/GrReducedClip.cpp +++ b/src/gpu/GrReducedClip.cpp @@ -75,7 +75,7 @@ GrReducedClip::GrReducedClip(const SkClipStack& stack, const SkRect& queryBounds fHasIBounds = true; // Implement the clip with an AA rect element. - fElements.addToHead(stackBounds, SkCanvas::kReplace_Op, true/*doAA*/); + fElements.addToHead(stackBounds, kReplace_SkClipOp, true/*doAA*/); fElementsGenID = stack.getTopmostGenID(); fRequiresAA = true; @@ -147,7 +147,7 @@ void GrReducedClip::walkStack(const SkClipStack& stack, const SkRect& queryBound bool isFlip = false; // does this op just flip the in/out state of every point in the bounds switch (element->getOp()) { - case SkCanvas::kDifference_Op: + case kDifference_SkClipOp: // check if the shape subtracted either contains the entire bounds (and makes // the clip empty) or is outside the bounds and therefore can be skipped. if (element->isInverseFilled()) { @@ -173,7 +173,7 @@ void GrReducedClip::walkStack(const SkClipStack& stack, const SkRect& queryBound emsmallens = true; } break; - case SkCanvas::kIntersect_Op: + case kIntersect_SkClipOp: // check if the shape intersected contains the entire bounds and therefore can // be skipped or it is outside the entire bounds and therefore makes the clip // empty. @@ -206,7 +206,7 @@ void GrReducedClip::walkStack(const SkClipStack& stack, const SkRect& queryBound emsmallens = true; } break; - case SkCanvas::kUnion_Op: + case kUnion_SkClipOp: // If the union-ed shape contains the entire bounds then after this element // the bounds is entirely inside the clip. If the union-ed shape is outside the // bounds then this op can be skipped. @@ -229,7 +229,7 @@ void GrReducedClip::walkStack(const SkClipStack& stack, const SkRect& queryBound embiggens = true; } break; - case SkCanvas::kXOR_Op: + case kXOR_SkClipOp: // If the bounds is entirely inside the shape being xor-ed then the effect is // to flip the inside/outside state of every point in the bounds. We may be // able to take advantage of this in the forward pass. If the xor-ed shape @@ -251,7 +251,7 @@ void GrReducedClip::walkStack(const SkClipStack& stack, const SkRect& queryBound emsmallens = embiggens = true; } break; - case SkCanvas::kReverseDifference_Op: + case kReverseDifference_SkClipOp: // When the bounds is entirely within the rev-diff shape then this behaves like xor // and reverses every point inside the bounds. If the shape is completely outside // the bounds then we know after this element is applied that the bounds will be @@ -276,7 +276,7 @@ void GrReducedClip::walkStack(const SkClipStack& stack, const SkRect& queryBound } break; - case SkCanvas::kReplace_Op: + case kReplace_SkClipOp: // Replace will always terminate our walk. We will either begin the forward walk // at the replace op or detect here than the shape is either completely inside // or completely outside the bounds. In this latter case it can be skipped by @@ -326,9 +326,9 @@ void GrReducedClip::walkStack(const SkClipStack& stack, const SkRect& queryBound // if it is a flip, change it to a bounds-filling rect if (isFlip) { - SkASSERT(SkCanvas::kXOR_Op == element->getOp() || - SkCanvas::kReverseDifference_Op == element->getOp()); - fElements.addToHead(SkRect::Make(fIBounds), SkCanvas::kReverseDifference_Op, false); + SkASSERT(kXOR_SkClipOp == element->getOp() || + kReverseDifference_SkClipOp == element->getOp()); + fElements.addToHead(SkRect::Make(fIBounds), kReverseDifference_SkClipOp, false); } else { Element* newElement = fElements.addToHead(*element); if (newElement->isAA()) { @@ -337,11 +337,11 @@ void GrReducedClip::walkStack(const SkClipStack& stack, const SkRect& queryBound // Intersecting an inverse shape is the same as differencing the non-inverse shape. // Replacing with an inverse shape is the same as setting initialState=kAllIn and // differencing the non-inverse shape. - bool isReplace = SkCanvas::kReplace_Op == newElement->getOp(); + bool isReplace = kReplace_SkClipOp == newElement->getOp(); if (newElement->isInverseFilled() && - (SkCanvas::kIntersect_Op == newElement->getOp() || isReplace)) { + (kIntersect_SkClipOp == newElement->getOp() || isReplace)) { newElement->invertShapeFillType(); - newElement->setOp(SkCanvas::kDifference_Op); + newElement->setOp(kDifference_SkClipOp); if (isReplace) { SkASSERT(InitialTriState::kAllOut == initialTriState); initialTriState = InitialTriState::kAllIn; @@ -360,36 +360,36 @@ void GrReducedClip::walkStack(const SkClipStack& stack, const SkRect& queryBound while (element) { bool skippable = false; switch (element->getOp()) { - case SkCanvas::kDifference_Op: + case kDifference_SkClipOp: // subtracting from the empty set yields the empty set. skippable = InitialTriState::kAllOut == initialTriState; break; - case SkCanvas::kIntersect_Op: + case kIntersect_SkClipOp: // intersecting with the empty set yields the empty set if (InitialTriState::kAllOut == initialTriState) { skippable = true; } else { // We can clear to zero and then simply draw the clip element. initialTriState = InitialTriState::kAllOut; - element->setOp(SkCanvas::kReplace_Op); + element->setOp(kReplace_SkClipOp); } break; - case SkCanvas::kUnion_Op: + case kUnion_SkClipOp: if (InitialTriState::kAllIn == initialTriState) { // unioning the infinite plane with anything is a no-op. skippable = true; } else { // unioning the empty set with a shape is the shape. - element->setOp(SkCanvas::kReplace_Op); + element->setOp(kReplace_SkClipOp); } break; - case SkCanvas::kXOR_Op: + case kXOR_SkClipOp: if (InitialTriState::kAllOut == initialTriState) { // xor could be changed to diff in the kAllIn case, not sure it's a win. - element->setOp(SkCanvas::kReplace_Op); + element->setOp(kReplace_SkClipOp); } break; - case SkCanvas::kReverseDifference_Op: + case kReverseDifference_SkClipOp: if (InitialTriState::kAllIn == initialTriState) { // subtracting the whole plane will yield the empty set. skippable = true; @@ -402,11 +402,11 @@ void GrReducedClip::walkStack(const SkClipStack& stack, const SkRect& queryBound if (skippable) { initialTriState = InitialTriState::kAllIn; } else { - element->setOp(SkCanvas::kReplace_Op); + element->setOp(kReplace_SkClipOp); } } break; - case SkCanvas::kReplace_Op: + case kReplace_SkClipOp: skippable = false; // we would have skipped it in the backwards walk if we // could've. break; @@ -431,12 +431,12 @@ void GrReducedClip::walkStack(const SkClipStack& stack, const SkRect& queryBound fInitialState = static_cast<GrReducedClip::InitialState>(initialTriState); } -static bool element_is_pure_subtract(SkCanvas::ClipOp op) { +static bool element_is_pure_subtract(SkClipOp op) { SkASSERT(op >= 0); - return op <= SkCanvas::kIntersect_Op; + return op <= kIntersect_SkClipOp; - GR_STATIC_ASSERT(0 == SkCanvas::kDifference_Op); - GR_STATIC_ASSERT(1 == SkCanvas::kIntersect_Op); + GR_STATIC_ASSERT(0 == kDifference_SkClipOp); + GR_STATIC_ASSERT(1 == kIntersect_SkClipOp); } void GrReducedClip::addInteriorWindowRectangles(int maxWindowRectangles) { @@ -446,7 +446,7 @@ void GrReducedClip::addInteriorWindowRectangles(int maxWindowRectangles) { ElementList::Iter iter(fElements, ElementList::Iter::kTail_IterStart); for (; iter.get() && element_is_pure_subtract(iter.get()->getOp()); iter.prev()) { const Element* element = iter.get(); - if (SkCanvas::kDifference_Op != element->getOp()) { + if (kDifference_SkClipOp != element->getOp()) { continue; } |