| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 GrDrawState* drawState, | 84 GrDrawState* drawState, |
| 85 const SkPath& path, | 85 const SkPath& path, |
| 86 const SkStrokeRec& stroke) { | 86 const SkStrokeRec& stroke) { |
| 87 SkASSERT(!path.isInverseFillType()); | 87 SkASSERT(!path.isInverseFillType()); |
| 88 SkAutoTUnref<GrPath> p(get_gr_path(fGpu, path, stroke)); | 88 SkAutoTUnref<GrPath> p(get_gr_path(fGpu, path, stroke)); |
| 89 target->stencilPath(drawState, p, convert_skpath_filltype(path.getFillType()
)); | 89 target->stencilPath(drawState, p, convert_skpath_filltype(path.getFillType()
)); |
| 90 } | 90 } |
| 91 | 91 |
| 92 bool GrStencilAndCoverPathRenderer::onDrawPath(GrDrawTarget* target, | 92 bool GrStencilAndCoverPathRenderer::onDrawPath(GrDrawTarget* target, |
| 93 GrDrawState* drawState, | 93 GrDrawState* drawState, |
| 94 GrColor color, |
| 94 const SkPath& path, | 95 const SkPath& path, |
| 95 const SkStrokeRec& stroke, | 96 const SkStrokeRec& stroke, |
| 96 bool antiAlias) { | 97 bool antiAlias) { |
| 97 SkASSERT(!antiAlias); | 98 SkASSERT(!antiAlias); |
| 98 SkASSERT(!stroke.isHairlineStyle()); | 99 SkASSERT(!stroke.isHairlineStyle()); |
| 99 | 100 |
| 100 SkASSERT(drawState->getStencil().isDisabled()); | 101 SkASSERT(drawState->getStencil().isDisabled()); |
| 101 | 102 |
| 102 SkAutoTUnref<GrPath> p(get_gr_path(fGpu, path, stroke)); | 103 SkAutoTUnref<GrPath> p(get_gr_path(fGpu, path, stroke)); |
| 103 | 104 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 126 // mapRect through persp matrix may not be correct | 127 // mapRect through persp matrix may not be correct |
| 127 if (!drawState->getViewMatrix().hasPerspective() && drawState->getViewIn
verse(&vmi)) { | 128 if (!drawState->getViewMatrix().hasPerspective() && drawState->getViewIn
verse(&vmi)) { |
| 128 vmi.mapRect(&bounds); | 129 vmi.mapRect(&bounds); |
| 129 // theoretically could set bloat = 0, instead leave it because of ma
trix inversion | 130 // theoretically could set bloat = 0, instead leave it because of ma
trix inversion |
| 130 // precision. | 131 // precision. |
| 131 SkScalar bloat = drawState->getViewMatrix().getMaxScale() * SK_Scala
rHalf; | 132 SkScalar bloat = drawState->getViewMatrix().getMaxScale() * SK_Scala
rHalf; |
| 132 bounds.outset(bloat, bloat); | 133 bounds.outset(bloat, bloat); |
| 133 } else { | 134 } else { |
| 134 avmr.setIdentity(drawState); | 135 avmr.setIdentity(drawState); |
| 135 } | 136 } |
| 136 target->drawSimpleRect(drawState, bounds); | 137 target->drawSimpleRect(drawState, color, bounds); |
| 137 } else { | 138 } else { |
| 138 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, | 139 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, |
| 139 kZero_StencilOp, | 140 kZero_StencilOp, |
| 140 kZero_StencilOp, | 141 kZero_StencilOp, |
| 141 kNotEqual_StencilFunc, | 142 kNotEqual_StencilFunc, |
| 142 0xffff, | 143 0xffff, |
| 143 0x0000, | 144 0x0000, |
| 144 0xffff); | 145 0xffff); |
| 145 | 146 |
| 146 drawState->setStencil(kStencilPass); | 147 drawState->setStencil(kStencilPass); |
| 147 target->drawPath(drawState, p, convert_skpath_filltype(path.getFillType(
))); | 148 target->drawPath(drawState, color, p, convert_skpath_filltype(path.getFi
llType())); |
| 148 } | 149 } |
| 149 | 150 |
| 150 drawState->stencil()->setDisabled(); | 151 drawState->stencil()->setDisabled(); |
| 151 return true; | 152 return true; |
| 152 } | 153 } |
| OLD | NEW |