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

Unified Diff: src/gpu/GrClipMaskManager.cpp

Issue 987653004: Fix rect clips (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix Created 5 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrClipMaskManager.cpp
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index 6635436e8745d088e1e83dd05f047006b48de0f6..f0eb2477bd11605164a34cbfbe4601717bcc76d9 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -165,7 +165,7 @@ bool GrClipMaskManager::installClipEffects(GrPipelineBuilder* pipelineBuilder,
invert ? kInverseFillAA_GrProcessorEdgeType : kFillAA_GrProcessorEdgeType;
} else {
edgeType =
- invert ? kInverseFillBW_GrProcessorEdgeType : kFillBW_GrProcessorEdgeType;
+invert ? kInverseFillBW_GrProcessorEdgeType : kFillBW_GrProcessorEdgeType;
}
SkAutoTUnref<GrFragmentProcessor> fp;
switch (iter.get()->getType()) {
@@ -229,57 +229,53 @@ bool GrClipMaskManager::setupClipping(GrPipelineBuilder* pipelineBuilder,
SkIRect clipSpaceRTIBounds = SkIRect::MakeWH(rt->width(), rt->height());
const GrClip& clip = pipelineBuilder->clip();
- // TODO we shouldn't be ignoring the clip mask manager's clip. This is temporary.
- bool ignoreClip = clip.isWideOpen(clipSpaceRTIBounds);
- if (!ignoreClip) {
- // The clip mask manager always draws with a single IRect so we special case that logic here
- // 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: {
- clipSpaceIBounds = clip.irect();
- SkNEW_INSERT_AT_LLIST_HEAD(&elements,
- Element,
- (SkRect::Make(clipSpaceIBounds),
- SkRegion::kIntersect_Op, false));
- } break;
- case GrClip::kRect_ClipType: {
- 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;
- }
- }
-
- if (ignoreClip) {
+ if (clip.isWideOpen(clipSpaceRTIBounds)) {
this->setPipelineBuilderStencil(pipelineBuilder, ars);
return true;
}
+ // The clip mask manager always draws with a single IRect so we special case that logic here
+ // Image filters just use a rect, so we also special case that logic
+ switch (clip.clipType()) {
+ case GrClip::kWideOpen_ClipType:
+ SkFAIL("Should have caught this with clip.isWideOpen()");
+ return true;
+ case GrClip::kIRect_ClipType:
+ scissorState->set(clip.irect());
+ this->setPipelineBuilderStencil(pipelineBuilder, ars);
+ return true;
+ case GrClip::kRect_ClipType: {
+ const SkRect& rect = clip.rect();
+ SkIRect scissor;
+ scissor.fLeft = SkScalarRoundToInt(rect.fLeft);
+ scissor.fTop = SkScalarRoundToInt(rect.fTop);
+ scissor.fRight = SkScalarRoundToInt(rect.fRight);
+ scissor.fBottom = SkScalarRoundToInt(rect.fBottom);
+ scissorState->set(scissor);
+ this->setPipelineBuilderStencil(pipelineBuilder, ars);
+ } return true;
+ 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) {
+ if (clipSpaceIBounds == clipSpaceRTIBounds) {
+ this->setPipelineBuilderStencil(pipelineBuilder, ars);
+ return true;
+ }
+ } else {
+ return false;
+ }
+ }
+ } break;
+ }
+
// An element count of 4 was chosen because of the common pattern in Blink of:
// isect RR
// diff RR
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698