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 // If MSAA is enabled we can do everything in the stencil buffer. | 371 SkASSERT(!pipelineBuilder.isHWAntialias() || rt->isStencilBufferMultisampled
()); |
372 if (0 == rt->numStencilSamples() && requiresAA) { | 372 |
| 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) { |
373 SkAutoTUnref<GrTexture> result; | 387 SkAutoTUnref<GrTexture> result; |
374 | 388 |
375 // The top-left of the mask corresponds to the top-left corner of the bo
unds. | 389 // The top-left of the mask corresponds to the top-left corner of the bo
unds. |
376 SkVector clipToMaskOffset = { | 390 SkVector clipToMaskOffset = { |
377 SkIntToScalar(-clipSpaceIBounds.fLeft), | 391 SkIntToScalar(-clipSpaceIBounds.fLeft), |
378 SkIntToScalar(-clipSpaceIBounds.fTop) | 392 SkIntToScalar(-clipSpaceIBounds.fTop) |
379 }; | 393 }; |
380 | 394 |
381 if (this->useSWOnlyPath(pipelineBuilder, rt, clipToMaskOffset, elements)
) { | 395 if (this->useSWOnlyPath(pipelineBuilder, rt, clipToMaskOffset, elements)
) { |
382 // The clip geometry is complex enough that it will be more efficien
t to create it | 396 // 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... |
1096 | 1110 |
1097 //////////////////////////////////////////////////////////////////////////////// | 1111 //////////////////////////////////////////////////////////////////////////////// |
1098 | 1112 |
1099 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, | 1113 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, |
1100 GrStencilSettings* settings) { | 1114 GrStencilSettings* settings) { |
1101 if (stencilAttachment) { | 1115 if (stencilAttachment) { |
1102 int stencilBits = stencilAttachment->bits(); | 1116 int stencilBits = stencilAttachment->bits(); |
1103 this->adjustStencilParams(settings, fClipMode, stencilBits); | 1117 this->adjustStencilParams(settings, fClipMode, stencilBits); |
1104 } | 1118 } |
1105 } | 1119 } |
OLD | NEW |