| 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" |
| 11 #include "GrContext.h" | 11 #include "GrContext.h" |
| 12 #include "GrGpu.h" | 12 #include "GrGpu.h" |
| 13 #include "GrPath.h" | 13 #include "GrPath.h" |
| 14 #include "SkStrokeRec.h" | 14 #include "SkStrokeRec.h" |
| 15 | 15 |
| 16 GrPathRenderer* GrStencilAndCoverPathRenderer::Create(GrContext* context) { | 16 GrPathRenderer* GrStencilAndCoverPathRenderer::Create(GrContext* context) { |
| 17 GrAssert(NULL != context); | 17 GrAssert(NULL != context); |
| 18 GrAssert(NULL != context->getGpu()); | 18 GrAssert(NULL != context->getGpu()); |
| 19 if (context->getGpu()->getCaps().pathStencilingSupport()) { | 19 if (context->getGpu()->caps()->pathStencilingSupport()) { |
| 20 return SkNEW_ARGS(GrStencilAndCoverPathRenderer, (context->getGpu())); | 20 return SkNEW_ARGS(GrStencilAndCoverPathRenderer, (context->getGpu())); |
| 21 } else { | 21 } else { |
| 22 return NULL; | 22 return NULL; |
| 23 } | 23 } |
| 24 } | 24 } |
| 25 | 25 |
| 26 GrStencilAndCoverPathRenderer::GrStencilAndCoverPathRenderer(GrGpu* gpu) { | 26 GrStencilAndCoverPathRenderer::GrStencilAndCoverPathRenderer(GrGpu* gpu) { |
| 27 GrAssert(gpu->getCaps().pathStencilingSupport()); | 27 GrAssert(gpu->caps()->pathStencilingSupport()); |
| 28 fGpu = gpu; | 28 fGpu = gpu; |
| 29 gpu->ref(); | 29 gpu->ref(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 GrStencilAndCoverPathRenderer::~GrStencilAndCoverPathRenderer() { | 32 GrStencilAndCoverPathRenderer::~GrStencilAndCoverPathRenderer() { |
| 33 fGpu->unref(); | 33 fGpu->unref(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool GrStencilAndCoverPathRenderer::canDrawPath(const SkPath& path, | 36 bool GrStencilAndCoverPathRenderer::canDrawPath(const SkPath& path, |
| 37 const SkStrokeRec& stroke, | 37 const SkStrokeRec& stroke, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 adcd.set(drawState); | 113 adcd.set(drawState); |
| 114 bloat = 0; | 114 bloat = 0; |
| 115 } | 115 } |
| 116 *drawState->stencil() = kInvertedStencilPass; | 116 *drawState->stencil() = kInvertedStencilPass; |
| 117 } | 117 } |
| 118 bounds.outset(bloat, bloat); | 118 bounds.outset(bloat, bloat); |
| 119 target->drawSimpleRect(bounds, NULL); | 119 target->drawSimpleRect(bounds, NULL); |
| 120 target->drawState()->stencil()->setDisabled(); | 120 target->drawState()->stencil()->setDisabled(); |
| 121 return true; | 121 return true; |
| 122 } | 122 } |
| OLD | NEW |