| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrPathRendererChain.h" | 9 #include "GrPathRendererChain.h" |
| 10 | 10 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 fChain[i]->unref(); | 53 fChain[i]->unref(); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 GrPathRenderer* GrPathRendererChain::addPathRenderer(GrPathRenderer* pr) { | 57 GrPathRenderer* GrPathRendererChain::addPathRenderer(GrPathRenderer* pr) { |
| 58 fChain.push_back() = pr; | 58 fChain.push_back() = pr; |
| 59 pr->ref(); | 59 pr->ref(); |
| 60 return pr; | 60 return pr; |
| 61 } | 61 } |
| 62 | 62 |
| 63 GrPathRenderer* GrPathRendererChain::getPathRenderer(const GrPathRenderer::CanDr
awPathArgs& args, | 63 GrPathRenderer* GrPathRendererChain::getPathRenderer( |
| 64 DrawType drawType, | 64 const GrPathRenderer::CanDrawPathArgs& args, |
| 65 GrPathRenderer::StencilSupp
ort* stencilSupport) { | 65 DrawType drawType, |
| 66 GrPathRenderer::StencilSupport* stencilSupport) { |
| 66 GR_STATIC_ASSERT(GrPathRenderer::kNoSupport_StencilSupport < | 67 GR_STATIC_ASSERT(GrPathRenderer::kNoSupport_StencilSupport < |
| 67 GrPathRenderer::kStencilOnly_StencilSupport); | 68 GrPathRenderer::kStencilOnly_StencilSupport); |
| 68 GR_STATIC_ASSERT(GrPathRenderer::kStencilOnly_StencilSupport < | 69 GR_STATIC_ASSERT(GrPathRenderer::kStencilOnly_StencilSupport < |
| 69 GrPathRenderer::kNoRestriction_StencilSupport); | 70 GrPathRenderer::kNoRestriction_StencilSupport); |
| 70 GrPathRenderer::StencilSupport minStencilSupport; | 71 GrPathRenderer::StencilSupport minStencilSupport; |
| 71 if (kStencilOnly_DrawType == drawType) { | 72 if (kStencilOnly_DrawType == drawType) { |
| 72 minStencilSupport = GrPathRenderer::kStencilOnly_StencilSupport; | 73 minStencilSupport = GrPathRenderer::kStencilOnly_StencilSupport; |
| 73 } else if (kStencilAndColor_DrawType == drawType || | 74 } else if (kStencilAndColor_DrawType == drawType || |
| 74 kStencilAndColorAntiAlias_DrawType == drawType) { | 75 kStencilAndColorAntiAlias_DrawType == drawType) { |
| 75 minStencilSupport = GrPathRenderer::kNoRestriction_StencilSupport; | 76 minStencilSupport = GrPathRenderer::kNoRestriction_StencilSupport; |
| 76 } else { | 77 } else { |
| 77 minStencilSupport = GrPathRenderer::kNoSupport_StencilSupport; | 78 minStencilSupport = GrPathRenderer::kNoSupport_StencilSupport; |
| 78 } | 79 } |
| 80 if (minStencilSupport != GrPathRenderer::kNoSupport_StencilSupport) { |
| 81 // We don't support (and shouldn't need) stenciling of non-fill paths. |
| 82 if (!args.fStroke->isFillStyle() || args.fStroke->isDashed()) { |
| 83 return nullptr; |
| 84 } |
| 85 } |
| 79 | 86 |
| 80 for (int i = 0; i < fChain.count(); ++i) { | 87 for (int i = 0; i < fChain.count(); ++i) { |
| 81 if (fChain[i]->canDrawPath(args)) { | 88 if (fChain[i]->canDrawPath(args)) { |
| 82 if (GrPathRenderer::kNoSupport_StencilSupport != minStencilSupport)
{ | 89 if (GrPathRenderer::kNoSupport_StencilSupport != minStencilSupport)
{ |
| 83 GrPathRenderer::StencilSupport support = | 90 GrPathRenderer::StencilSupport support = |
| 84 fChain[i]->getStencilSupport(*args.fPath
, *args.fStroke); | 91 fChain[i]->getStencilSupport(*args.fPath
); |
| 85 if (support < minStencilSupport) { | 92 if (support < minStencilSupport) { |
| 86 continue; | 93 continue; |
| 87 } else if (stencilSupport) { | 94 } else if (stencilSupport) { |
| 88 *stencilSupport = support; | 95 *stencilSupport = support; |
| 89 } | 96 } |
| 90 } | 97 } |
| 91 return fChain[i]; | 98 return fChain[i]; |
| 92 } | 99 } |
| 93 } | 100 } |
| 94 return nullptr; | 101 return nullptr; |
| 95 } | 102 } |
| OLD | NEW |