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

Side by Side Diff: src/gpu/effects/GrBezierEffect.h

Issue 1139723004: Preliminary attempt to remove batch tracker (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanup5
Patch Set: tweaks Created 5 years, 7 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/GrTestBatch.h ('k') | src/gpu/effects/GrBezierEffect.cpp » ('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 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrBezierEffect_DEFINED 8 #ifndef GrBezierEffect_DEFINED
9 #define GrBezierEffect_DEFINED 9 #define GrBezierEffect_DEFINED
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 */ 56 */
57 class GrGLConicEffect; 57 class GrGLConicEffect;
58 58
59 class GrConicEffect : public GrGeometryProcessor { 59 class GrConicEffect : public GrGeometryProcessor {
60 public: 60 public:
61 static GrGeometryProcessor* Create(GrColor color, 61 static GrGeometryProcessor* Create(GrColor color,
62 const SkMatrix& viewMatrix, 62 const SkMatrix& viewMatrix,
63 const GrPrimitiveEdgeType edgeType, 63 const GrPrimitiveEdgeType edgeType,
64 const GrDrawTargetCaps& caps, 64 const GrDrawTargetCaps& caps,
65 const SkMatrix& localMatrix, 65 const SkMatrix& localMatrix,
66 bool usesLocalCoords,
66 uint8_t coverage = 0xff) { 67 uint8_t coverage = 0xff) {
67 switch (edgeType) { 68 switch (edgeType) {
68 case kFillAA_GrProcessorEdgeType: 69 case kFillAA_GrProcessorEdgeType:
69 if (!caps.shaderCaps()->shaderDerivativeSupport()) { 70 if (!caps.shaderCaps()->shaderDerivativeSupport()) {
70 return NULL; 71 return NULL;
71 } 72 }
72 return SkNEW_ARGS(GrConicEffect, (color, viewMatrix, coverage, 73 return SkNEW_ARGS(GrConicEffect, (color, viewMatrix, coverage,
73 kFillAA_GrProcessorEdgeType, 74 kFillAA_GrProcessorEdgeType,
74 localMatrix)); 75 localMatrix, usesLocalCoords)) ;
75 case kHairlineAA_GrProcessorEdgeType: 76 case kHairlineAA_GrProcessorEdgeType:
76 if (!caps.shaderCaps()->shaderDerivativeSupport()) { 77 if (!caps.shaderCaps()->shaderDerivativeSupport()) {
77 return NULL; 78 return NULL;
78 } 79 }
79 return SkNEW_ARGS(GrConicEffect, (color, viewMatrix, coverage, 80 return SkNEW_ARGS(GrConicEffect, (color, viewMatrix, coverage,
80 kHairlineAA_GrProcessorEdgeTyp e, 81 kHairlineAA_GrProcessorEdgeTyp e,
81 localMatrix)); 82 localMatrix, usesLocalCoords)) ;
82 case kFillBW_GrProcessorEdgeType: 83 case kFillBW_GrProcessorEdgeType:
83 return SkNEW_ARGS(GrConicEffect, (color, viewMatrix, coverage, 84 return SkNEW_ARGS(GrConicEffect, (color, viewMatrix, coverage,
84 kFillBW_GrProcessorEdgeType, 85 kFillBW_GrProcessorEdgeType,
85 localMatrix)); 86 localMatrix, usesLocalCoords)) ;
86 default: 87 default:
87 return NULL; 88 return NULL;
88 } 89 }
89 } 90 }
90 91
91 virtual ~GrConicEffect(); 92 virtual ~GrConicEffect();
92 93
93 const char* name() const override { return "Conic"; } 94 const char* name() const override { return "Conic"; }
94 95
95 inline const Attribute* inPosition() const { return fInPosition; } 96 inline const Attribute* inPosition() const { return fInPosition; }
96 inline const Attribute* inConicCoeffs() const { return fInConicCoeffs; } 97 inline const Attribute* inConicCoeffs() const { return fInConicCoeffs; }
97 inline bool isAntiAliased() const { return GrProcessorEdgeTypeIsAA(fEdgeType ); } 98 inline bool isAntiAliased() const { return GrProcessorEdgeTypeIsAA(fEdgeType ); }
98 inline bool isFilled() const { return GrProcessorEdgeTypeIsFill(fEdgeType); } 99 inline bool isFilled() const { return GrProcessorEdgeTypeIsFill(fEdgeType); }
99 inline GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } 100 inline GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
100 GrColor color() const { return fColor; } 101 GrColor color() const { return fColor; }
102 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; }
101 const SkMatrix& viewMatrix() const { return fViewMatrix; } 103 const SkMatrix& viewMatrix() const { return fViewMatrix; }
102 const SkMatrix& localMatrix() const { return fLocalMatrix; } 104 const SkMatrix& localMatrix() const { return fLocalMatrix; }
105 bool usesLocalCoords() const { return fUsesLocalCoords; }
106 uint8_t coverageScale() const { return fCoverageScale; }
103 107
104 virtual void getGLProcessorKey(const GrBatchTracker& bt, 108 virtual void getGLProcessorKey(const GrBatchTracker& bt,
105 const GrGLSLCaps& caps, 109 const GrGLSLCaps& caps,
106 GrProcessorKeyBuilder* b) const override; 110 GrProcessorKeyBuilder* b) const override;
107 111
108 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, 112 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
109 const GrGLSLCaps&) const ov erride; 113 const GrGLSLCaps&) const ov erride;
110 114
111 void initBatchTracker(GrBatchTracker*, const GrPipelineInfo&) const override ;
112
113 private: 115 private:
114 GrConicEffect(GrColor, const SkMatrix& viewMatrix, uint8_t coverage, GrPrimi tiveEdgeType, 116 GrConicEffect(GrColor, const SkMatrix& viewMatrix, uint8_t coverage, GrPrimi tiveEdgeType,
115 const SkMatrix& localMatrix); 117 const SkMatrix& localMatrix, bool usesLocalCoords);
116 118
117 GrColor fColor; 119 GrColor fColor;
118 SkMatrix fViewMatrix; 120 SkMatrix fViewMatrix;
119 SkMatrix fLocalMatrix; 121 SkMatrix fLocalMatrix;
122 bool fUsesLocalCoords;
120 uint8_t fCoverageScale; 123 uint8_t fCoverageScale;
121 GrPrimitiveEdgeType fEdgeType; 124 GrPrimitiveEdgeType fEdgeType;
122 const Attribute* fInPosition; 125 const Attribute* fInPosition;
123 const Attribute* fInConicCoeffs; 126 const Attribute* fInConicCoeffs;
124 127
125 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; 128 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
126 129
127 typedef GrGeometryProcessor INHERITED; 130 typedef GrGeometryProcessor INHERITED;
128 }; 131 };
129 132
130 /////////////////////////////////////////////////////////////////////////////// 133 ///////////////////////////////////////////////////////////////////////////////
131 /** 134 /**
132 * The output of this effect is a hairline edge for quadratics. 135 * The output of this effect is a hairline edge for quadratics.
133 * Quadratic specified by 0=u^2-v canonical coords. u and v are the first 136 * Quadratic specified by 0=u^2-v canonical coords. u and v are the first
134 * two components of the vertex attribute. At the three control points that defi ne 137 * two components of the vertex attribute. At the three control points that defi ne
135 * the Quadratic, u, v have the values {0,0}, {1/2, 0}, and {1, 1} respectively. 138 * the Quadratic, u, v have the values {0,0}, {1/2, 0}, and {1, 1} respectively.
136 * Coverage for AA is min(0, 1-distance). 3rd & 4th cimponent unused. 139 * Coverage for AA is min(0, 1-distance). 3rd & 4th cimponent unused.
137 * Requires shader derivative instruction support. 140 * Requires shader derivative instruction support.
138 */ 141 */
139 class GrGLQuadEffect; 142 class GrGLQuadEffect;
140 143
141 class GrQuadEffect : public GrGeometryProcessor { 144 class GrQuadEffect : public GrGeometryProcessor {
142 public: 145 public:
143 static GrGeometryProcessor* Create(GrColor color, 146 static GrGeometryProcessor* Create(GrColor color,
144 const SkMatrix& viewMatrix, 147 const SkMatrix& viewMatrix,
145 const GrPrimitiveEdgeType edgeType, 148 const GrPrimitiveEdgeType edgeType,
146 const GrDrawTargetCaps& caps, 149 const GrDrawTargetCaps& caps,
147 const SkMatrix& localMatrix, 150 const SkMatrix& localMatrix,
151 bool usesLocalCoords,
148 uint8_t coverage = 0xff) { 152 uint8_t coverage = 0xff) {
149 switch (edgeType) { 153 switch (edgeType) {
150 case kFillAA_GrProcessorEdgeType: 154 case kFillAA_GrProcessorEdgeType:
151 if (!caps.shaderCaps()->shaderDerivativeSupport()) { 155 if (!caps.shaderCaps()->shaderDerivativeSupport()) {
152 return NULL; 156 return NULL;
153 } 157 }
154 return SkNEW_ARGS(GrQuadEffect, (color, viewMatrix, coverage, 158 return SkNEW_ARGS(GrQuadEffect, (color, viewMatrix, coverage,
155 kFillAA_GrProcessorEdgeType, 159 kFillAA_GrProcessorEdgeType,
156 localMatrix)); 160 localMatrix, usesLocalCoords));
157 case kHairlineAA_GrProcessorEdgeType: 161 case kHairlineAA_GrProcessorEdgeType:
158 if (!caps.shaderCaps()->shaderDerivativeSupport()) { 162 if (!caps.shaderCaps()->shaderDerivativeSupport()) {
159 return NULL; 163 return NULL;
160 } 164 }
161 return SkNEW_ARGS(GrQuadEffect, (color, viewMatrix, coverage, 165 return SkNEW_ARGS(GrQuadEffect, (color, viewMatrix, coverage,
162 kHairlineAA_GrProcessorEdgeType , 166 kHairlineAA_GrProcessorEdgeType ,
163 localMatrix)); 167 localMatrix, usesLocalCoords));
164 case kFillBW_GrProcessorEdgeType: 168 case kFillBW_GrProcessorEdgeType:
165 return SkNEW_ARGS(GrQuadEffect, (color, viewMatrix, coverage, 169 return SkNEW_ARGS(GrQuadEffect, (color, viewMatrix, coverage,
166 kFillBW_GrProcessorEdgeType, 170 kFillBW_GrProcessorEdgeType,
167 localMatrix)); 171 localMatrix, usesLocalCoords));
168 default: 172 default:
169 return NULL; 173 return NULL;
170 } 174 }
171 } 175 }
172 176
173 virtual ~GrQuadEffect(); 177 virtual ~GrQuadEffect();
174 178
175 const char* name() const override { return "Quad"; } 179 const char* name() const override { return "Quad"; }
176 180
177 inline const Attribute* inPosition() const { return fInPosition; } 181 inline const Attribute* inPosition() const { return fInPosition; }
178 inline const Attribute* inHairQuadEdge() const { return fInHairQuadEdge; } 182 inline const Attribute* inHairQuadEdge() const { return fInHairQuadEdge; }
179 inline bool isAntiAliased() const { return GrProcessorEdgeTypeIsAA(fEdgeType ); } 183 inline bool isAntiAliased() const { return GrProcessorEdgeTypeIsAA(fEdgeType ); }
180 inline bool isFilled() const { return GrProcessorEdgeTypeIsFill(fEdgeType); } 184 inline bool isFilled() const { return GrProcessorEdgeTypeIsFill(fEdgeType); }
181 inline GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } 185 inline GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
182 GrColor color() const { return fColor; } 186 GrColor color() const { return fColor; }
187 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; }
183 const SkMatrix& viewMatrix() const { return fViewMatrix; } 188 const SkMatrix& viewMatrix() const { return fViewMatrix; }
184 const SkMatrix& localMatrix() const { return fLocalMatrix; } 189 const SkMatrix& localMatrix() const { return fLocalMatrix; }
190 bool usesLocalCoords() const { return fUsesLocalCoords; }
191 uint8_t coverageScale() const { return fCoverageScale; }
185 192
186 virtual void getGLProcessorKey(const GrBatchTracker& bt, 193 virtual void getGLProcessorKey(const GrBatchTracker& bt,
187 const GrGLSLCaps& caps, 194 const GrGLSLCaps& caps,
188 GrProcessorKeyBuilder* b) const override; 195 GrProcessorKeyBuilder* b) const override;
189 196
190 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, 197 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
191 const GrGLSLCaps&) const ov erride; 198 const GrGLSLCaps&) const ov erride;
192 199
193 void initBatchTracker(GrBatchTracker*, const GrPipelineInfo&) const override ;
194
195 private: 200 private:
196 GrQuadEffect(GrColor, const SkMatrix& viewMatrix, uint8_t coverage, GrPrimit iveEdgeType, 201 GrQuadEffect(GrColor, const SkMatrix& viewMatrix, uint8_t coverage, GrPrimit iveEdgeType,
197 const SkMatrix& localMatrix); 202 const SkMatrix& localMatrix, bool usesLocalCoords);
198 203
199 GrColor fColor; 204 GrColor fColor;
200 SkMatrix fViewMatrix; 205 SkMatrix fViewMatrix;
201 SkMatrix fLocalMatrix; 206 SkMatrix fLocalMatrix;
207 bool fUsesLocalCoords;
202 uint8_t fCoverageScale; 208 uint8_t fCoverageScale;
203 GrPrimitiveEdgeType fEdgeType; 209 GrPrimitiveEdgeType fEdgeType;
204 const Attribute* fInPosition; 210 const Attribute* fInPosition;
205 const Attribute* fInHairQuadEdge; 211 const Attribute* fInHairQuadEdge;
206 212
207 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; 213 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
208 214
209 typedef GrGeometryProcessor INHERITED; 215 typedef GrGeometryProcessor INHERITED;
210 }; 216 };
211 217
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 virtual ~GrCubicEffect(); 257 virtual ~GrCubicEffect();
252 258
253 const char* name() const override { return "Cubic"; } 259 const char* name() const override { return "Cubic"; }
254 260
255 inline const Attribute* inPosition() const { return fInPosition; } 261 inline const Attribute* inPosition() const { return fInPosition; }
256 inline const Attribute* inCubicCoeffs() const { return fInCubicCoeffs; } 262 inline const Attribute* inCubicCoeffs() const { return fInCubicCoeffs; }
257 inline bool isAntiAliased() const { return GrProcessorEdgeTypeIsAA(fEdgeType ); } 263 inline bool isAntiAliased() const { return GrProcessorEdgeTypeIsAA(fEdgeType ); }
258 inline bool isFilled() const { return GrProcessorEdgeTypeIsFill(fEdgeType); } 264 inline bool isFilled() const { return GrProcessorEdgeTypeIsFill(fEdgeType); }
259 inline GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } 265 inline GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
260 GrColor color() const { return fColor; } 266 GrColor color() const { return fColor; }
267 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; }
261 const SkMatrix& viewMatrix() const { return fViewMatrix; } 268 const SkMatrix& viewMatrix() const { return fViewMatrix; }
262 269
263 virtual void getGLProcessorKey(const GrBatchTracker& bt, 270 virtual void getGLProcessorKey(const GrBatchTracker& bt,
264 const GrGLSLCaps& caps, 271 const GrGLSLCaps& caps,
265 GrProcessorKeyBuilder* b) const override; 272 GrProcessorKeyBuilder* b) const override;
266 273
267 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, 274 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
268 const GrGLSLCaps&) const ov erride; 275 const GrGLSLCaps&) const ov erride;
269 276
270 void initBatchTracker(GrBatchTracker*, const GrPipelineInfo&) const override ;
271
272 private: 277 private:
273 GrCubicEffect(GrColor, const SkMatrix& viewMatrix, GrPrimitiveEdgeType); 278 GrCubicEffect(GrColor, const SkMatrix& viewMatrix, GrPrimitiveEdgeType);
274 279
275 GrColor fColor; 280 GrColor fColor;
276 SkMatrix fViewMatrix; 281 SkMatrix fViewMatrix;
277 GrPrimitiveEdgeType fEdgeType; 282 GrPrimitiveEdgeType fEdgeType;
278 const Attribute* fInPosition; 283 const Attribute* fInPosition;
279 const Attribute* fInCubicCoeffs; 284 const Attribute* fInCubicCoeffs;
280 285
281 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; 286 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
282 287
283 typedef GrGeometryProcessor INHERITED; 288 typedef GrGeometryProcessor INHERITED;
284 }; 289 };
285 290
286 #endif 291 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrTestBatch.h ('k') | src/gpu/effects/GrBezierEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698