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

Unified Diff: src/gpu/GrReducedClip.cpp

Issue 2246113002: Convert GrAppliedClip interface to builder style (Closed) Base URL: https://skia.googlesource.com/skia.git@fixstencilpath
Patch Set: Convert GrAppliedClip interface to builder style Created 4 years, 4 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 f7bac4aa58ab8e1ac6bed3a5f8a9fbb9e95139a4..132936c64e0c811e422279c8aa9967336fe1146d 100644
--- a/src/gpu/GrReducedClip.cpp
+++ b/src/gpu/GrReducedClip.cpp
@@ -343,9 +343,7 @@ GrReducedClip::GrReducedClip(const SkClipStack& stack, const SkRect& queryBounds
// generation id. When we make early returns, we do not know what was the generation
// id that lead to the state. Make a conservative guess.
fGenID = stack.getTopmostGenID();
-
- // TODO: instead devise a way of telling the caller to disregard some or all of the clip bounds.
- fIBounds = GrClip::GetPixelIBounds(queryBounds);
+ fHasIBounds = false;
if (stack.isWideOpen()) {
fInitialState = InitialState::kAllIn;
@@ -372,6 +370,7 @@ GrReducedClip::GrReducedClip(const SkClipStack& stack, const SkRect& queryBounds
// The clip is a non-aa rect. This is the one spot where we can actually implement the
// clip (using fIBounds) rather than just telling the caller what it should be.
stackBounds.round(&fIBounds);
+ fHasIBounds = true;
fInitialState = fIBounds.isEmpty() ? InitialState::kAllOut : InitialState::kAllIn;
return;
}
@@ -380,8 +379,11 @@ GrReducedClip::GrReducedClip(const SkClipStack& stack, const SkRect& queryBounds
return;
}
- SkAssertResult(fIBounds.intersect(GrClip::GetPixelIBounds(stackBounds)));
+ SkRect tightBounds;
+ SkAssertResult(tightBounds.intersect(stackBounds, queryBounds));
+ fIBounds = GrClip::GetPixelIBounds(tightBounds);
SkASSERT(!fIBounds.isEmpty()); // Empty should have been blocked by IsOutsideClip above.
+ fHasIBounds = true;
// Implement the clip with an AA rect element.
fElements.addToHead(stackBounds, SkRegion::kReplace_Op, true/*doAA*/);
@@ -396,10 +398,11 @@ GrReducedClip::GrReducedClip(const SkClipStack& stack, const SkRect& queryBounds
// Tighten the query by introducing a new clip at the stack's pixel boundaries. (This new
// clip will be enforced by the scissor through fIBounds.)
SkAssertResult(tighterQuery.intersect(GrClip::GetPixelBounds(stackBounds)));
- fIBounds = GrClip::GetPixelIBounds(tighterQuery);
}
+ fIBounds = GrClip::GetPixelIBounds(tighterQuery);
SkASSERT(!fIBounds.isEmpty()); // Empty should have been blocked by IsOutsideClip above.
+ fHasIBounds = true;
// Now that we have determined the bounds to use and filtered out the trivial cases, call the
// helper that actually walks the stack.
« 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