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

Unified Diff: src/gpu/GrClipMaskManager.cpp

Issue 936943002: Pass clip to context (Closed) Base URL: https://skia.googlesource.com/skia.git@pass_down_rendertarget
Patch Set: feedback inc Created 5 years, 10 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
Index: src/gpu/GrClipMaskManager.cpp
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index b28b75cefb9f8b18210c87c06f8f9ab0f9eb5711..99c74e3c3f5d09133e1da6b667c9e6452e24e886 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -231,29 +231,47 @@ bool GrClipMaskManager::setupClipping(GrPipelineBuilder* pipelineBuilder,
bool ignoreClip = clip.isWideOpen(clipSpaceRTIBounds);
if (!ignoreClip) {
// The clip mask manager always draws with a single IRect so we special case that logic here
- if (GrClip::kIRect_ClipType == clip.clipType()) {
- initialState = GrReducedClip::kAllIn_InitialState;
- clipSpaceIBounds = clip.irect();
- SkNEW_INSERT_AT_LLIST_HEAD(&elements,
- Element,
- (SkRect::Make(clipSpaceIBounds),
- SkRegion::kIntersect_Op, false));
- } else {
- clipSpaceRTIBounds.offset(clip.origin());
- GrReducedClip::ReduceClipStack(*clip.clipStack(),
- clipSpaceRTIBounds,
- &elements,
- &genID,
- &initialState,
- &clipSpaceIBounds,
- &requiresAA);
- if (elements.isEmpty()) {
- if (GrReducedClip::kAllIn_InitialState == initialState) {
- ignoreClip = clipSpaceIBounds == clipSpaceRTIBounds;
- } else {
- return false;
+ // Image filters just use a rect, so we also special case that logic
+ switch (clip.clipType()) {
+ case GrClip::kWideOpen_ClipType:
+ // we should have handled this case above
+ SkASSERT(false);
+ case GrClip::kIRect_ClipType: {
+ initialState = GrReducedClip::kAllIn_InitialState;
+ clipSpaceIBounds = clip.irect();
+ SkNEW_INSERT_AT_LLIST_HEAD(&elements,
+ Element,
+ (SkRect::Make(clipSpaceIBounds),
+ SkRegion::kIntersect_Op, false));
+ } break;
+ case GrClip::kRect_ClipType: {
+ initialState = GrReducedClip::kAllIn_InitialState;
+ clipSpaceIBounds.setLTRB(SkScalarCeilToInt(clip.rect().fLeft),
+ SkScalarCeilToInt(clip.rect().fTop),
+ SkScalarCeilToInt(clip.rect().fRight),
+ SkScalarCeilToInt(clip.rect().fBottom));
+ SkNEW_INSERT_AT_LLIST_HEAD(&elements,
+ Element,
+ (SkRect::Make(clipSpaceIBounds),
+ SkRegion::kIntersect_Op, false));
+ } break;
+ case GrClip::kClipStack_ClipType: {
+ clipSpaceRTIBounds.offset(clip.origin());
+ GrReducedClip::ReduceClipStack(*clip.clipStack(),
+ clipSpaceRTIBounds,
+ &elements,
+ &genID,
+ &initialState,
+ &clipSpaceIBounds,
+ &requiresAA);
+ if (elements.isEmpty()) {
+ if (GrReducedClip::kAllIn_InitialState == initialState) {
+ ignoreClip = clipSpaceIBounds == clipSpaceRTIBounds;
+ } else {
+ return false;
+ }
}
- }
+ } break;
}
}
« no previous file with comments | « src/gpu/GrClip.cpp ('k') | src/gpu/GrContext.cpp » ('j') | src/gpu/GrTextContext.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698