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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 this->setPipelineBuilderStencil(pipelineBuilder, ars); | 233 this->setPipelineBuilderStencil(pipelineBuilder, ars); |
234 return true; | 234 return true; |
235 } | 235 } |
236 | 236 |
237 // The clip mask manager always draws with a single IRect so we special case
that logic here | 237 // The clip mask manager always draws with a single IRect so we special case
that logic here |
238 // Image filters just use a rect, so we also special case that logic | 238 // Image filters just use a rect, so we also special case that logic |
239 switch (clip.clipType()) { | 239 switch (clip.clipType()) { |
240 case GrClip::kWideOpen_ClipType: | 240 case GrClip::kWideOpen_ClipType: |
241 SkFAIL("Should have caught this with clip.isWideOpen()"); | 241 SkFAIL("Should have caught this with clip.isWideOpen()"); |
242 return true; | 242 return true; |
243 case GrClip::kIRect_ClipType: | 243 case GrClip::kIRect_ClipType: { |
244 scissorState->set(clip.irect()); | 244 SkIRect scissor = clip.irect(); |
245 this->setPipelineBuilderStencil(pipelineBuilder, ars); | 245 if (scissor.intersect(clipSpaceRTIBounds)) { |
246 return true; | 246 scissorState->set(scissor); |
| 247 this->setPipelineBuilderStencil(pipelineBuilder, ars); |
| 248 return true; |
| 249 } |
| 250 return false; |
| 251 } |
247 case GrClip::kClipStack_ClipType: { | 252 case GrClip::kClipStack_ClipType: { |
248 clipSpaceRTIBounds.offset(clip.origin()); | 253 clipSpaceRTIBounds.offset(clip.origin()); |
249 GrReducedClip::ReduceClipStack(*clip.clipStack(), | 254 GrReducedClip::ReduceClipStack(*clip.clipStack(), |
250 clipSpaceRTIBounds, | 255 clipSpaceRTIBounds, |
251 &elements, | 256 &elements, |
252 &genID, | 257 &genID, |
253 &initialState, | 258 &initialState, |
254 &clipSpaceIBounds, | 259 &clipSpaceIBounds, |
255 &requiresAA); | 260 &requiresAA); |
256 if (elements.isEmpty()) { | 261 if (elements.isEmpty()) { |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 fAACache.setContext(clipTarget->getContext()); | 1113 fAACache.setContext(clipTarget->getContext()); |
1109 } | 1114 } |
1110 | 1115 |
1111 void GrClipMaskManager::adjustPathStencilParams(const GrStencilBuffer* stencilBu
ffer, | 1116 void GrClipMaskManager::adjustPathStencilParams(const GrStencilBuffer* stencilBu
ffer, |
1112 GrStencilSettings* settings) { | 1117 GrStencilSettings* settings) { |
1113 if (stencilBuffer) { | 1118 if (stencilBuffer) { |
1114 int stencilBits = stencilBuffer->bits(); | 1119 int stencilBits = stencilBuffer->bits(); |
1115 this->adjustStencilParams(settings, fClipMode, stencilBits); | 1120 this->adjustStencilParams(settings, fClipMode, stencilBits); |
1116 } | 1121 } |
1117 } | 1122 } |
OLD | NEW |