OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrDefaultPathRenderer.h" | 8 #include "GrDefaultPathRenderer.h" |
9 | 9 |
10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 //////////////////////////////////////////////////////////////////////////////// | 32 //////////////////////////////////////////////////////////////////////////////// |
33 // Helpers for drawPath | 33 // Helpers for drawPath |
34 | 34 |
35 #define STENCIL_OFF 0 // Always disable stencil (even when needed) | 35 #define STENCIL_OFF 0 // Always disable stencil (even when needed) |
36 | 36 |
37 static inline bool single_pass_shape(const GrShape& shape) { | 37 static inline bool single_pass_shape(const GrShape& shape) { |
38 #if STENCIL_OFF | 38 #if STENCIL_OFF |
39 return true; | 39 return true; |
40 #else | 40 #else |
41 if (!shape.style().couldBeHairline() && !shape.inverseFilled()) { | 41 // Inverse fill is always two pass. |
| 42 if (shape.inverseFilled()) { |
| 43 return false; |
| 44 } |
| 45 // This path renderer only accepts simple fill paths or stroke paths that ar
e either hairline |
| 46 // or have a stroke width small enough to treat as hairline. Hairline paths
are always single |
| 47 // pass. Filled paths are single pass if they're convex. |
| 48 if (shape.style().isSimpleFill()) { |
42 return shape.knownToBeConvex(); | 49 return shape.knownToBeConvex(); |
43 } | 50 } |
44 return false; | 51 return true; |
45 #endif | 52 #endif |
46 } | 53 } |
47 | 54 |
48 GrPathRenderer::StencilSupport | 55 GrPathRenderer::StencilSupport |
49 GrDefaultPathRenderer::onGetStencilSupport(const GrShape& shape) const { | 56 GrDefaultPathRenderer::onGetStencilSupport(const GrShape& shape) const { |
50 if (single_pass_shape(shape)) { | 57 if (single_pass_shape(shape)) { |
51 return GrPathRenderer::kNoRestriction_StencilSupport; | 58 return GrPathRenderer::kNoRestriction_StencilSupport; |
52 } else { | 59 } else { |
53 return GrPathRenderer::kStencilOnly_StencilSupport; | 60 return GrPathRenderer::kStencilOnly_StencilSupport; |
54 } | 61 } |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 geometry.fColor = color; | 658 geometry.fColor = color; |
652 geometry.fPath = path; | 659 geometry.fPath = path; |
653 geometry.fTolerance = srcSpaceTol; | 660 geometry.fTolerance = srcSpaceTol; |
654 | 661 |
655 viewMatrix.mapRect(&bounds); | 662 viewMatrix.mapRect(&bounds); |
656 uint8_t coverage = GrRandomCoverage(random); | 663 uint8_t coverage = GrRandomCoverage(random); |
657 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); | 664 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); |
658 } | 665 } |
659 | 666 |
660 #endif | 667 #endif |
OLD | NEW |