OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrClipMaskManager.h" | 9 #include "GrClipMaskManager.h" |
10 #include "GrAAConvexPathRenderer.h" | 10 #include "GrAAConvexPathRenderer.h" |
11 #include "GrAAHairLinePathRenderer.h" | 11 #include "GrAAHairLinePathRenderer.h" |
12 #include "GrAARectRenderer.h" | 12 #include "GrAARectRenderer.h" |
13 #include "GrDrawTargetCaps.h" | 13 #include "GrDrawTargetCaps.h" |
14 #include "GrGpu.h" | 14 #include "GrGpu.h" |
15 #include "GrPaint.h" | 15 #include "GrPaint.h" |
16 #include "GrPathRenderer.h" | 16 #include "GrPathRenderer.h" |
17 #include "GrRenderTarget.h" | 17 #include "GrRenderTarget.h" |
18 #include "GrStencilBuffer.h" | 18 #include "GrStencilBuffer.h" |
19 #include "GrSWMaskHelper.h" | 19 #include "GrSWMaskHelper.h" |
| 20 #include "effects/GrTextureDomain.h" |
| 21 #include "effects/GrConvexPolyEffect.h" |
| 22 #include "effects/GrRRectEffect.h" |
20 #include "SkRasterClip.h" | 23 #include "SkRasterClip.h" |
21 #include "SkStrokeRec.h" | 24 #include "SkStrokeRec.h" |
22 #include "SkTLazy.h" | 25 #include "SkTLazy.h" |
23 #include "effects/GrTextureDomain.h" | |
24 #include "effects/GrConvexPolyEffect.h" | |
25 #include "effects/GrRRectEffect.h" | |
26 | 26 |
27 #define GR_AA_CLIP 1 | 27 #define GR_AA_CLIP 1 |
28 | 28 |
29 typedef SkClipStack::Element Element; | 29 typedef SkClipStack::Element Element; |
30 | 30 |
31 //////////////////////////////////////////////////////////////////////////////// | 31 //////////////////////////////////////////////////////////////////////////////// |
32 namespace { | 32 namespace { |
33 // set up the draw state to enable the aa clipping mask. Besides setting up the | 33 // set up the draw state to enable the aa clipping mask. Besides setting up the |
34 // stage matrix this also alters the vertex layout | 34 // stage matrix this also alters the vertex layout |
35 void setup_drawstate_aaclip(GrGpu* gpu, | 35 void setup_drawstate_aaclip(GrGpu* gpu, |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 } | 205 } |
206 | 206 |
207 return !failed; | 207 return !failed; |
208 } | 208 } |
209 | 209 |
210 //////////////////////////////////////////////////////////////////////////////// | 210 //////////////////////////////////////////////////////////////////////////////// |
211 // sort out what kind of clip mask needs to be created: alpha, stencil, | 211 // sort out what kind of clip mask needs to be created: alpha, stencil, |
212 // scissor, or entirely software | 212 // scissor, or entirely software |
213 bool GrClipMaskManager::setupClipping(const GrClipData* clipDataIn, | 213 bool GrClipMaskManager::setupClipping(const GrClipData* clipDataIn, |
214 GrDrawState::AutoRestoreEffects* are, | 214 GrDrawState::AutoRestoreEffects* are, |
215 GrDrawState::AutoRestoreStencil* asr, | |
216 const SkRect* devBounds) { | 215 const SkRect* devBounds) { |
217 fCurrClipMaskType = kNone_ClipMaskType; | 216 fCurrClipMaskType = kNone_ClipMaskType; |
218 | 217 |
219 GrReducedClip::ElementList elements(16); | 218 GrReducedClip::ElementList elements(16); |
220 int32_t genID; | 219 int32_t genID; |
221 GrReducedClip::InitialState initialState; | 220 GrReducedClip::InitialState initialState; |
222 SkIRect clipSpaceIBounds; | 221 SkIRect clipSpaceIBounds; |
223 bool requiresAA; | 222 bool requiresAA; |
224 | 223 |
225 GrDrawState* drawState = fGpu->drawState(); | 224 GrDrawState* drawState = fGpu->drawState(); |
226 | 225 |
227 const GrRenderTarget* rt = drawState->getRenderTarget(); | 226 const GrRenderTarget* rt = drawState->getRenderTarget(); |
228 // GrDrawTarget should have filtered this for us | 227 // GrDrawTarget should have filtered this for us |
229 SkASSERT(rt); | 228 SkASSERT(rt); |
230 | 229 |
231 bool ignoreClip = !drawState->isClipState() || clipDataIn->fClipStack->isWid
eOpen(); | 230 bool ignoreClip = !drawState->isClipState() || clipDataIn->fClipStack->isWid
eOpen(); |
| 231 |
232 if (!ignoreClip) { | 232 if (!ignoreClip) { |
233 SkIRect clipSpaceRTIBounds = SkIRect::MakeWH(rt->width(), rt->height()); | 233 SkIRect clipSpaceRTIBounds = SkIRect::MakeWH(rt->width(), rt->height()); |
234 clipSpaceRTIBounds.offset(clipDataIn->fOrigin); | 234 clipSpaceRTIBounds.offset(clipDataIn->fOrigin); |
235 GrReducedClip::ReduceClipStack(*clipDataIn->fClipStack, | 235 GrReducedClip::ReduceClipStack(*clipDataIn->fClipStack, |
236 clipSpaceRTIBounds, | 236 clipSpaceRTIBounds, |
237 &elements, | 237 &elements, |
238 &genID, | 238 &genID, |
239 &initialState, | 239 &initialState, |
240 &clipSpaceIBounds, | 240 &clipSpaceIBounds, |
241 &requiresAA); | 241 &requiresAA); |
242 if (elements.isEmpty()) { | 242 if (elements.isEmpty()) { |
243 if (GrReducedClip::kAllIn_InitialState == initialState) { | 243 if (GrReducedClip::kAllIn_InitialState == initialState) { |
244 ignoreClip = clipSpaceIBounds == clipSpaceRTIBounds; | 244 ignoreClip = clipSpaceIBounds == clipSpaceRTIBounds; |
245 } else { | 245 } else { |
246 return false; | 246 return false; |
247 } | 247 } |
248 } | 248 } |
249 } | 249 } |
250 | 250 |
251 if (ignoreClip) { | 251 if (ignoreClip) { |
252 fGpu->disableScissor(); | 252 fGpu->disableScissor(); |
253 this->setDrawStateStencil(asr); | 253 this->setGpuStencil(); |
254 return true; | 254 return true; |
255 } | 255 } |
256 | 256 |
257 // An element count of 4 was chosen because of the common pattern in Blink o
f: | 257 // An element count of 4 was chosen because of the common pattern in Blink o
f: |
258 // isect RR | 258 // isect RR |
259 // diff RR | 259 // diff RR |
260 // isect convex_poly | 260 // isect convex_poly |
261 // isect convex_poly | 261 // isect convex_poly |
262 // when drawing rounded div borders. This could probably be tuned based on a | 262 // when drawing rounded div borders. This could probably be tuned based on a |
263 // configuration's relative costs of switching RTs to generate a mask vs | 263 // configuration's relative costs of switching RTs to generate a mask vs |
264 // longer shaders. | 264 // longer shaders. |
265 if (elements.count() <= 4) { | 265 if (elements.count() <= 4) { |
266 SkVector clipToRTOffset = { SkIntToScalar(-clipDataIn->fOrigin.fX), | 266 SkVector clipToRTOffset = { SkIntToScalar(-clipDataIn->fOrigin.fX), |
267 SkIntToScalar(-clipDataIn->fOrigin.fY) }; | 267 SkIntToScalar(-clipDataIn->fOrigin.fY) }; |
268 if (elements.isEmpty() || | 268 if (elements.isEmpty() || |
269 (requiresAA && this->installClipEffects(elements, are, clipToRTOffse
t, devBounds))) { | 269 (requiresAA && this->installClipEffects(elements, are, clipToRTOffse
t, devBounds))) { |
270 SkIRect scissorSpaceIBounds(clipSpaceIBounds); | 270 SkIRect scissorSpaceIBounds(clipSpaceIBounds); |
271 scissorSpaceIBounds.offset(-clipDataIn->fOrigin); | 271 scissorSpaceIBounds.offset(-clipDataIn->fOrigin); |
272 if (NULL == devBounds || | 272 if (NULL == devBounds || |
273 !SkRect::Make(scissorSpaceIBounds).contains(*devBounds)) { | 273 !SkRect::Make(scissorSpaceIBounds).contains(*devBounds)) { |
274 fGpu->enableScissor(scissorSpaceIBounds); | 274 fGpu->enableScissor(scissorSpaceIBounds); |
275 } else { | 275 } else { |
276 fGpu->disableScissor(); | 276 fGpu->disableScissor(); |
277 } | 277 } |
278 this->setDrawStateStencil(asr); | 278 this->setGpuStencil(); |
279 return true; | 279 return true; |
280 } | 280 } |
281 } | 281 } |
282 | 282 |
283 #if GR_AA_CLIP | 283 #if GR_AA_CLIP |
284 // If MSAA is enabled we can do everything in the stencil buffer. | 284 // If MSAA is enabled we can do everything in the stencil buffer. |
285 if (0 == rt->numSamples() && requiresAA) { | 285 if (0 == rt->numSamples() && requiresAA) { |
286 GrTexture* result = NULL; | 286 GrTexture* result = NULL; |
287 | 287 |
288 if (this->useSWOnlyPath(elements)) { | 288 if (this->useSWOnlyPath(elements)) { |
(...skipping 11 matching lines...) Expand all Loading... |
300 } | 300 } |
301 | 301 |
302 if (result) { | 302 if (result) { |
303 // The mask's top left coord should be pinned to the rounded-out top
left corner of | 303 // The mask's top left coord should be pinned to the rounded-out top
left corner of |
304 // clipSpace bounds. We determine the mask's position WRT to the ren
der target here. | 304 // clipSpace bounds. We determine the mask's position WRT to the ren
der target here. |
305 SkIRect rtSpaceMaskBounds = clipSpaceIBounds; | 305 SkIRect rtSpaceMaskBounds = clipSpaceIBounds; |
306 rtSpaceMaskBounds.offset(-clipDataIn->fOrigin); | 306 rtSpaceMaskBounds.offset(-clipDataIn->fOrigin); |
307 are->set(fGpu->drawState()); | 307 are->set(fGpu->drawState()); |
308 setup_drawstate_aaclip(fGpu, result, rtSpaceMaskBounds); | 308 setup_drawstate_aaclip(fGpu, result, rtSpaceMaskBounds); |
309 fGpu->disableScissor(); | 309 fGpu->disableScissor(); |
310 this->setDrawStateStencil(asr); | 310 this->setGpuStencil(); |
311 return true; | 311 return true; |
312 } | 312 } |
313 // if alpha clip mask creation fails fall through to the non-AA code pat
hs | 313 // if alpha clip mask creation fails fall through to the non-AA code pat
hs |
314 } | 314 } |
315 #endif // GR_AA_CLIP | 315 #endif // GR_AA_CLIP |
316 | 316 |
317 // Either a hard (stencil buffer) clip was explicitly requested or an anti-a
liased clip couldn't | 317 // Either a hard (stencil buffer) clip was explicitly requested or an anti-a
liased clip couldn't |
318 // be created. In either case, free up the texture in the anti-aliased mask
cache. | 318 // be created. In either case, free up the texture in the anti-aliased mask
cache. |
319 // TODO: this may require more investigation. Ganesh performs a lot of utili
ty draws (e.g., | 319 // TODO: this may require more investigation. Ganesh performs a lot of utili
ty draws (e.g., |
320 // clears, InOrderDrawBuffer playbacks) that hit the stencil buffer path. Th
ese may be | 320 // clears, InOrderDrawBuffer playbacks) that hit the stencil buffer path. Th
ese may be |
321 // "incorrectly" clearing the AA cache. | 321 // "incorrectly" clearing the AA cache. |
322 fAACache.reset(); | 322 fAACache.reset(); |
323 | 323 |
324 // use the stencil clip if we can't represent the clip as a rectangle. | 324 // use the stencil clip if we can't represent the clip as a rectangle. |
325 SkIPoint clipSpaceToStencilSpaceOffset = -clipDataIn->fOrigin; | 325 SkIPoint clipSpaceToStencilSpaceOffset = -clipDataIn->fOrigin; |
326 this->createStencilClipMask(genID, | 326 this->createStencilClipMask(genID, |
327 initialState, | 327 initialState, |
328 elements, | 328 elements, |
329 clipSpaceIBounds, | 329 clipSpaceIBounds, |
330 clipSpaceToStencilSpaceOffset); | 330 clipSpaceToStencilSpaceOffset); |
331 | 331 |
332 // This must occur after createStencilClipMask. That function may change the
scissor. Also, it | 332 // This must occur after createStencilClipMask. That function may change the
scissor. Also, it |
333 // only guarantees that the stencil mask is correct within the bounds it was
passed, so we must | 333 // only guarantees that the stencil mask is correct within the bounds it was
passed, so we must |
334 // use both stencil and scissor test to the bounds for the final draw. | 334 // use both stencil and scissor test to the bounds for the final draw. |
335 SkIRect scissorSpaceIBounds(clipSpaceIBounds); | 335 SkIRect scissorSpaceIBounds(clipSpaceIBounds); |
336 scissorSpaceIBounds.offset(clipSpaceToStencilSpaceOffset); | 336 scissorSpaceIBounds.offset(clipSpaceToStencilSpaceOffset); |
337 fGpu->enableScissor(scissorSpaceIBounds); | 337 fGpu->enableScissor(scissorSpaceIBounds); |
338 this->setDrawStateStencil(asr); | 338 this->setGpuStencil(); |
339 return true; | 339 return true; |
340 } | 340 } |
341 | 341 |
342 #define VISUALIZE_COMPLEX_CLIP 0 | 342 #define VISUALIZE_COMPLEX_CLIP 0 |
343 | 343 |
344 #if VISUALIZE_COMPLEX_CLIP | 344 #if VISUALIZE_COMPLEX_CLIP |
345 #include "SkRandom.h" | 345 #include "SkRandom.h" |
346 SkRandom gRandom; | 346 SkRandom gRandom; |
347 #define SET_RANDOM_COLOR drawState->setColor(0xff000000 | gRandom.nextU()); | 347 #define SET_RANDOM_COLOR drawState->setColor(0xff000000 | gRandom.nextU()); |
348 #else | 348 #else |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 | 393 |
394 // TODO: Draw rrects directly here. | 394 // TODO: Draw rrects directly here. |
395 switch (element->getType()) { | 395 switch (element->getType()) { |
396 case Element::kEmpty_Type: | 396 case Element::kEmpty_Type: |
397 SkDEBUGFAIL("Should never get here with an empty element."); | 397 SkDEBUGFAIL("Should never get here with an empty element."); |
398 break; | 398 break; |
399 case Element::kRect_Type: | 399 case Element::kRect_Type: |
400 // TODO: Do rects directly to the accumulator using a aa-rect GrProc
essor that covers | 400 // TODO: Do rects directly to the accumulator using a aa-rect GrProc
essor that covers |
401 // the entire mask bounds and writes 0 outside the rect. | 401 // the entire mask bounds and writes 0 outside the rect. |
402 if (element->isAA()) { | 402 if (element->isAA()) { |
403 this->getContext()->getAARectRenderer()->fillAARect(fGpu, | 403 getContext()->getAARectRenderer()->fillAARect(fGpu, |
404 fGpu, | 404 fGpu, |
405 element->get
Rect(), | 405 element->getRect()
, |
406 SkMatrix::I(
), | 406 SkMatrix::I(), |
407 element->get
Rect()); | 407 element->getRect()
); |
408 } else { | 408 } else { |
409 fGpu->drawSimpleRect(element->getRect()); | 409 fGpu->drawSimpleRect(element->getRect()); |
410 } | 410 } |
411 return true; | 411 return true; |
412 default: { | 412 default: { |
413 SkPath path; | 413 SkPath path; |
414 element->asPath(&path); | 414 element->asPath(&path); |
415 path.setIsVolatile(true); | 415 path.setIsVolatile(true); |
416 if (path.isInverseFillType()) { | 416 if (path.isInverseFillType()) { |
417 path.toggleInverseFillType(); | 417 path.toggleInverseFillType(); |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 GrRenderTarget* rt = drawState->getRenderTarget(); | 700 GrRenderTarget* rt = drawState->getRenderTarget(); |
701 SkASSERT(rt); | 701 SkASSERT(rt); |
702 | 702 |
703 // TODO: dynamically attach a SB when needed. | 703 // TODO: dynamically attach a SB when needed. |
704 GrStencilBuffer* stencilBuffer = rt->getStencilBuffer(); | 704 GrStencilBuffer* stencilBuffer = rt->getStencilBuffer(); |
705 if (NULL == stencilBuffer) { | 705 if (NULL == stencilBuffer) { |
706 return false; | 706 return false; |
707 } | 707 } |
708 | 708 |
709 if (stencilBuffer->mustRenderClip(elementsGenID, clipSpaceIBounds, clipSpace
ToStencilOffset)) { | 709 if (stencilBuffer->mustRenderClip(elementsGenID, clipSpaceIBounds, clipSpace
ToStencilOffset)) { |
| 710 |
710 stencilBuffer->setLastClip(elementsGenID, clipSpaceIBounds, clipSpaceToS
tencilOffset); | 711 stencilBuffer->setLastClip(elementsGenID, clipSpaceIBounds, clipSpaceToS
tencilOffset); |
711 | 712 |
712 // Set the matrix so that rendered clip elements are transformed from cl
ip to stencil space. | 713 // Set the matrix so that rendered clip elements are transformed from cl
ip to stencil space. |
713 SkVector translate = { | 714 SkVector translate = { |
714 SkIntToScalar(clipSpaceToStencilOffset.fX), | 715 SkIntToScalar(clipSpaceToStencilOffset.fX), |
715 SkIntToScalar(clipSpaceToStencilOffset.fY) | 716 SkIntToScalar(clipSpaceToStencilOffset.fY) |
716 }; | 717 }; |
717 SkMatrix matrix; | 718 SkMatrix matrix; |
718 matrix.setTranslate(translate); | 719 matrix.setTranslate(translate); |
719 GrDrawTarget::AutoGeometryAndStatePush agasp(fGpu, GrDrawTarget::kReset_
ASRInit, &matrix); | 720 GrDrawTarget::AutoGeometryAndStatePush agasp(fGpu, GrDrawTarget::kReset_
ASRInit, &matrix); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 kKeep_StencilOp, | 896 kKeep_StencilOp, |
896 kKeep_StencilOp, | 897 kKeep_StencilOp, |
897 kAlwaysIfInClip_StencilFunc, | 898 kAlwaysIfInClip_StencilFunc, |
898 0x0000, | 899 0x0000, |
899 0x0000, | 900 0x0000, |
900 0x0000); | 901 0x0000); |
901 return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings); | 902 return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings); |
902 } | 903 } |
903 } | 904 } |
904 | 905 |
905 void GrClipMaskManager::setDrawStateStencil(GrDrawState::AutoRestoreStencil* ars
) { | 906 void GrClipMaskManager::setGpuStencil() { |
906 // We make two copies of the StencilSettings here (except in the early | 907 // We make two copies of the StencilSettings here (except in the early |
907 // exit scenario. One copy from draw state to the stack var. Then another | 908 // exit scenario. One copy from draw state to the stack var. Then another |
908 // from the stack var to the gpu. We could make this class hold a ptr to | 909 // from the stack var to the gpu. We could make this class hold a ptr to |
909 // GrGpu's fStencilSettings and eliminate the stack copy here. | 910 // GrGpu's fStencilSettings and eliminate the stack copy here. |
910 | 911 |
911 const GrDrawState& drawState = fGpu->getDrawState(); | 912 const GrDrawState& drawState = fGpu->getDrawState(); |
912 | 913 |
913 // use stencil for clipping if clipping is enabled and the clip | 914 // use stencil for clipping if clipping is enabled and the clip |
914 // has been written into the stencil. | 915 // has been written into the stencil. |
915 GrClipMaskManager::StencilClipMode clipMode; | 916 GrClipMaskManager::StencilClipMode clipMode; |
916 if (this->isClipInStencil() && drawState.isClipState()) { | 917 if (this->isClipInStencil() && drawState.isClipState()) { |
917 clipMode = GrClipMaskManager::kRespectClip_StencilClipMode; | 918 clipMode = GrClipMaskManager::kRespectClip_StencilClipMode; |
918 // We can't be modifying the clip and respecting it at the same time. | 919 // We can't be modifying the clip and respecting it at the same time. |
919 SkASSERT(!drawState.isStateFlagEnabled( | 920 SkASSERT(!drawState.isStateFlagEnabled( |
920 GrGpu::kModifyStencilClip_StateBit)); | 921 GrGpu::kModifyStencilClip_StateBit)); |
921 } else if (drawState.isStateFlagEnabled( | 922 } else if (drawState.isStateFlagEnabled( |
922 GrGpu::kModifyStencilClip_StateBit)) { | 923 GrGpu::kModifyStencilClip_StateBit)) { |
923 clipMode = GrClipMaskManager::kModifyClip_StencilClipMode; | 924 clipMode = GrClipMaskManager::kModifyClip_StencilClipMode; |
924 } else { | 925 } else { |
925 clipMode = GrClipMaskManager::kIgnoreClip_StencilClipMode; | 926 clipMode = GrClipMaskManager::kIgnoreClip_StencilClipMode; |
926 } | 927 } |
927 | 928 |
928 GrStencilSettings settings; | 929 GrStencilSettings settings; |
929 // The GrGpu client may not be using the stencil buffer but we may need to | 930 // The GrGpu client may not be using the stencil buffer but we may need to |
930 // enable it in order to respect a stencil clip. | 931 // enable it in order to respect a stencil clip. |
931 if (drawState.getStencil().isDisabled()) { | 932 if (drawState.getStencil().isDisabled()) { |
932 if (GrClipMaskManager::kRespectClip_StencilClipMode == clipMode) { | 933 if (GrClipMaskManager::kRespectClip_StencilClipMode == clipMode) { |
933 settings = basic_apply_stencil_clip_settings(); | 934 settings = basic_apply_stencil_clip_settings(); |
934 } else { | 935 } else { |
| 936 fGpu->disableStencil(); |
935 return; | 937 return; |
936 } | 938 } |
937 } else { | 939 } else { |
938 settings = drawState.getStencil(); | 940 settings = drawState.getStencil(); |
939 } | 941 } |
940 | 942 |
941 // TODO: dynamically attach a stencil buffer | 943 // TODO: dynamically attach a stencil buffer |
942 int stencilBits = 0; | 944 int stencilBits = 0; |
943 GrStencilBuffer* stencilBuffer = drawState.getRenderTarget()->getStencilBuff
er(); | 945 GrStencilBuffer* stencilBuffer = |
| 946 drawState.getRenderTarget()->getStencilBuffer(); |
944 if (stencilBuffer) { | 947 if (stencilBuffer) { |
945 stencilBits = stencilBuffer->bits(); | 948 stencilBits = stencilBuffer->bits(); |
946 } | 949 } |
947 | 950 |
948 SkASSERT(fGpu->caps()->stencilWrapOpsSupport() || !settings.usesWrapOp()); | 951 SkASSERT(fGpu->caps()->stencilWrapOpsSupport() || !settings.usesWrapOp()); |
949 SkASSERT(fGpu->caps()->twoSidedStencilSupport() || !settings.isTwoSided()); | 952 SkASSERT(fGpu->caps()->twoSidedStencilSupport() || !settings.isTwoSided()); |
950 this->adjustStencilParams(&settings, clipMode, stencilBits); | 953 this->adjustStencilParams(&settings, clipMode, stencilBits); |
951 ars->set(fGpu->drawState()); | 954 fGpu->setStencilSettings(settings); |
952 fGpu->drawState()->setStencil(settings); | |
953 } | 955 } |
954 | 956 |
955 void GrClipMaskManager::adjustStencilParams(GrStencilSettings* settings, | 957 void GrClipMaskManager::adjustStencilParams(GrStencilSettings* settings, |
956 StencilClipMode mode, | 958 StencilClipMode mode, |
957 int stencilBitCnt) { | 959 int stencilBitCnt) { |
958 SkASSERT(stencilBitCnt > 0); | 960 SkASSERT(stencilBitCnt > 0); |
959 | 961 |
960 if (kModifyClip_StencilClipMode == mode) { | 962 if (kModifyClip_StencilClipMode == mode) { |
961 // We assume that this clip manager itself is drawing to the GrGpu and | 963 // We assume that this clip manager itself is drawing to the GrGpu and |
962 // has already setup the correct values. | 964 // has already setup the correct values. |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 | 1136 |
1135 // TODO: dynamically attach a stencil buffer | 1137 // TODO: dynamically attach a stencil buffer |
1136 int stencilBits = 0; | 1138 int stencilBits = 0; |
1137 GrStencilBuffer* stencilBuffer = | 1139 GrStencilBuffer* stencilBuffer = |
1138 drawState.getRenderTarget()->getStencilBuffer(); | 1140 drawState.getRenderTarget()->getStencilBuffer(); |
1139 if (stencilBuffer) { | 1141 if (stencilBuffer) { |
1140 stencilBits = stencilBuffer->bits(); | 1142 stencilBits = stencilBuffer->bits(); |
1141 this->adjustStencilParams(settings, clipMode, stencilBits); | 1143 this->adjustStencilParams(settings, clipMode, stencilBits); |
1142 } | 1144 } |
1143 } | 1145 } |
OLD | NEW |