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