OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 "GrPathRendererChain.h" | 10 #include "GrPathRendererChain.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 minStencilSupport = GrPathRenderer::kStencilOnly_StencilSupport; | 53 minStencilSupport = GrPathRenderer::kStencilOnly_StencilSupport; |
54 } else if (kStencilAndColor_DrawType == drawType || | 54 } else if (kStencilAndColor_DrawType == drawType || |
55 kStencilAndColorAntiAlias_DrawType == drawType) { | 55 kStencilAndColorAntiAlias_DrawType == drawType) { |
56 minStencilSupport = GrPathRenderer::kNoRestriction_StencilSupport; | 56 minStencilSupport = GrPathRenderer::kNoRestriction_StencilSupport; |
57 } else { | 57 } else { |
58 minStencilSupport = GrPathRenderer::kNoSupport_StencilSupport; | 58 minStencilSupport = GrPathRenderer::kNoSupport_StencilSupport; |
59 } | 59 } |
60 | 60 |
61 | 61 |
62 for (int i = 0; i < fChain.count(); ++i) { | 62 for (int i = 0; i < fChain.count(); ++i) { |
63 if (fChain[i]->canDrawPath(target, pipelineBuilder, viewMatrix, path, st
roke, antiAlias)) { | 63 GrPathRenderer::CanDrawPathArgs args; |
| 64 args.fTarget = target; |
| 65 args.fPipelineBuilder = pipelineBuilder; |
| 66 args.fViewMatrix = &viewMatrix; |
| 67 args.fPath = &path; |
| 68 args.fStroke = &stroke; |
| 69 args.fAntiAlias = antiAlias; |
| 70 if (fChain[i]->canDrawPath(args)) { |
64 if (GrPathRenderer::kNoSupport_StencilSupport != minStencilSupport)
{ | 71 if (GrPathRenderer::kNoSupport_StencilSupport != minStencilSupport)
{ |
65 GrPathRenderer::StencilSupport support = | 72 GrPathRenderer::StencilSupport support = |
66 fChain[i]->getStencilSupport(target, pipelineBuilder, path,
stroke); | 73 fChain[i]->getStencilSupport(target, pipelineBuilder, path,
stroke); |
67 if (support < minStencilSupport) { | 74 if (support < minStencilSupport) { |
68 continue; | 75 continue; |
69 } else if (stencilSupport) { | 76 } else if (stencilSupport) { |
70 *stencilSupport = support; | 77 *stencilSupport = support; |
71 } | 78 } |
72 } | 79 } |
73 return fChain[i]; | 80 return fChain[i]; |
74 } | 81 } |
75 } | 82 } |
76 return NULL; | 83 return NULL; |
77 } | 84 } |
78 | 85 |
79 void GrPathRendererChain::init() { | 86 void GrPathRendererChain::init() { |
80 SkASSERT(!fInit); | 87 SkASSERT(!fInit); |
81 const GrCaps* caps = fOwner->caps(); | 88 const GrCaps* caps = fOwner->caps(); |
82 bool twoSided = caps->twoSidedStencilSupport(); | 89 bool twoSided = caps->twoSidedStencilSupport(); |
83 bool wrapOp = caps->stencilWrapOpsSupport(); | 90 bool wrapOp = caps->stencilWrapOpsSupport(); |
84 GrPathRenderer::AddPathRenderers(fOwner, this); | 91 GrPathRenderer::AddPathRenderers(fOwner, this); |
85 this->addPathRenderer(SkNEW_ARGS(GrDefaultPathRenderer, | 92 this->addPathRenderer(SkNEW_ARGS(GrDefaultPathRenderer, |
86 (twoSided, wrapOp)))->unref(); | 93 (twoSided, wrapOp)))->unref(); |
87 fInit = true; | 94 fInit = true; |
88 } | 95 } |
OLD | NEW |