| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 | 8 |
| 9 #include "GrStencilAndCoverPathRenderer.h" | 9 #include "GrStencilAndCoverPathRenderer.h" |
| 10 #include "GrCaps.h" | 10 #include "GrCaps.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 SkASSERT(pipelineBuilder->getStencil().isDisabled()); | 81 SkASSERT(pipelineBuilder->getStencil().isDisabled()); |
| 82 | 82 |
| 83 if (args.fAntiAlias) { | 83 if (args.fAntiAlias) { |
| 84 SkASSERT(pipelineBuilder->getRenderTarget()->isStencilBufferMultisampled
()); | 84 SkASSERT(pipelineBuilder->getRenderTarget()->isStencilBufferMultisampled
()); |
| 85 pipelineBuilder->enableState(GrPipelineBuilder::kHWAntialias_Flag); | 85 pipelineBuilder->enableState(GrPipelineBuilder::kHWAntialias_Flag); |
| 86 } | 86 } |
| 87 | 87 |
| 88 SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, path, *args.fStroke)); | 88 SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, path, *args.fStroke)); |
| 89 | 89 |
| 90 if (path.isInverseFillType()) { | 90 if (path.isInverseFillType()) { |
| 91 GR_STATIC_CONST_SAME_STENCIL(kInvertedStencilPass, | 91 static constexpr GrStencilSettings kInvertedStencilPass( |
| 92 kKeep_StencilOp, | 92 kKeep_StencilOp, |
| 93 kZero_StencilOp, | 93 kZero_StencilOp, |
| 94 // We know our rect will hit pixels outside the clip and the user bi
ts will be 0 | 94 // We know our rect will hit pixels outside the clip and the user bi
ts will be 0 |
| 95 // outside the clip. So we can't just fill where the user bits are 0
. We also need to | 95 // outside the clip. So we can't just fill where the user bits are 0
. We also need to |
| 96 // check that the clip bit is set. | 96 // check that the clip bit is set. |
| 97 kEqualIfInClip_StencilFunc, | 97 kEqualIfInClip_StencilFunc, |
| 98 0xffff, | 98 0xffff, |
| 99 0x0000, | 99 0x0000, |
| 100 0xffff); | 100 0xffff); |
| 101 | 101 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 124 const SkMatrix& viewM = viewMatrix.hasPerspective() ? SkMatrix::I() : vi
ewMatrix; | 124 const SkMatrix& viewM = viewMatrix.hasPerspective() ? SkMatrix::I() : vi
ewMatrix; |
| 125 if (pipelineBuilder->getRenderTarget()->hasMixedSamples()) { | 125 if (pipelineBuilder->getRenderTarget()->hasMixedSamples()) { |
| 126 pipelineBuilder->disableState(GrPipelineBuilder::kHWAntialias_Flag); | 126 pipelineBuilder->disableState(GrPipelineBuilder::kHWAntialias_Flag); |
| 127 } | 127 } |
| 128 | 128 |
| 129 SkAutoTUnref<GrDrawBatch> batch( | 129 SkAutoTUnref<GrDrawBatch> batch( |
| 130 GrRectBatchFactory::CreateNonAAFill(args.fColor, viewM, bounds,
nullptr, | 130 GrRectBatchFactory::CreateNonAAFill(args.fColor, viewM, bounds,
nullptr, |
| 131 &invert)); | 131 &invert)); |
| 132 args.fTarget->drawBatch(*pipelineBuilder, batch); | 132 args.fTarget->drawBatch(*pipelineBuilder, batch); |
| 133 } else { | 133 } else { |
| 134 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, | 134 static constexpr GrStencilSettings kStencilPass( |
| 135 kZero_StencilOp, | 135 kZero_StencilOp, |
| 136 kKeep_StencilOp, | 136 kKeep_StencilOp, |
| 137 kNotEqual_StencilFunc, | 137 kNotEqual_StencilFunc, |
| 138 0xffff, | 138 0xffff, |
| 139 0x0000, | 139 0x0000, |
| 140 0xffff); | 140 0xffff); |
| 141 | 141 |
| 142 pipelineBuilder->setStencil(kStencilPass); | 142 pipelineBuilder->setStencil(kStencilPass); |
| 143 SkAutoTUnref<GrDrawPathBatchBase> batch( | 143 SkAutoTUnref<GrDrawPathBatchBase> batch( |
| 144 GrDrawPathBatch::Create(viewMatrix, args.fColor, p->getFillType(
), p)); | 144 GrDrawPathBatch::Create(viewMatrix, args.fColor, p->getFillType(
), p)); |
| 145 args.fTarget->drawPathBatch(*pipelineBuilder, batch); | 145 args.fTarget->drawPathBatch(*pipelineBuilder, batch); |
| 146 } | 146 } |
| 147 | 147 |
| 148 pipelineBuilder->stencil()->setDisabled(); | 148 pipelineBuilder->stencil()->setDisabled(); |
| 149 return true; | 149 return true; |
| 150 } | 150 } |
| OLD | NEW |