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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 failed = true; | 158 failed = true; |
159 break; | 159 break; |
160 } | 160 } |
161 if (failed) { | 161 if (failed) { |
162 break; | 162 break; |
163 } | 163 } |
164 | 164 |
165 if (!skip) { | 165 if (!skip) { |
166 GrPrimitiveEdgeType edgeType; | 166 GrPrimitiveEdgeType edgeType; |
167 if (iter.get()->isAA()) { | 167 if (iter.get()->isAA()) { |
168 if (rt->isMultisampled()) { | 168 if (rt->isUnifiedMultisampled()) { |
169 // Coverage based AA clips don't place nicely with MSAA. | 169 // Coverage based AA clips don't place nicely with MSAA. |
170 failed = true; | 170 failed = true; |
171 break; | 171 break; |
172 } | 172 } |
173 edgeType = | 173 edgeType = |
174 invert ? kInverseFillAA_GrProcessorEdgeType : kFillAA_Gr
ProcessorEdgeType; | 174 invert ? kInverseFillAA_GrProcessorEdgeType : kFillAA_Gr
ProcessorEdgeType; |
175 } else { | 175 } else { |
176 edgeType = | 176 edgeType = |
177 invert ? kInverseFillBW_GrProcessorEdgeType : kFillBW_GrProcessorEdgeType; | 177 invert ? kInverseFillBW_GrProcessorEdgeType : kFillBW_GrProcessorEdgeType; |
178 } | 178 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 if (NULL == devBounds || | 299 if (NULL == 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->numSamples() && requiresAA) { | 309 if (0 == rt->numColorSamples() && requiresAA) { |
310 GrTexture* result = NULL; | 310 GrTexture* result = NULL; |
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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 for (GrReducedClip::ElementList::Iter iter(elements.headIter()); iter.ge
t(); iter.next()) { | 743 for (GrReducedClip::ElementList::Iter iter(elements.headIter()); iter.ge
t(); iter.next()) { |
744 const Element* element = iter.get(); | 744 const Element* element = iter.get(); |
745 | 745 |
746 GrPipelineBuilder pipelineBuilder; | 746 GrPipelineBuilder pipelineBuilder; |
747 pipelineBuilder.setClip(clip); | 747 pipelineBuilder.setClip(clip); |
748 pipelineBuilder.setRenderTarget(rt); | 748 pipelineBuilder.setRenderTarget(rt); |
749 | 749 |
750 pipelineBuilder.setDisableColorXPFactory(); | 750 pipelineBuilder.setDisableColorXPFactory(); |
751 | 751 |
752 // if the target is MSAA then we want MSAA enabled when the clip is
soft | 752 // if the target is MSAA then we want MSAA enabled when the clip is
soft |
753 if (rt->isMultisampled()) { | 753 if (rt->isUnifiedMultisampled()) { |
754 pipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_Flag, e
lement->isAA()); | 754 pipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_Flag, e
lement->isAA()); |
755 } | 755 } |
756 | 756 |
757 bool fillInverted = false; | 757 bool fillInverted = false; |
758 // enabled at bottom of loop | 758 // enabled at bottom of loop |
759 fClipMode = kIgnoreClip_StencilClipMode; | 759 fClipMode = kIgnoreClip_StencilClipMode; |
760 | 760 |
761 // This will be used to determine whether the clip shape can be rend
ered into the | 761 // This will be used to determine whether the clip shape can be rend
ered into the |
762 // stencil with arbitrary stencil settings. | 762 // stencil with arbitrary stencil settings. |
763 GrPathRenderer::StencilSupport stencilSupport; | 763 GrPathRenderer::StencilSupport stencilSupport; |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 fAACache.purgeResources(); | 1119 fAACache.purgeResources(); |
1120 } | 1120 } |
1121 | 1121 |
1122 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, | 1122 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, |
1123 GrStencilSettings* settings) { | 1123 GrStencilSettings* settings) { |
1124 if (stencilAttachment) { | 1124 if (stencilAttachment) { |
1125 int stencilBits = stencilAttachment->bits(); | 1125 int stencilBits = stencilAttachment->bits(); |
1126 this->adjustStencilParams(settings, fClipMode, stencilBits); | 1126 this->adjustStencilParams(settings, fClipMode, stencilBits); |
1127 } | 1127 } |
1128 } | 1128 } |
OLD | NEW |