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 "GrCaps.h" | 9 #include "GrCaps.h" |
10 #include "GrDrawContext.h" | 10 #include "GrDrawContext.h" |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 // (as opposed to canvas) coordinates | 710 // (as opposed to canvas) coordinates |
711 bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt, | 711 bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt, |
712 int32_t elementsGenID, | 712 int32_t elementsGenID, |
713 GrReducedClip::InitialState initia
lState, | 713 GrReducedClip::InitialState initia
lState, |
714 const GrReducedClip::ElementList&
elements, | 714 const GrReducedClip::ElementList&
elements, |
715 const SkIRect& clipSpaceIBounds, | 715 const SkIRect& clipSpaceIBounds, |
716 const SkIPoint& clipSpaceToStencil
Offset) { | 716 const SkIPoint& clipSpaceToStencil
Offset) { |
717 SkASSERT(kNone_ClipMaskType == fCurrClipMaskType); | 717 SkASSERT(kNone_ClipMaskType == fCurrClipMaskType); |
718 SkASSERT(rt); | 718 SkASSERT(rt); |
719 | 719 |
720 GrStencilAttachment* stencilAttachment = rt->renderTargetPriv().attachStenci
lAttachment(); | 720 GrStencilAttachment* stencilAttachment = |
| 721 fDrawTarget->cmmAccess().resourceProvider()->attachStencilAttachment(rt)
; |
721 if (nullptr == stencilAttachment) { | 722 if (nullptr == stencilAttachment) { |
722 return false; | 723 return false; |
723 } | 724 } |
724 | 725 |
725 if (stencilAttachment->mustRenderClip(elementsGenID, clipSpaceIBounds, clipS
paceToStencilOffset)) { | 726 if (stencilAttachment->mustRenderClip(elementsGenID, clipSpaceIBounds, clipS
paceToStencilOffset)) { |
726 stencilAttachment->setLastClip(elementsGenID, clipSpaceIBounds, clipSpac
eToStencilOffset); | 727 stencilAttachment->setLastClip(elementsGenID, clipSpaceIBounds, clipSpac
eToStencilOffset); |
727 // Set the matrix so that rendered clip elements are transformed from cl
ip to stencil space. | 728 // Set the matrix so that rendered clip elements are transformed from cl
ip to stencil space. |
728 SkVector translate = { | 729 SkVector translate = { |
729 SkIntToScalar(clipSpaceToStencilOffset.fX), | 730 SkIntToScalar(clipSpaceToStencilOffset.fX), |
730 SkIntToScalar(clipSpaceToStencilOffset.fY) | 731 SkIntToScalar(clipSpaceToStencilOffset.fY) |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 settings = basic_apply_stencil_clip_settings(); | 971 settings = basic_apply_stencil_clip_settings(); |
971 } else { | 972 } else { |
972 return; | 973 return; |
973 } | 974 } |
974 } else { | 975 } else { |
975 settings = pipelineBuilder.getStencil(); | 976 settings = pipelineBuilder.getStencil(); |
976 } | 977 } |
977 | 978 |
978 int stencilBits = 0; | 979 int stencilBits = 0; |
979 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); | 980 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); |
980 GrStencilAttachment* stencilAttachment = rt->renderTargetPriv().attachStenci
lAttachment(); | 981 GrStencilAttachment* stencilAttachment = |
| 982 fDrawTarget->cmmAccess().resourceProvider()->attachStencilAttachment(rt)
; |
981 if (stencilAttachment) { | 983 if (stencilAttachment) { |
982 stencilBits = stencilAttachment->bits(); | 984 stencilBits = stencilAttachment->bits(); |
983 } | 985 } |
984 | 986 |
985 SkASSERT(fDrawTarget->caps()->stencilWrapOpsSupport() || !settings.usesWrapO
p()); | 987 SkASSERT(fDrawTarget->caps()->stencilWrapOpsSupport() || !settings.usesWrapO
p()); |
986 SkASSERT(fDrawTarget->caps()->twoSidedStencilSupport() || !settings.isTwoSid
ed()); | 988 SkASSERT(fDrawTarget->caps()->twoSidedStencilSupport() || !settings.isTwoSid
ed()); |
987 this->adjustStencilParams(&settings, fClipMode, stencilBits); | 989 this->adjustStencilParams(&settings, fClipMode, stencilBits); |
988 ars->set(&pipelineBuilder); | 990 ars->set(&pipelineBuilder); |
989 ars->setStencil(settings); | 991 ars->setStencil(settings); |
990 } | 992 } |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 fAACache.purgeResources(); | 1149 fAACache.purgeResources(); |
1148 } | 1150 } |
1149 | 1151 |
1150 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, | 1152 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, |
1151 GrStencilSettings* settings) { | 1153 GrStencilSettings* settings) { |
1152 if (stencilAttachment) { | 1154 if (stencilAttachment) { |
1153 int stencilBits = stencilAttachment->bits(); | 1155 int stencilBits = stencilAttachment->bits(); |
1154 this->adjustStencilParams(settings, fClipMode, stencilBits); | 1156 this->adjustStencilParams(settings, fClipMode, stencilBits); |
1155 } | 1157 } |
1156 } | 1158 } |
OLD | NEW |