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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 const SkPath&, | 48 const SkPath&, |
49 const SkStrokeRec& , | 49 const SkStrokeRec& , |
50 const GrDrawTarget*) con
st { | 50 const GrDrawTarget*) con
st { |
51 return GrPathRenderer::kStencilOnly_StencilSupport; | 51 return GrPathRenderer::kStencilOnly_StencilSupport; |
52 } | 52 } |
53 | 53 |
54 void GrStencilAndCoverPathRenderer::onStencilPath(const SkPath& path, | 54 void GrStencilAndCoverPathRenderer::onStencilPath(const SkPath& path, |
55 const SkStrokeRec& stroke, | 55 const SkStrokeRec& stroke, |
56 GrDrawTarget* target) { | 56 GrDrawTarget* target) { |
57 SkASSERT(!path.isInverseFillType()); | 57 SkASSERT(!path.isInverseFillType()); |
58 SkAutoTUnref<GrPath> p(fGpu->createPath(path, stroke)); | 58 SkAutoTUnref<GrPath> p(fGpu->getContext()->createPath(path, stroke)); |
59 target->stencilPath(p, path.getFillType()); | 59 target->stencilPath(p, path.getFillType()); |
60 } | 60 } |
61 | 61 |
62 bool GrStencilAndCoverPathRenderer::onDrawPath(const SkPath& path, | 62 bool GrStencilAndCoverPathRenderer::onDrawPath(const SkPath& path, |
63 const SkStrokeRec& stroke, | 63 const SkStrokeRec& stroke, |
64 GrDrawTarget* target, | 64 GrDrawTarget* target, |
65 bool antiAlias) { | 65 bool antiAlias) { |
66 SkASSERT(!antiAlias); | 66 SkASSERT(!antiAlias); |
67 SkASSERT(!stroke.isHairlineStyle()); | 67 SkASSERT(!stroke.isHairlineStyle()); |
68 | 68 |
69 GrDrawState* drawState = target->drawState(); | 69 GrDrawState* drawState = target->drawState(); |
70 SkASSERT(drawState->getStencil().isDisabled()); | 70 SkASSERT(drawState->getStencil().isDisabled()); |
71 | 71 |
72 SkAutoTUnref<GrPath> p(fGpu->createPath(path, stroke)); | 72 SkAutoTUnref<GrPath> p(fGpu->getContext()->createPath(path, stroke)); |
73 | 73 |
74 if (path.isInverseFillType()) { | 74 if (path.isInverseFillType()) { |
75 GR_STATIC_CONST_SAME_STENCIL(kInvertedStencilPass, | 75 GR_STATIC_CONST_SAME_STENCIL(kInvertedStencilPass, |
76 kZero_StencilOp, | 76 kZero_StencilOp, |
77 kZero_StencilOp, | 77 kZero_StencilOp, |
78 // We know our rect will hit pixels outside the clip and the user bi
ts will be 0 | 78 // We know our rect will hit pixels outside the clip and the user bi
ts will be 0 |
79 // outside the clip. So we can't just fill where the user bits are 0
. We also need to | 79 // outside the clip. So we can't just fill where the user bits are 0
. We also need to |
80 // check that the clip bit is set. | 80 // check that the clip bit is set. |
81 kEqualIfInClip_StencilFunc, | 81 kEqualIfInClip_StencilFunc, |
82 0xffff, | 82 0xffff, |
(...skipping 11 matching lines...) Expand all Loading... |
94 0xffff); | 94 0xffff); |
95 | 95 |
96 *drawState->stencil() = kStencilPass; | 96 *drawState->stencil() = kStencilPass; |
97 } | 97 } |
98 | 98 |
99 target->drawPath(p, path.getFillType()); | 99 target->drawPath(p, path.getFillType()); |
100 | 100 |
101 target->drawState()->stencil()->setDisabled(); | 101 target->drawState()->stencil()->setDisabled(); |
102 return true; | 102 return true; |
103 } | 103 } |
OLD | NEW |