Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: src/gpu/GrPathRendererChain.cpp

Issue 732693002: Drawstate on stack (Closed) Base URL: https://skia.googlesource.com/skia.git@real_def_gp
Patch Set: tiny fix Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrPathRenderer.h ('k') | src/gpu/GrSWMaskHelper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 13 matching lines...) Expand all
24 fChain[i]->unref(); 24 fChain[i]->unref();
25 } 25 }
26 } 26 }
27 27
28 GrPathRenderer* GrPathRendererChain::addPathRenderer(GrPathRenderer* pr) { 28 GrPathRenderer* GrPathRendererChain::addPathRenderer(GrPathRenderer* pr) {
29 fChain.push_back() = pr; 29 fChain.push_back() = pr;
30 pr->ref(); 30 pr->ref();
31 return pr; 31 return pr;
32 } 32 }
33 33
34 GrPathRenderer* GrPathRendererChain::getPathRenderer(const SkPath& path, 34 GrPathRenderer* GrPathRendererChain::getPathRenderer(const GrDrawTarget* target,
35 const GrDrawState* drawStat e,
36 const SkPath& path,
35 const SkStrokeRec& stroke, 37 const SkStrokeRec& stroke,
36 const GrDrawTarget* target,
37 DrawType drawType, 38 DrawType drawType,
38 StencilSupport* stencilSupp ort) { 39 StencilSupport* stencilSupp ort) {
39 if (!fInit) { 40 if (!fInit) {
40 this->init(); 41 this->init();
41 } 42 }
42 bool antiAlias = (kColorAntiAlias_DrawType == drawType || 43 bool antiAlias = (kColorAntiAlias_DrawType == drawType ||
43 kStencilAndColorAntiAlias_DrawType == drawType); 44 kStencilAndColorAntiAlias_DrawType == drawType);
44 45
45 GR_STATIC_ASSERT(GrPathRenderer::kNoSupport_StencilSupport < 46 GR_STATIC_ASSERT(GrPathRenderer::kNoSupport_StencilSupport <
46 GrPathRenderer::kStencilOnly_StencilSupport); 47 GrPathRenderer::kStencilOnly_StencilSupport);
47 GR_STATIC_ASSERT(GrPathRenderer::kStencilOnly_StencilSupport < 48 GR_STATIC_ASSERT(GrPathRenderer::kStencilOnly_StencilSupport <
48 GrPathRenderer::kNoRestriction_StencilSupport); 49 GrPathRenderer::kNoRestriction_StencilSupport);
49 GrPathRenderer::StencilSupport minStencilSupport; 50 GrPathRenderer::StencilSupport minStencilSupport;
50 if (kStencilOnly_DrawType == drawType) { 51 if (kStencilOnly_DrawType == drawType) {
51 minStencilSupport = GrPathRenderer::kStencilOnly_StencilSupport; 52 minStencilSupport = GrPathRenderer::kStencilOnly_StencilSupport;
52 } else if (kStencilAndColor_DrawType == drawType || 53 } else if (kStencilAndColor_DrawType == drawType ||
53 kStencilAndColorAntiAlias_DrawType == drawType) { 54 kStencilAndColorAntiAlias_DrawType == drawType) {
54 minStencilSupport = GrPathRenderer::kNoRestriction_StencilSupport; 55 minStencilSupport = GrPathRenderer::kNoRestriction_StencilSupport;
55 } else { 56 } else {
56 minStencilSupport = GrPathRenderer::kNoSupport_StencilSupport; 57 minStencilSupport = GrPathRenderer::kNoSupport_StencilSupport;
57 } 58 }
58 59
59 60
60 for (int i = 0; i < fChain.count(); ++i) { 61 for (int i = 0; i < fChain.count(); ++i) {
61 if (fChain[i]->canDrawPath(path, stroke, target, antiAlias)) { 62 if (fChain[i]->canDrawPath(target, drawState, path, stroke, antiAlias)) {
62 if (GrPathRenderer::kNoSupport_StencilSupport != minStencilSupport) { 63 if (GrPathRenderer::kNoSupport_StencilSupport != minStencilSupport) {
63 GrPathRenderer::StencilSupport support = fChain[i]->getStencilSu pport(path, 64 GrPathRenderer::StencilSupport support = fChain[i]->getStencilSu pport(target,
64 stroke, 65 drawState,
65 target); 66 path,
67 stroke);
66 if (support < minStencilSupport) { 68 if (support < minStencilSupport) {
67 continue; 69 continue;
68 } else if (stencilSupport) { 70 } else if (stencilSupport) {
69 *stencilSupport = support; 71 *stencilSupport = support;
70 } 72 }
71 } 73 }
72 return fChain[i]; 74 return fChain[i];
73 } 75 }
74 } 76 }
75 return NULL; 77 return NULL;
76 } 78 }
77 79
78 void GrPathRendererChain::init() { 80 void GrPathRendererChain::init() {
79 SkASSERT(!fInit); 81 SkASSERT(!fInit);
80 GrGpu* gpu = fOwner->getGpu(); 82 GrGpu* gpu = fOwner->getGpu();
81 bool twoSided = gpu->caps()->twoSidedStencilSupport(); 83 bool twoSided = gpu->caps()->twoSidedStencilSupport();
82 bool wrapOp = gpu->caps()->stencilWrapOpsSupport(); 84 bool wrapOp = gpu->caps()->stencilWrapOpsSupport();
83 GrPathRenderer::AddPathRenderers(fOwner, this); 85 GrPathRenderer::AddPathRenderers(fOwner, this);
84 this->addPathRenderer(SkNEW_ARGS(GrDefaultPathRenderer, 86 this->addPathRenderer(SkNEW_ARGS(GrDefaultPathRenderer,
85 (twoSided, wrapOp)))->unref(); 87 (twoSided, wrapOp)))->unref();
86 fInit = true; 88 fInit = true;
87 } 89 }
OLDNEW
« no previous file with comments | « src/gpu/GrPathRenderer.h ('k') | src/gpu/GrSWMaskHelper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698