OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrClipMaskManager.h" | 8 #include "GrClipMaskManager.h" |
9 #include "GrAAConvexPathRenderer.h" | 9 #include "GrAAConvexPathRenderer.h" |
10 #include "GrAAHairLinePathRenderer.h" | 10 #include "GrAAHairLinePathRenderer.h" |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 | 224 |
225 // GrDrawTarget should have filtered this for us | 225 // GrDrawTarget should have filtered this for us |
226 SkASSERT(rt); | 226 SkASSERT(rt); |
227 | 227 |
228 SkIRect clipSpaceRTIBounds = SkIRect::MakeWH(rt->width(), rt->height()); | 228 SkIRect clipSpaceRTIBounds = SkIRect::MakeWH(rt->width(), rt->height()); |
229 const GrClip& clip = pipelineBuilder->clip(); | 229 const GrClip& clip = pipelineBuilder->clip(); |
230 // TODO we shouldn't be ignoring the clip mask manager's clip. This is temp orary. | 230 // TODO we shouldn't be ignoring the clip mask manager's clip. This is temp orary. |
231 bool ignoreClip = clip.isWideOpen(clipSpaceRTIBounds); | 231 bool ignoreClip = clip.isWideOpen(clipSpaceRTIBounds); |
232 if (!ignoreClip) { | 232 if (!ignoreClip) { |
233 // The clip mask manager always draws with a single IRect so we special case that logic here | 233 // The clip mask manager always draws with a single IRect so we special case that logic here |
234 if (GrClip::kIRect_ClipType == clip.clipType()) { | 234 // Image filters just use a rect, so we also special case that logic |
235 initialState = GrReducedClip::kAllIn_InitialState; | 235 switch (clip.clipType()) { |
236 clipSpaceIBounds = clip.irect(); | 236 default: |
bsalomon
2015/02/24 17:02:05
We have bots that have compile flags set that will
| |
237 SkNEW_INSERT_AT_LLIST_HEAD(&elements, | 237 SkFAIL("Incomplete switch\n"); |
238 Element, | 238 case GrClip::kIRect_ClipType: { |
239 (SkRect::Make(clipSpaceIBounds), | 239 initialState = GrReducedClip::kAllIn_InitialState; |
240 SkRegion::kIntersect_Op, false)); | 240 clipSpaceIBounds = clip.irect(); |
241 } else { | 241 SkNEW_INSERT_AT_LLIST_HEAD(&elements, |
242 clipSpaceRTIBounds.offset(clip.origin()); | 242 Element, |
243 GrReducedClip::ReduceClipStack(*clip.clipStack(), | 243 (SkRect::Make(clipSpaceIBounds), |
244 clipSpaceRTIBounds, | 244 SkRegion::kIntersect_Op, false)); |
245 &elements, | 245 } break; |
246 &genID, | 246 case GrClip::kRect_ClipType: { |
247 &initialState, | 247 initialState = GrReducedClip::kAllIn_InitialState; |
248 &clipSpaceIBounds, | 248 clipSpaceIBounds.setLTRB(SkScalarCeilToInt(clip.rect().fLeft), |
249 &requiresAA); | 249 SkScalarCeilToInt(clip.rect().fTop), |
250 if (elements.isEmpty()) { | 250 SkScalarCeilToInt(clip.rect().fRight), |
251 if (GrReducedClip::kAllIn_InitialState == initialState) { | 251 SkScalarCeilToInt(clip.rect().fBottom)) ; |
252 ignoreClip = clipSpaceIBounds == clipSpaceRTIBounds; | 252 SkNEW_INSERT_AT_LLIST_HEAD(&elements, |
253 } else { | 253 Element, |
254 return false; | 254 (SkRect::Make(clipSpaceIBounds), |
255 SkRegion::kIntersect_Op, false)); | |
256 } break; | |
257 case GrClip::kClipStack_ClipType: { | |
258 clipSpaceRTIBounds.offset(clip.origin()); | |
259 GrReducedClip::ReduceClipStack(*clip.clipStack(), | |
260 clipSpaceRTIBounds, | |
261 &elements, | |
262 &genID, | |
263 &initialState, | |
264 &clipSpaceIBounds, | |
265 &requiresAA); | |
266 if (elements.isEmpty()) { | |
267 if (GrReducedClip::kAllIn_InitialState == initialState) { | |
268 ignoreClip = clipSpaceIBounds == clipSpaceRTIBounds; | |
269 } else { | |
270 return false; | |
271 } | |
255 } | 272 } |
256 } | 273 } break; |
257 } | 274 } |
258 } | 275 } |
259 | 276 |
260 if (ignoreClip) { | 277 if (ignoreClip) { |
261 this->setPipelineBuilderStencil(pipelineBuilder, ars); | 278 this->setPipelineBuilderStencil(pipelineBuilder, ars); |
262 return true; | 279 return true; |
263 } | 280 } |
264 | 281 |
265 // An element count of 4 was chosen because of the common pattern in Blink o f: | 282 // An element count of 4 was chosen because of the common pattern in Blink o f: |
266 // isect RR | 283 // isect RR |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1102 fAACache.setContext(clipTarget->getContext()); | 1119 fAACache.setContext(clipTarget->getContext()); |
1103 } | 1120 } |
1104 | 1121 |
1105 void GrClipMaskManager::adjustPathStencilParams(const GrStencilBuffer* stencilBu ffer, | 1122 void GrClipMaskManager::adjustPathStencilParams(const GrStencilBuffer* stencilBu ffer, |
1106 GrStencilSettings* settings) { | 1123 GrStencilSettings* settings) { |
1107 if (stencilBuffer) { | 1124 if (stencilBuffer) { |
1108 int stencilBits = stencilBuffer->bits(); | 1125 int stencilBits = stencilBuffer->bits(); |
1109 this->adjustStencilParams(settings, fClipMode, stencilBits); | 1126 this->adjustStencilParams(settings, fClipMode, stencilBits); |
1110 } | 1127 } |
1111 } | 1128 } |
OLD | NEW |