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

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

Issue 142543007: Revert of r13384 (Stateful PathRenderer implementation) (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrPathRenderer.h ('k') | src/gpu/GrSoftwarePathRenderer.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 17 matching lines...) Expand all
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 SkPath& path,
35 const SkStrokeRec& stroke, 35 const SkStrokeRec& stroke,
36 const GrDrawTarget* target, 36 const GrDrawTarget* target,
37 DrawType drawType, 37 DrawType drawType,
38 SkPath::FillType fillType,
39 StencilSupport* stencilSupp ort) { 38 StencilSupport* stencilSupp ort) {
40 if (!fInit) { 39 if (!fInit) {
41 this->init(); 40 this->init();
42 } 41 }
43 bool antiAlias = (kColorAntiAlias_DrawType == drawType || 42 bool antiAlias = (kColorAntiAlias_DrawType == drawType ||
44 kStencilAndColorAntiAlias_DrawType == drawType); 43 kStencilAndColorAntiAlias_DrawType == drawType);
45 44
46 GR_STATIC_ASSERT(GrPathRenderer::kNoSupport_StencilSupport < 45 GR_STATIC_ASSERT(GrPathRenderer::kNoSupport_StencilSupport <
47 GrPathRenderer::kStencilOnly_StencilSupport); 46 GrPathRenderer::kStencilOnly_StencilSupport);
48 GR_STATIC_ASSERT(GrPathRenderer::kStencilOnly_StencilSupport < 47 GR_STATIC_ASSERT(GrPathRenderer::kStencilOnly_StencilSupport <
49 GrPathRenderer::kNoRestriction_StencilSupport); 48 GrPathRenderer::kNoRestriction_StencilSupport);
50 GrPathRenderer::StencilSupport minStencilSupport; 49 GrPathRenderer::StencilSupport minStencilSupport;
51 if (kStencilOnly_DrawType == drawType) { 50 if (kStencilOnly_DrawType == drawType) {
52 minStencilSupport = GrPathRenderer::kStencilOnly_StencilSupport; 51 minStencilSupport = GrPathRenderer::kStencilOnly_StencilSupport;
53 } else if (kStencilAndColor_DrawType == drawType || 52 } else if (kStencilAndColor_DrawType == drawType ||
54 kStencilAndColorAntiAlias_DrawType == drawType) { 53 kStencilAndColorAntiAlias_DrawType == drawType) {
55 minStencilSupport = GrPathRenderer::kNoRestriction_StencilSupport; 54 minStencilSupport = GrPathRenderer::kNoRestriction_StencilSupport;
56 } else { 55 } else {
57 minStencilSupport = GrPathRenderer::kNoSupport_StencilSupport; 56 minStencilSupport = GrPathRenderer::kNoSupport_StencilSupport;
58 } 57 }
59 58
59
60 for (int i = 0; i < fChain.count(); ++i) { 60 for (int i = 0; i < fChain.count(); ++i) {
61 fChain[i]->setPath(path, fillType); 61 if (fChain[i]->canDrawPath(path, stroke, target, antiAlias)) {
62 if (fChain[i]->canDrawPath(stroke, target, antiAlias)) {
63 if (GrPathRenderer::kNoSupport_StencilSupport != minStencilSupport) { 62 if (GrPathRenderer::kNoSupport_StencilSupport != minStencilSupport) {
64 GrPathRenderer::StencilSupport support = fChain[i]->getStencilSu pport(stroke, 63 GrPathRenderer::StencilSupport support = fChain[i]->getStencilSu pport(path,
64 stroke,
65 target); 65 target);
66 if (support < minStencilSupport) { 66 if (support < minStencilSupport) {
67 continue; 67 continue;
68 } else if (NULL != stencilSupport) { 68 } else if (NULL != stencilSupport) {
69 *stencilSupport = support; 69 *stencilSupport = support;
70 } 70 }
71 } 71 }
72 return fChain[i]; 72 return fChain[i];
73 } 73 }
74 fChain[i]->resetPath();
75 } 74 }
76 return NULL; 75 return NULL;
77 } 76 }
78 77
79 void GrPathRendererChain::init() { 78 void GrPathRendererChain::init() {
80 SkASSERT(!fInit); 79 SkASSERT(!fInit);
81 GrGpu* gpu = fOwner->getGpu(); 80 GrGpu* gpu = fOwner->getGpu();
82 bool twoSided = gpu->caps()->twoSidedStencilSupport(); 81 bool twoSided = gpu->caps()->twoSidedStencilSupport();
83 bool wrapOp = gpu->caps()->stencilWrapOpsSupport(); 82 bool wrapOp = gpu->caps()->stencilWrapOpsSupport();
84 GrPathRenderer::AddPathRenderers(fOwner, this); 83 GrPathRenderer::AddPathRenderers(fOwner, this);
85 this->addPathRenderer(SkNEW_ARGS(GrDefaultPathRenderer, 84 this->addPathRenderer(SkNEW_ARGS(GrDefaultPathRenderer,
86 (twoSided, wrapOp)))->unref(); 85 (twoSided, wrapOp)))->unref();
87 fInit = true; 86 fInit = true;
88 } 87 }
OLDNEW
« no previous file with comments | « src/gpu/GrPathRenderer.h ('k') | src/gpu/GrSoftwarePathRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698