| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 GrPipelineBuilder::AutoRestoreEffects* are
, | 209 GrPipelineBuilder::AutoRestoreEffects* are
, |
| 210 GrPipelineBuilder::AutoRestoreStencil* ars
, | 210 GrPipelineBuilder::AutoRestoreStencil* ars
, |
| 211 GrScissorState* scissorState, | 211 GrScissorState* scissorState, |
| 212 const SkRect* devBounds) { | 212 const SkRect* devBounds) { |
| 213 fCurrClipMaskType = kNone_ClipMaskType; | 213 fCurrClipMaskType = kNone_ClipMaskType; |
| 214 if (kRespectClip_StencilClipMode == fClipMode) { | 214 if (kRespectClip_StencilClipMode == fClipMode) { |
| 215 fClipMode = kIgnoreClip_StencilClipMode; | 215 fClipMode = kIgnoreClip_StencilClipMode; |
| 216 } | 216 } |
| 217 | 217 |
| 218 GrReducedClip::ElementList elements(16); | 218 GrReducedClip::ElementList elements(16); |
| 219 int32_t genID; | 219 int32_t genID = 0; |
| 220 GrReducedClip::InitialState initialState; | 220 GrReducedClip::InitialState initialState = GrReducedClip::kAllIn_InitialStat
e; |
| 221 SkIRect clipSpaceIBounds; | 221 SkIRect clipSpaceIBounds; |
| 222 bool requiresAA; | 222 bool requiresAA = false; |
| 223 GrRenderTarget* rt = pipelineBuilder->getRenderTarget(); | 223 GrRenderTarget* rt = pipelineBuilder->getRenderTarget(); |
| 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 // Image filters just use a rect, so we also special case that logic | 234 // Image filters just use a rect, so we also special case that logic |
| 235 switch (clip.clipType()) { | 235 switch (clip.clipType()) { |
| 236 case GrClip::kWideOpen_ClipType: | 236 case GrClip::kWideOpen_ClipType: |
| 237 // we should have handled this case above | 237 // we should have handled this case above |
| 238 SkASSERT(false); | 238 SkASSERT(false); |
| 239 case GrClip::kIRect_ClipType: { | 239 case GrClip::kIRect_ClipType: { |
| 240 initialState = GrReducedClip::kAllIn_InitialState; | |
| 241 clipSpaceIBounds = clip.irect(); | 240 clipSpaceIBounds = clip.irect(); |
| 242 SkNEW_INSERT_AT_LLIST_HEAD(&elements, | 241 SkNEW_INSERT_AT_LLIST_HEAD(&elements, |
| 243 Element, | 242 Element, |
| 244 (SkRect::Make(clipSpaceIBounds), | 243 (SkRect::Make(clipSpaceIBounds), |
| 245 SkRegion::kIntersect_Op, false)); | 244 SkRegion::kIntersect_Op, false)); |
| 246 } break; | 245 } break; |
| 247 case GrClip::kRect_ClipType: { | 246 case GrClip::kRect_ClipType: { |
| 248 initialState = GrReducedClip::kAllIn_InitialState; | |
| 249 clipSpaceIBounds.setLTRB(SkScalarCeilToInt(clip.rect().fLeft), | 247 clipSpaceIBounds.setLTRB(SkScalarCeilToInt(clip.rect().fLeft), |
| 250 SkScalarCeilToInt(clip.rect().fTop), | 248 SkScalarCeilToInt(clip.rect().fTop), |
| 251 SkScalarCeilToInt(clip.rect().fRight), | 249 SkScalarCeilToInt(clip.rect().fRight), |
| 252 SkScalarCeilToInt(clip.rect().fBottom))
; | 250 SkScalarCeilToInt(clip.rect().fBottom))
; |
| 253 SkNEW_INSERT_AT_LLIST_HEAD(&elements, | 251 SkNEW_INSERT_AT_LLIST_HEAD(&elements, |
| 254 Element, | 252 Element, |
| 255 (SkRect::Make(clipSpaceIBounds), | 253 (SkRect::Make(clipSpaceIBounds), |
| 256 SkRegion::kIntersect_Op, false)); | 254 SkRegion::kIntersect_Op, false)); |
| 257 } break; | 255 } break; |
| 258 case GrClip::kClipStack_ClipType: { | 256 case GrClip::kClipStack_ClipType: { |
| (...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 fAACache.setContext(clipTarget->getContext()); | 1118 fAACache.setContext(clipTarget->getContext()); |
| 1121 } | 1119 } |
| 1122 | 1120 |
| 1123 void GrClipMaskManager::adjustPathStencilParams(const GrStencilBuffer* stencilBu
ffer, | 1121 void GrClipMaskManager::adjustPathStencilParams(const GrStencilBuffer* stencilBu
ffer, |
| 1124 GrStencilSettings* settings) { | 1122 GrStencilSettings* settings) { |
| 1125 if (stencilBuffer) { | 1123 if (stencilBuffer) { |
| 1126 int stencilBits = stencilBuffer->bits(); | 1124 int stencilBits = stencilBuffer->bits(); |
| 1127 this->adjustStencilParams(settings, fClipMode, stencilBits); | 1125 this->adjustStencilParams(settings, fClipMode, stencilBits); |
| 1128 } | 1126 } |
| 1129 } | 1127 } |
| OLD | NEW |