OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "GrStencilAndCoverPathRenderer.h" | 10 #include "GrStencilAndCoverPathRenderer.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 SkAutoTUnref<GrPath> p(fGpu->createPath(path)); | 71 SkAutoTUnref<GrPath> p(fGpu->createPath(path)); |
72 | 72 |
73 SkPath::FillType nonInvertedFill = SkPath::ConvertToNonInverseFillType(path.
getFillType()); | 73 SkPath::FillType nonInvertedFill = SkPath::ConvertToNonInverseFillType(path.
getFillType()); |
74 target->stencilPath(p, stroke, nonInvertedFill); | 74 target->stencilPath(p, stroke, nonInvertedFill); |
75 | 75 |
76 // TODO: Use built in cover operation rather than a rect draw. This will req
uire making our | 76 // TODO: Use built in cover operation rather than a rect draw. This will req
uire making our |
77 // fragment shaders be able to eat varyings generated by a matrix. | 77 // fragment shaders be able to eat varyings generated by a matrix. |
78 | 78 |
79 // fill the path, zero out the stencil | 79 // fill the path, zero out the stencil |
80 GrRect bounds = p->getBounds(); | 80 SkRect bounds = p->getBounds(); |
81 SkScalar bloat = drawState->getViewMatrix().getMaxStretch() * SK_ScalarHalf; | 81 SkScalar bloat = drawState->getViewMatrix().getMaxStretch() * SK_ScalarHalf; |
82 GrDrawState::AutoViewMatrixRestore avmr; | 82 GrDrawState::AutoViewMatrixRestore avmr; |
83 | 83 |
84 if (nonInvertedFill == path.getFillType()) { | 84 if (nonInvertedFill == path.getFillType()) { |
85 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, | 85 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, |
86 kZero_StencilOp, | 86 kZero_StencilOp, |
87 kZero_StencilOp, | 87 kZero_StencilOp, |
88 kNotEqual_StencilFunc, | 88 kNotEqual_StencilFunc, |
89 0xffff, | 89 0xffff, |
90 0x0000, | 90 0x0000, |
(...skipping 23 matching lines...) Expand all Loading... |
114 avmr.setIdentity(drawState); | 114 avmr.setIdentity(drawState); |
115 bloat = 0; | 115 bloat = 0; |
116 } | 116 } |
117 *drawState->stencil() = kInvertedStencilPass; | 117 *drawState->stencil() = kInvertedStencilPass; |
118 } | 118 } |
119 bounds.outset(bloat, bloat); | 119 bounds.outset(bloat, bloat); |
120 target->drawSimpleRect(bounds, NULL); | 120 target->drawSimpleRect(bounds, NULL); |
121 target->drawState()->stencil()->setDisabled(); | 121 target->drawState()->stencil()->setDisabled(); |
122 return true; | 122 return true; |
123 } | 123 } |
OLD | NEW |