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 "GrDrawingManager.h" | 10 #include "GrDrawingManager.h" |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 // isect convex_poly | 441 // isect convex_poly |
442 // isect convex_poly | 442 // isect convex_poly |
443 // when drawing rounded div borders. This could probably be tuned based on a | 443 // when drawing rounded div borders. This could probably be tuned based on a |
444 // configuration's relative costs of switching RTs to generate a mask vs | 444 // configuration's relative costs of switching RTs to generate a mask vs |
445 // longer shaders. | 445 // longer shaders. |
446 if (elements.count() <= kMaxAnalyticElements) { | 446 if (elements.count() <= kMaxAnalyticElements) { |
447 SkVector clipToRTOffset = { SkIntToScalar(-clip.origin().fX), | 447 SkVector clipToRTOffset = { SkIntToScalar(-clip.origin().fX), |
448 SkIntToScalar(-clip.origin().fY) }; | 448 SkIntToScalar(-clip.origin().fY) }; |
449 // When there are multiple samples we want to do per-sample clipping, no
t compute a | 449 // When there are multiple samples we want to do per-sample clipping, no
t compute a |
450 // fractional pixel coverage. | 450 // fractional pixel coverage. |
451 bool disallowAnalyticAA = rt->isUnifiedMultisampled() || pipelineBuilder
.hasMixedSamples(); | 451 bool disallowAnalyticAA = rt->isStencilBufferMultisampled(); |
| 452 if (disallowAnalyticAA && !rt->numColorSamples()) { |
| 453 // With a single color sample, any coverage info is lost from color
once it hits the |
| 454 // color buffer anyway, so we may as well use coverage AA if nothing
else in the pipe |
| 455 // is multisampled. |
| 456 disallowAnalyticAA = pipelineBuilder.isHWAntialias() || |
| 457 !pipelineBuilder.getStencil().isDisabled(); |
| 458 } |
452 const GrFragmentProcessor* clipFP = nullptr; | 459 const GrFragmentProcessor* clipFP = nullptr; |
453 if (elements.isEmpty() || | 460 if (elements.isEmpty() || |
454 (requiresAA && | 461 (requiresAA && |
455 this->getAnalyticClipProcessor(elements, disallowAnalyticAA, clipTo
RTOffset, devBounds, | 462 this->getAnalyticClipProcessor(elements, disallowAnalyticAA, clipTo
RTOffset, devBounds, |
456 &clipFP))) { | 463 &clipFP))) { |
457 SkIRect scissorSpaceIBounds(clipSpaceIBounds); | 464 SkIRect scissorSpaceIBounds(clipSpaceIBounds); |
458 scissorSpaceIBounds.offset(-clip.origin()); | 465 scissorSpaceIBounds.offset(-clip.origin()); |
459 if (nullptr == devBounds || | 466 if (nullptr == devBounds || |
460 !SkRect::Make(scissorSpaceIBounds).contains(*devBounds)) { | 467 !SkRect::Make(scissorSpaceIBounds).contains(*devBounds)) { |
461 out->fScissorState.set(scissorSpaceIBounds); | 468 out->fScissorState.set(scissorSpaceIBounds); |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1146 | 1153 |
1147 //////////////////////////////////////////////////////////////////////////////// | 1154 //////////////////////////////////////////////////////////////////////////////// |
1148 | 1155 |
1149 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, | 1156 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, |
1150 GrStencilSettings* settings) { | 1157 GrStencilSettings* settings) { |
1151 if (stencilAttachment) { | 1158 if (stencilAttachment) { |
1152 int stencilBits = stencilAttachment->bits(); | 1159 int stencilBits = stencilAttachment->bits(); |
1153 this->adjustStencilParams(settings, fClipMode, stencilBits); | 1160 this->adjustStencilParams(settings, fClipMode, stencilBits); |
1154 } | 1161 } |
1155 } | 1162 } |
OLD | NEW |