| 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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 if (nullptr == devBounds || | 361 if (nullptr == devBounds || |
| 362 !SkRect::Make(scissorSpaceIBounds).contains(*devBounds)) { | 362 !SkRect::Make(scissorSpaceIBounds).contains(*devBounds)) { |
| 363 out->fScissorState.set(scissorSpaceIBounds); | 363 out->fScissorState.set(scissorSpaceIBounds); |
| 364 } | 364 } |
| 365 this->setPipelineBuilderStencil(pipelineBuilder, ars); | 365 this->setPipelineBuilderStencil(pipelineBuilder, ars); |
| 366 out->fClipCoverageFP.reset(clipFP); | 366 out->fClipCoverageFP.reset(clipFP); |
| 367 return true; | 367 return true; |
| 368 } | 368 } |
| 369 } | 369 } |
| 370 | 370 |
| 371 SkASSERT(!pipelineBuilder.isHWAntialias() || rt->isStencilBufferMultisampled
()); | 371 // If MSAA is enabled we can do everything in the stencil buffer. |
| 372 | 372 if (0 == rt->numStencilSamples() && requiresAA) { |
| 373 bool hasHWAntialias = pipelineBuilder.isHWAntialias(); | |
| 374 | |
| 375 if (rt->isStencilBufferMultisampled() && !hasHWAntialias) { | |
| 376 if (!this->caps()->multisampleDisableSupport()) { | |
| 377 hasHWAntialias = true; // This will be on regardless, it's impossibl
e to turn it off. | |
| 378 } else if (this->caps()->programmableSampleLocationsSupport()) { | |
| 379 // Enable HW antialias, but leave the draw non-antialiased by co-cen
tering the samples. | |
| 380 out->fIsCoCenteredMultisampledDraw = true; | |
| 381 hasHWAntialias = true; | |
| 382 } | |
| 383 } | |
| 384 | |
| 385 // If we have HW antialias, or don't need AA, we can do everything in the st
encil buffer. | |
| 386 if (!hasHWAntialias && requiresAA) { | |
| 387 SkAutoTUnref<GrTexture> result; | 373 SkAutoTUnref<GrTexture> result; |
| 388 | 374 |
| 389 // The top-left of the mask corresponds to the top-left corner of the bo
unds. | 375 // The top-left of the mask corresponds to the top-left corner of the bo
unds. |
| 390 SkVector clipToMaskOffset = { | 376 SkVector clipToMaskOffset = { |
| 391 SkIntToScalar(-clipSpaceIBounds.fLeft), | 377 SkIntToScalar(-clipSpaceIBounds.fLeft), |
| 392 SkIntToScalar(-clipSpaceIBounds.fTop) | 378 SkIntToScalar(-clipSpaceIBounds.fTop) |
| 393 }; | 379 }; |
| 394 | 380 |
| 395 if (this->useSWOnlyPath(pipelineBuilder, rt, clipToMaskOffset, elements)
) { | 381 if (this->useSWOnlyPath(pipelineBuilder, rt, clipToMaskOffset, elements)
) { |
| 396 // The clip geometry is complex enough that it will be more efficien
t to create it | 382 // The clip geometry is complex enough that it will be more efficien
t to create it |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 | 1096 |
| 1111 //////////////////////////////////////////////////////////////////////////////// | 1097 //////////////////////////////////////////////////////////////////////////////// |
| 1112 | 1098 |
| 1113 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, | 1099 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, |
| 1114 GrStencilSettings* settings) { | 1100 GrStencilSettings* settings) { |
| 1115 if (stencilAttachment) { | 1101 if (stencilAttachment) { |
| 1116 int stencilBits = stencilAttachment->bits(); | 1102 int stencilBits = stencilAttachment->bits(); |
| 1117 this->adjustStencilParams(settings, fClipMode, stencilBits); | 1103 this->adjustStencilParams(settings, fClipMode, stencilBits); |
| 1118 } | 1104 } |
| 1119 } | 1105 } |
| OLD | NEW |