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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 GrRect bounds = p->getBounds(); |
81 SkScalar bloat = drawState->getViewMatrix().getMaxStretch() * SK_ScalarHalf; | 81 SkScalar bloat = drawState->getViewMatrix().getMaxStretch() * SK_ScalarHalf; |
82 GrDrawState::AutoDeviceCoordDraw adcd; | 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, |
91 0xffff); | 91 0xffff); |
92 *drawState->stencil() = kStencilPass; | 92 *drawState->stencil() = kStencilPass; |
(...skipping 11 matching lines...) Expand all Loading... |
104 SkMatrix vmi; | 104 SkMatrix vmi; |
105 bounds.setLTRB(0, 0, | 105 bounds.setLTRB(0, 0, |
106 SkIntToScalar(drawState->getRenderTarget()->width()), | 106 SkIntToScalar(drawState->getRenderTarget()->width()), |
107 SkIntToScalar(drawState->getRenderTarget()->height())); | 107 SkIntToScalar(drawState->getRenderTarget()->height())); |
108 // mapRect through persp matrix may not be correct | 108 // mapRect through persp matrix may not be correct |
109 if (!drawState->getViewMatrix().hasPerspective() && drawState->getViewIn
verse(&vmi)) { | 109 if (!drawState->getViewMatrix().hasPerspective() && drawState->getViewIn
verse(&vmi)) { |
110 vmi.mapRect(&bounds); | 110 vmi.mapRect(&bounds); |
111 // theoretically could set bloat = 0, instead leave it because of ma
trix inversion | 111 // theoretically could set bloat = 0, instead leave it because of ma
trix inversion |
112 // precision. | 112 // precision. |
113 } else { | 113 } else { |
114 adcd.set(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 |