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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 if (nullptr == devBounds || | 299 if (nullptr == devBounds || |
300 !SkRect::Make(scissorSpaceIBounds).contains(*devBounds)) { | 300 !SkRect::Make(scissorSpaceIBounds).contains(*devBounds)) { |
301 scissorState->set(scissorSpaceIBounds); | 301 scissorState->set(scissorSpaceIBounds); |
302 } | 302 } |
303 this->setPipelineBuilderStencil(pipelineBuilder, ars); | 303 this->setPipelineBuilderStencil(pipelineBuilder, ars); |
304 return true; | 304 return true; |
305 } | 305 } |
306 } | 306 } |
307 | 307 |
308 // If MSAA is enabled we can do everything in the stencil buffer. | 308 // If MSAA is enabled we can do everything in the stencil buffer. |
309 if (0 == rt->numColorSamples() && requiresAA) { | 309 if (0 == rt->numStencilSamples() && requiresAA) { |
310 GrTexture* result = nullptr; | 310 GrTexture* result = nullptr; |
311 | 311 |
312 // The top-left of the mask corresponds to the top-left corner of the bo
unds. | 312 // The top-left of the mask corresponds to the top-left corner of the bo
unds. |
313 SkVector clipToMaskOffset = { | 313 SkVector clipToMaskOffset = { |
314 SkIntToScalar(-clipSpaceIBounds.fLeft), | 314 SkIntToScalar(-clipSpaceIBounds.fLeft), |
315 SkIntToScalar(-clipSpaceIBounds.fTop) | 315 SkIntToScalar(-clipSpaceIBounds.fTop) |
316 }; | 316 }; |
317 | 317 |
318 if (this->useSWOnlyPath(pipelineBuilder, clipToMaskOffset, elements)) { | 318 if (this->useSWOnlyPath(pipelineBuilder, clipToMaskOffset, elements)) { |
319 // The clip geometry is complex enough that it will be more efficien
t to create it | 319 // The clip geometry is complex enough that it will be more efficien
t to create it |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 for (GrReducedClip::ElementList::Iter iter(elements.headIter()); iter.ge
t(); iter.next()) { | 750 for (GrReducedClip::ElementList::Iter iter(elements.headIter()); iter.ge
t(); iter.next()) { |
751 const Element* element = iter.get(); | 751 const Element* element = iter.get(); |
752 | 752 |
753 GrPipelineBuilder pipelineBuilder; | 753 GrPipelineBuilder pipelineBuilder; |
754 pipelineBuilder.setClip(clip); | 754 pipelineBuilder.setClip(clip); |
755 pipelineBuilder.setRenderTarget(rt); | 755 pipelineBuilder.setRenderTarget(rt); |
756 | 756 |
757 pipelineBuilder.setDisableColorXPFactory(); | 757 pipelineBuilder.setDisableColorXPFactory(); |
758 | 758 |
759 // if the target is MSAA then we want MSAA enabled when the clip is
soft | 759 // if the target is MSAA then we want MSAA enabled when the clip is
soft |
760 if (rt->isUnifiedMultisampled()) { | 760 if (rt->isStencilBufferMultisampled()) { |
761 pipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_Flag, e
lement->isAA()); | 761 pipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_Flag, e
lement->isAA()); |
762 } | 762 } |
763 | 763 |
764 bool fillInverted = false; | 764 bool fillInverted = false; |
765 // enabled at bottom of loop | 765 // enabled at bottom of loop |
766 fClipMode = kIgnoreClip_StencilClipMode; | 766 fClipMode = kIgnoreClip_StencilClipMode; |
767 | 767 |
768 // This will be used to determine whether the clip shape can be rend
ered into the | 768 // This will be used to determine whether the clip shape can be rend
ered into the |
769 // stencil with arbitrary stencil settings. | 769 // stencil with arbitrary stencil settings. |
770 GrPathRenderer::StencilSupport stencilSupport; | 770 GrPathRenderer::StencilSupport stencilSupport; |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 fAACache.purgeResources(); | 1149 fAACache.purgeResources(); |
1150 } | 1150 } |
1151 | 1151 |
1152 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, | 1152 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, |
1153 GrStencilSettings* settings) { | 1153 GrStencilSettings* settings) { |
1154 if (stencilAttachment) { | 1154 if (stencilAttachment) { |
1155 int stencilBits = stencilAttachment->bits(); | 1155 int stencilBits = stencilAttachment->bits(); |
1156 this->adjustStencilParams(settings, fClipMode, stencilBits); | 1156 this->adjustStencilParams(settings, fClipMode, stencilBits); |
1157 } | 1157 } |
1158 } | 1158 } |
OLD | NEW |