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

Side by Side Diff: src/gpu/GrPathRenderer.h

Issue 1407883004: Remove GrPipelineBuilder from getPathRenderer call (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Hide GrContext::drawingManager entry point Created 5 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/GrDrawingManager.cpp ('k') | src/gpu/GrPathRendererChain.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 #ifndef GrPathRenderer_DEFINED 9 #ifndef GrPathRenderer_DEFINED
10 #define GrPathRenderer_DEFINED 10 #define GrPathRenderer_DEFINED
11 11
12 #include "GrDrawTarget.h" 12 #include "GrDrawTarget.h"
13 #include "GrPathRendererChain.h"
14 #include "GrStencil.h" 13 #include "GrStencil.h"
15 #include "GrStrokeInfo.h" 14 #include "GrStrokeInfo.h"
16 15
17 #include "SkDrawProcs.h" 16 #include "SkDrawProcs.h"
18 #include "SkTArray.h" 17 #include "SkTArray.h"
19 18
20 class SkPath; 19 class SkPath;
21 20
22 struct GrPoint; 21 struct GrPoint;
23 22
(...skipping 20 matching lines...) Expand all
44 * and calls drawPath(). The path is rendered exactly as the draw state 43 * and calls drawPath(). The path is rendered exactly as the draw state
45 * indicates including support for simultaneous color and stenciling with 44 * indicates including support for simultaneous color and stenciling with
46 * arbitrary stenciling rules. Pixels partially covered b y AA paths are 45 * arbitrary stenciling rules. Pixels partially covered b y AA paths are
47 * affected by the stencil settings. 46 * affected by the stencil settings.
48 * 2) kStencilOnly: The path renderer cannot apply arbitrary stencil rules n or shade and stencil 47 * 2) kStencilOnly: The path renderer cannot apply arbitrary stencil rules n or shade and stencil
49 * simultaneously. The path renderer does support the stenc ilPath() function 48 * simultaneously. The path renderer does support the stenc ilPath() function
50 * which performs no color writes and writes a non-zero ste ncil value to pixels 49 * which performs no color writes and writes a non-zero ste ncil value to pixels
51 * covered by the path. 50 * covered by the path.
52 * 3) kNoSupport: This path renderer cannot be used to stencil the path. 51 * 3) kNoSupport: This path renderer cannot be used to stencil the path.
53 */ 52 */
54 typedef GrPathRendererChain::StencilSupport StencilSupport; 53 enum StencilSupport {
55 static const StencilSupport kNoSupport_StencilSupport = 54 kNoSupport_StencilSupport,
56 GrPathRendererChain::kNoSupport_StencilSupport; 55 kStencilOnly_StencilSupport,
57 static const StencilSupport kStencilOnly_StencilSupport = 56 kNoRestriction_StencilSupport,
58 GrPathRendererChain::kStencilOnly_StencilSupport; 57 };
59 static const StencilSupport kNoRestriction_StencilSupport =
60 GrPathRendererChain::kNoRestriction_StencilSupport;
61 58
62 /** 59 /**
63 * This function is to get the stencil support for a particular path. The pa th's fill must 60 * This function is to get the stencil support for a particular path. The pa th's fill must
64 * not be an inverse type. 61 * not be an inverse type.
65 * 62 *
66 * @param path the path that will be drawn 63 * @param path the path that will be drawn
67 * @param stroke the stroke information (width, join, cap). 64 * @param stroke the stroke information (width, join, cap).
68 */ 65 */
69 StencilSupport getStencilSupport(const SkPath& path, const GrStrokeInfo& str oke) const { 66 StencilSupport getStencilSupport(const SkPath& path, const GrStrokeInfo& str oke) const {
70 SkASSERT(!path.isInverseFillType()); 67 SkASSERT(!path.isInverseFillType());
71 return this->onGetStencilSupport(path, stroke); 68 return this->onGetStencilSupport(path, stroke);
72 } 69 }
73 70
74 /** Args to canDrawPath() 71 /** Args to canDrawPath()
75 * 72 *
76 * fShaderCaps The shader caps 73 * fShaderCaps The shader caps
77 * fPipelineBuilder The pipelineBuilder 74 * fPipelineBuilder The pipelineBuilder
78 * fViewMatrix The viewMatrix 75 * fViewMatrix The viewMatrix
79 * fPath The path to draw 76 * fPath The path to draw
80 * fStroke The stroke information (width, join, cap) 77 * fStroke The stroke information (width, join, cap)
81 * fAntiAlias True if anti-aliasing is required. 78 * fAntiAlias True if anti-aliasing is required.
82 */ 79 */
83 struct CanDrawPathArgs { 80 struct CanDrawPathArgs {
84 const GrShaderCaps* fShaderCaps; 81 const GrShaderCaps* fShaderCaps;
85 const GrPipelineBuilder* fPipelineBuilder;// only used by GrStencilAn dCoverPathRenderer
86 const SkMatrix* fViewMatrix; 82 const SkMatrix* fViewMatrix;
87 const SkPath* fPath; 83 const SkPath* fPath;
88 const GrStrokeInfo* fStroke; 84 const GrStrokeInfo* fStroke;
89 bool fAntiAlias; 85 bool fAntiAlias;
90 86
87 // These next two are only used by GrStencilAndCoverPathRenderer
88 bool fIsStencilDisabled;
89 bool fIsStencilBufferMSAA;
90
91 void validate() const { 91 void validate() const {
92 SkASSERT(fShaderCaps); 92 SkASSERT(fShaderCaps);
93 SkASSERT(fPipelineBuilder);
94 SkASSERT(fViewMatrix); 93 SkASSERT(fViewMatrix);
95 SkASSERT(fPath); 94 SkASSERT(fPath);
96 SkASSERT(fStroke); 95 SkASSERT(fStroke);
97 SkASSERT(!fPath->isEmpty()); 96 SkASSERT(!fPath->isEmpty());
98 } 97 }
99 }; 98 };
100 99
101 /** 100 /**
102 * Returns true if this path renderer is able to render the path. Returning false allows the 101 * Returns true if this path renderer is able to render the path. Returning false allows the
103 * caller to fallback to another path renderer This function is called when searching for a path 102 * caller to fallback to another path renderer This function is called when searching for a path
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 143
145 /** 144 /**
146 * Draws the path into the draw target. If getStencilSupport() would return kNoRestriction then 145 * Draws the path into the draw target. If getStencilSupport() would return kNoRestriction then
147 * the subclass must respect the stencil settings of the GrPipelineBuilder. 146 * the subclass must respect the stencil settings of the GrPipelineBuilder.
148 */ 147 */
149 bool drawPath(const DrawPathArgs& args) { 148 bool drawPath(const DrawPathArgs& args) {
150 SkDEBUGCODE(args.validate();) 149 SkDEBUGCODE(args.validate();)
151 #ifdef SK_DEBUG 150 #ifdef SK_DEBUG
152 CanDrawPathArgs canArgs; 151 CanDrawPathArgs canArgs;
153 canArgs.fShaderCaps = args.fTarget->caps()->shaderCaps(); 152 canArgs.fShaderCaps = args.fTarget->caps()->shaderCaps();
154 canArgs.fPipelineBuilder = args.fPipelineBuilder;
155 canArgs.fViewMatrix = args.fViewMatrix; 153 canArgs.fViewMatrix = args.fViewMatrix;
156 canArgs.fPath = args.fPath; 154 canArgs.fPath = args.fPath;
157 canArgs.fStroke = args.fStroke; 155 canArgs.fStroke = args.fStroke;
158 canArgs.fAntiAlias = args.fAntiAlias; 156 canArgs.fAntiAlias = args.fAntiAlias;
157
158 canArgs.fIsStencilDisabled = args.fPipelineBuilder->getStencil().isDisab led();
159 canArgs.fIsStencilBufferMSAA =
160 args.fPipelineBuilder->getRenderTarget()->isStencilBuf ferMultisampled();
159 SkASSERT(this->canDrawPath(canArgs)); 161 SkASSERT(this->canDrawPath(canArgs));
160 SkASSERT(args.fPipelineBuilder->getStencil().isDisabled() || 162 SkASSERT(args.fPipelineBuilder->getStencil().isDisabled() ||
161 kNoRestriction_StencilSupport == this->getStencilSupport(*args. fPath, 163 kNoRestriction_StencilSupport == this->getStencilSupport(*args. fPath,
162 *args. fStroke)); 164 *args. fStroke));
163 #endif 165 #endif
164 return this->onDrawPath(args); 166 return this->onDrawPath(args);
165 } 167 }
166 168
167 /* Args to stencilPath(). 169 /* Args to stencilPath().
168 * 170 *
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 drawArgs.fStroke = args.fStroke; 282 drawArgs.fStroke = args.fStroke;
281 drawArgs.fAntiAlias = false; 283 drawArgs.fAntiAlias = false;
282 this->drawPath(drawArgs); 284 this->drawPath(drawArgs);
283 } 285 }
284 286
285 287
286 typedef SkRefCnt INHERITED; 288 typedef SkRefCnt INHERITED;
287 }; 289 };
288 290
289 #endif 291 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrDrawingManager.cpp ('k') | src/gpu/GrPathRendererChain.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698