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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 scissorState->set(clip.irect()); |
245 this->setPipelineBuilderStencil(pipelineBuilder, ars); | 245 this->setPipelineBuilderStencil(pipelineBuilder, ars); |
246 return true; | 246 return true; |
247 case GrClip::kRect_ClipType: { | |
248 const SkRect& rect = clip.rect(); | |
249 SkIRect scissor; | |
250 scissor.fLeft = SkScalarRoundToInt(rect.fLeft); | |
251 scissor.fTop = SkScalarRoundToInt(rect.fTop); | |
252 scissor.fRight = SkScalarRoundToInt(rect.fRight); | |
253 scissor.fBottom = SkScalarRoundToInt(rect.fBottom); | |
254 scissorState->set(scissor); | |
255 this->setPipelineBuilderStencil(pipelineBuilder, ars); | |
256 } return true; | |
257 case GrClip::kClipStack_ClipType: { | 247 case GrClip::kClipStack_ClipType: { |
258 clipSpaceRTIBounds.offset(clip.origin()); | 248 clipSpaceRTIBounds.offset(clip.origin()); |
259 GrReducedClip::ReduceClipStack(*clip.clipStack(), | 249 GrReducedClip::ReduceClipStack(*clip.clipStack(), |
260 clipSpaceRTIBounds, | 250 clipSpaceRTIBounds, |
261 &elements, | 251 &elements, |
262 &genID, | 252 &genID, |
263 &initialState, | 253 &initialState, |
264 &clipSpaceIBounds, | 254 &clipSpaceIBounds, |
265 &requiresAA); | 255 &requiresAA); |
266 if (elements.isEmpty()) { | 256 if (elements.isEmpty()) { |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 fAACache.setContext(clipTarget->getContext()); | 1108 fAACache.setContext(clipTarget->getContext()); |
1119 } | 1109 } |
1120 | 1110 |
1121 void GrClipMaskManager::adjustPathStencilParams(const GrStencilBuffer* stencilBu
ffer, | 1111 void GrClipMaskManager::adjustPathStencilParams(const GrStencilBuffer* stencilBu
ffer, |
1122 GrStencilSettings* settings) { | 1112 GrStencilSettings* settings) { |
1123 if (stencilBuffer) { | 1113 if (stencilBuffer) { |
1124 int stencilBits = stencilBuffer->bits(); | 1114 int stencilBits = stencilBuffer->bits(); |
1125 this->adjustStencilParams(settings, fClipMode, stencilBits); | 1115 this->adjustStencilParams(settings, fClipMode, stencilBits); |
1126 } | 1116 } |
1127 } | 1117 } |
OLD | NEW |