Make all parameters reqiured to GrReducedClip::ReduceClipStack
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2130903002
Review-Url: https://codereview.chromium.org/2130903002
diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp
index cbfd896..26b8936 100644
--- a/src/gpu/GrReducedClip.cpp
+++ b/src/gpu/GrReducedClip.cpp
@@ -302,9 +302,7 @@
}
}
}
- if (requiresAA) {
- *requiresAA = numAAElements > 0;
- }
+ *requiresAA = numAAElements > 0;
if (0 == result->count()) {
if (*initialState == GrReducedClip::kAllIn_InitialState) {
@@ -329,6 +327,8 @@
InitialState* initialState,
SkIRect* tighterBounds,
bool* requiresAA) {
+ SkASSERT(tighterBounds);
+ SkASSERT(requiresAA);
result->reset();
// The clip established by the element list might be cached based on the last
@@ -359,60 +359,44 @@
SkRect isectRect;
if (stackBounds.contains(scalarQueryBounds)) {
*initialState = GrReducedClip::kAllIn_InitialState;
- if (tighterBounds) {
- *tighterBounds = queryBounds;
- }
- if (requiresAA) {
- *requiresAA = false;
- }
+ *tighterBounds = queryBounds;
+ *requiresAA = false;
} else if (isectRect.intersect(stackBounds, scalarQueryBounds)) {
// If the caller asked for tighter integer bounds we may be able to
// return kAllIn and give the bounds with no elements
- if (tighterBounds) {
- isectRect.roundOut(tighterBounds);
- SkRect scalarTighterBounds = SkRect::Make(*tighterBounds);
- if (scalarTighterBounds == isectRect) {
- // the round-out didn't add any area outside the clip rect.
- if (requiresAA) {
- *requiresAA = false;
- }
- *initialState = GrReducedClip::kAllIn_InitialState;
- return;
- }
+ isectRect.roundOut(tighterBounds);
+ SkRect scalarTighterBounds = SkRect::Make(*tighterBounds);
+ if (scalarTighterBounds == isectRect) {
+ // the round-out didn't add any area outside the clip rect.
+ *requiresAA = false;
+ *initialState = GrReducedClip::kAllIn_InitialState;
+ return;
}
*initialState = kAllOut_InitialState;
// 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();
result->addToHead(isectRect, SkRegion::kReplace_Op, doAA);
- if (requiresAA) {
- *requiresAA = doAA;
- }
+ *requiresAA = doAA;
} else {
*initialState = kAllOut_InitialState;
- if (requiresAA) {
- *requiresAA = false;
- }
+ *requiresAA = false;
}
return;
} else {
if (SkClipStack::kNormal_BoundsType == stackBoundsType) {
if (!SkRect::Intersects(stackBounds, scalarQueryBounds)) {
*initialState = kAllOut_InitialState;
- if (requiresAA) {
- *requiresAA = false;
- }
+ *requiresAA = false;
return;
}
- if (tighterBounds) {
- SkIRect stackIBounds;
- stackBounds.roundOut(&stackIBounds);
- if (!tighterBounds->intersect(queryBounds, stackIBounds)) {
- SkASSERT(0);
- tighterBounds->setEmpty();
- }
- bounds = tighterBounds;
+ SkIRect stackIBounds;
+ stackBounds.roundOut(&stackIBounds);
+ if (!tighterBounds->intersect(queryBounds, stackIBounds)) {
+ SkASSERT(0);
+ tighterBounds->setEmpty();
}
+ bounds = tighterBounds;
} else {
if (stackBounds.contains(scalarQueryBounds)) {
*initialState = kAllOut_InitialState;
@@ -420,9 +404,7 @@
// but we don't know that *all* the pixels in the box are outside the clip. So
// proceed to walking the stack.
}
- if (tighterBounds) {
- *tighterBounds = queryBounds;
- }
+ *tighterBounds = queryBounds;
}
}
diff --git a/src/gpu/GrReducedClip.h b/src/gpu/GrReducedClip.h
index 3a7c173..da0bae6 100644
--- a/src/gpu/GrReducedClip.h
+++ b/src/gpu/GrReducedClip.h
@@ -26,24 +26,19 @@
* full stack to the rectangle. The clip stack generation id that represents
* the list of elements is returned in resultGenID. The initial state of the
* query rectangle before the first clip element is applied is returned via
- * initialState. Optionally, the caller can request a tighter bounds on the
- * clip be returned via tighterBounds. If not nullptr, tighterBounds will
- * always be contained by queryBounds after return. If tighterBounds is
- * specified then it is assumed that the caller will implicitly clip against
- * it. If the caller specifies non-nullptr for requiresAA then it will indicate
- * whether anti-aliasing is required to process any of the elements in the
- * result.
- *
- * This may become a member function of SkClipStack when its interface is
- * determined to be stable.
+ * initialState. The reducer output tighterBounds is a tighter bounds on the
+ * clip. tighterBounds will always be contained by queryBounds after return.
+ * It is assumed that the caller will not draw outside of tighterBounds.
+ * The requiresAA output will indicate whether anti-aliasing is required to
+ * process any of the elements in the element list result.
*/
static void ReduceClipStack(const SkClipStack& stack,
const SkIRect& queryBounds,
ElementList* result,
int32_t* resultGenID,
InitialState* initialState,
- SkIRect* tighterBounds = nullptr,
- bool* requiresAA = nullptr);
+ SkIRect* tighterBounds,
+ bool* requiresAA);
};
#endif