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

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

Issue 858343002: Rename GrOptDrawState to GrPipeline and GrDrawState to GrPipelineBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more nits Created 5 years, 11 months 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/GrPipeline.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 14 matching lines...) Expand all
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 GrDrawTarget* target, 34 GrPathRenderer* GrPathRendererChain::getPathRenderer(const GrDrawTarget* target,
35 const GrDrawState* drawStat e, 35 const GrPipelineBuilder* pi pelineBuilder,
36 const SkMatrix& viewMatrix, 36 const SkMatrix& viewMatrix,
37 const SkPath& path, 37 const SkPath& path,
38 const SkStrokeRec& stroke, 38 const SkStrokeRec& stroke,
39 DrawType drawType, 39 DrawType drawType,
40 StencilSupport* stencilSupp ort) { 40 StencilSupport* stencilSupp ort) {
41 if (!fInit) { 41 if (!fInit) {
42 this->init(); 42 this->init();
43 } 43 }
44 bool antiAlias = (kColorAntiAlias_DrawType == drawType || 44 bool antiAlias = (kColorAntiAlias_DrawType == drawType ||
45 kStencilAndColorAntiAlias_DrawType == drawType); 45 kStencilAndColorAntiAlias_DrawType == drawType);
46 46
47 GR_STATIC_ASSERT(GrPathRenderer::kNoSupport_StencilSupport < 47 GR_STATIC_ASSERT(GrPathRenderer::kNoSupport_StencilSupport <
48 GrPathRenderer::kStencilOnly_StencilSupport); 48 GrPathRenderer::kStencilOnly_StencilSupport);
49 GR_STATIC_ASSERT(GrPathRenderer::kStencilOnly_StencilSupport < 49 GR_STATIC_ASSERT(GrPathRenderer::kStencilOnly_StencilSupport <
50 GrPathRenderer::kNoRestriction_StencilSupport); 50 GrPathRenderer::kNoRestriction_StencilSupport);
51 GrPathRenderer::StencilSupport minStencilSupport; 51 GrPathRenderer::StencilSupport minStencilSupport;
52 if (kStencilOnly_DrawType == drawType) { 52 if (kStencilOnly_DrawType == drawType) {
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, drawState, viewMatrix, path, stroke, antiAlias)) { 63 if (fChain[i]->canDrawPath(target, pipelineBuilder, viewMatrix, path, st roke, antiAlias)) {
64 if (GrPathRenderer::kNoSupport_StencilSupport != minStencilSupport) { 64 if (GrPathRenderer::kNoSupport_StencilSupport != minStencilSupport) {
65 GrPathRenderer::StencilSupport support = fChain[i]->getStencilSu pport(target, 65 GrPathRenderer::StencilSupport support =
66 drawState, 66 fChain[i]->getStencilSupport(target, pipelineBuilder, path, stroke);
67 path,
68 stroke);
69 if (support < minStencilSupport) { 67 if (support < minStencilSupport) {
70 continue; 68 continue;
71 } else if (stencilSupport) { 69 } else if (stencilSupport) {
72 *stencilSupport = support; 70 *stencilSupport = support;
73 } 71 }
74 } 72 }
75 return fChain[i]; 73 return fChain[i];
76 } 74 }
77 } 75 }
78 return NULL; 76 return NULL;
79 } 77 }
80 78
81 void GrPathRendererChain::init() { 79 void GrPathRendererChain::init() {
82 SkASSERT(!fInit); 80 SkASSERT(!fInit);
83 GrGpu* gpu = fOwner->getGpu(); 81 GrGpu* gpu = fOwner->getGpu();
84 bool twoSided = gpu->caps()->twoSidedStencilSupport(); 82 bool twoSided = gpu->caps()->twoSidedStencilSupport();
85 bool wrapOp = gpu->caps()->stencilWrapOpsSupport(); 83 bool wrapOp = gpu->caps()->stencilWrapOpsSupport();
86 GrPathRenderer::AddPathRenderers(fOwner, this); 84 GrPathRenderer::AddPathRenderers(fOwner, this);
87 this->addPathRenderer(SkNEW_ARGS(GrDefaultPathRenderer, 85 this->addPathRenderer(SkNEW_ARGS(GrDefaultPathRenderer,
88 (twoSided, wrapOp)))->unref(); 86 (twoSided, wrapOp)))->unref();
89 fInit = true; 87 fInit = true;
90 } 88 }
OLDNEW
« no previous file with comments | « src/gpu/GrPathRenderer.h ('k') | src/gpu/GrPipeline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698