| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 if (args.fAntiAlias) { | 96 if (args.fAntiAlias) { |
| 97 SkASSERT(pipelineBuilder->getRenderTarget()->isStencilBufferMultisampled
()); | 97 SkASSERT(pipelineBuilder->getRenderTarget()->isStencilBufferMultisampled
()); |
| 98 pipelineBuilder->enableState(GrPipelineBuilder::kHWAntialias_Flag); | 98 pipelineBuilder->enableState(GrPipelineBuilder::kHWAntialias_Flag); |
| 99 } | 99 } |
| 100 | 100 |
| 101 SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, path, *args.fStroke)); | 101 SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, path, *args.fStroke)); |
| 102 | 102 |
| 103 if (path.isInverseFillType()) { | 103 if (path.isInverseFillType()) { |
| 104 GR_STATIC_CONST_SAME_STENCIL(kInvertedStencilPass, | 104 GR_STATIC_CONST_SAME_STENCIL(kInvertedStencilPass, |
| 105 kZero_StencilOp, | 105 kKeep_StencilOp, |
| 106 kZero_StencilOp, | 106 kZero_StencilOp, |
| 107 // We know our rect will hit pixels outside the clip and the user bi
ts will be 0 | 107 // We know our rect will hit pixels outside the clip and the user bi
ts will be 0 |
| 108 // outside the clip. So we can't just fill where the user bits are 0
. We also need to | 108 // outside the clip. So we can't just fill where the user bits are 0
. We also need to |
| 109 // check that the clip bit is set. | 109 // check that the clip bit is set. |
| 110 kEqualIfInClip_StencilFunc, | 110 kEqualIfInClip_StencilFunc, |
| 111 0xffff, | 111 0xffff, |
| 112 0x0000, | 112 0x0000, |
| 113 0xffff); | 113 0xffff); |
| 114 | 114 |
| 115 pipelineBuilder->setStencil(kInvertedStencilPass); | 115 pipelineBuilder->setStencil(kInvertedStencilPass); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 134 } else { | 134 } else { |
| 135 if (!viewMatrix.invert(&invert)) { | 135 if (!viewMatrix.invert(&invert)) { |
| 136 return false; | 136 return false; |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 const SkMatrix& viewM = viewMatrix.hasPerspective() ? SkMatrix::I() : vi
ewMatrix; | 139 const SkMatrix& viewM = viewMatrix.hasPerspective() ? SkMatrix::I() : vi
ewMatrix; |
| 140 args.fTarget->drawBWRect(*pipelineBuilder, args.fColor, viewM, bounds, N
ULL, &invert); | 140 args.fTarget->drawBWRect(*pipelineBuilder, args.fColor, viewM, bounds, N
ULL, &invert); |
| 141 } else { | 141 } else { |
| 142 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, | 142 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, |
| 143 kZero_StencilOp, | 143 kZero_StencilOp, |
| 144 kZero_StencilOp, | 144 kKeep_StencilOp, |
| 145 kNotEqual_StencilFunc, | 145 kNotEqual_StencilFunc, |
| 146 0xffff, | 146 0xffff, |
| 147 0x0000, | 147 0x0000, |
| 148 0xffff); | 148 0xffff); |
| 149 | 149 |
| 150 pipelineBuilder->setStencil(kStencilPass); | 150 pipelineBuilder->setStencil(kStencilPass); |
| 151 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(args.fColor, vi
ewMatrix)); | 151 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(args.fColor, vi
ewMatrix)); |
| 152 args.fTarget->drawPath(*pipelineBuilder, pp, p, | 152 args.fTarget->drawPath(*pipelineBuilder, pp, p, |
| 153 convert_skpath_filltype(path.getFillType())); | 153 convert_skpath_filltype(path.getFillType())); |
| 154 } | 154 } |
| 155 | 155 |
| 156 pipelineBuilder->stencil()->setDisabled(); | 156 pipelineBuilder->stencil()->setDisabled(); |
| 157 return true; | 157 return true; |
| 158 } | 158 } |
| OLD | NEW |