Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2501)

Unified Diff: src/gpu/GrReducedClip.cpp

Issue 2130903002: Make all parameters reqiured to GrReducedClip::ReduceClipStack (Closed) Base URL: https://chromium.googlesource.com/skia.git@hidebounds
Patch Set: Address comment Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrReducedClip.h ('k') | tests/ClipStackTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrReducedClip.cpp
diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp
index cbfd89600293116e2d1c4086c33073a83361b6f3..26b89369524f0cfe40610a6b7ad8a56efb0b83ea 100644
--- a/src/gpu/GrReducedClip.cpp
+++ b/src/gpu/GrReducedClip.cpp
@@ -302,9 +302,7 @@ static void reduced_stack_walker(const SkClipStack& stack,
}
}
}
- if (requiresAA) {
- *requiresAA = numAAElements > 0;
- }
+ *requiresAA = numAAElements > 0;
if (0 == result->count()) {
if (*initialState == GrReducedClip::kAllIn_InitialState) {
@@ -329,6 +327,8 @@ void GrReducedClip::ReduceClipStack(const SkClipStack& stack,
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 @@ void GrReducedClip::ReduceClipStack(const SkClipStack& stack,
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 @@ void GrReducedClip::ReduceClipStack(const SkClipStack& stack,
// 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;
}
}
« no previous file with comments | « src/gpu/GrReducedClip.h ('k') | tests/ClipStackTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698