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

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

Issue 1675833002: Switch to vertex colors rather than uniforms for color in Ellipse/Circle/RRect/DRRect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove unused variable to fix compile errors. Created 4 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
« no previous file with comments | « no previous file | no next file » | 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 #include "GrOvalRenderer.h" 8 #include "GrOvalRenderer.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 15 matching lines...) Expand all
26 #include "glsl/GrGLSLGeometryProcessor.h" 26 #include "glsl/GrGLSLGeometryProcessor.h"
27 #include "glsl/GrGLSLProgramDataManager.h" 27 #include "glsl/GrGLSLProgramDataManager.h"
28 #include "glsl/GrGLSLVarying.h" 28 #include "glsl/GrGLSLVarying.h"
29 #include "glsl/GrGLSLVertexShaderBuilder.h" 29 #include "glsl/GrGLSLVertexShaderBuilder.h"
30 #include "glsl/GrGLSLUniformHandler.h" 30 #include "glsl/GrGLSLUniformHandler.h"
31 #include "glsl/GrGLSLUtil.h" 31 #include "glsl/GrGLSLUtil.h"
32 32
33 // TODO(joshualitt) - Break this file up during GrBatch post implementation clea nup 33 // TODO(joshualitt) - Break this file up during GrBatch post implementation clea nup
34 34
35 namespace { 35 namespace {
36 // TODO(joshualitt) add per vertex colors 36
37 struct CircleVertex { 37 struct CircleVertex {
38 SkPoint fPos; 38 SkPoint fPos;
39 GrColor fColor;
39 SkPoint fOffset; 40 SkPoint fOffset;
40 SkScalar fOuterRadius; 41 SkScalar fOuterRadius;
41 SkScalar fInnerRadius; 42 SkScalar fInnerRadius;
42 }; 43 };
43 44
44 struct EllipseVertex { 45 struct EllipseVertex {
45 SkPoint fPos; 46 SkPoint fPos;
47 GrColor fColor;
46 SkPoint fOffset; 48 SkPoint fOffset;
47 SkPoint fOuterRadii; 49 SkPoint fOuterRadii;
48 SkPoint fInnerRadii; 50 SkPoint fInnerRadii;
49 }; 51 };
50 52
51 struct DIEllipseVertex { 53 struct DIEllipseVertex {
52 SkPoint fPos; 54 SkPoint fPos;
55 GrColor fColor;
53 SkPoint fOuterOffset; 56 SkPoint fOuterOffset;
54 SkPoint fInnerOffset; 57 SkPoint fInnerOffset;
55 }; 58 };
56 59
57 inline bool circle_stays_circle(const SkMatrix& m) { 60 inline bool circle_stays_circle(const SkMatrix& m) {
58 return m.isSimilarity(); 61 return m.isSimilarity();
59 } 62 }
60 63
61 } 64 }
62 65
(...skipping 11 matching lines...) Expand all
74 */ 77 */
75 78
76 class CircleEdgeEffect : public GrGeometryProcessor { 79 class CircleEdgeEffect : public GrGeometryProcessor {
77 public: 80 public:
78 static GrGeometryProcessor* Create(GrColor color, bool stroke, const SkMatri x& localMatrix, 81 static GrGeometryProcessor* Create(GrColor color, bool stroke, const SkMatri x& localMatrix,
79 bool usesLocalCoords) { 82 bool usesLocalCoords) {
80 return new CircleEdgeEffect(color, stroke, localMatrix, usesLocalCoords) ; 83 return new CircleEdgeEffect(color, stroke, localMatrix, usesLocalCoords) ;
81 } 84 }
82 85
83 const Attribute* inPosition() const { return fInPosition; } 86 const Attribute* inPosition() const { return fInPosition; }
87 const Attribute* inColor() const { return fInColor; }
84 const Attribute* inCircleEdge() const { return fInCircleEdge; } 88 const Attribute* inCircleEdge() const { return fInCircleEdge; }
85 GrColor color() const { return fColor; } 89 GrColor color() const { return fColor; }
86 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } 90 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; }
87 const SkMatrix& localMatrix() const { return fLocalMatrix; } 91 const SkMatrix& localMatrix() const { return fLocalMatrix; }
88 bool usesLocalCoords() const { return fUsesLocalCoords; } 92 bool usesLocalCoords() const { return fUsesLocalCoords; }
89 virtual ~CircleEdgeEffect() {} 93 virtual ~CircleEdgeEffect() {}
90 94
91 const char* name() const override { return "CircleEdge"; } 95 const char* name() const override { return "CircleEdge"; }
92 96
93 inline bool isStroked() const { return fStroke; } 97 inline bool isStroked() const { return fStroke; }
94 98
95 class GLSLProcessor : public GrGLSLGeometryProcessor { 99 class GLSLProcessor : public GrGLSLGeometryProcessor {
96 public: 100 public:
97 GLSLProcessor() 101 GLSLProcessor() {}
98 : fColor(GrColor_ILLEGAL) {}
99 102
100 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{ 103 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{
101 const CircleEdgeEffect& ce = args.fGP.cast<CircleEdgeEffect>(); 104 const CircleEdgeEffect& ce = args.fGP.cast<CircleEdgeEffect>();
102 GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder; 105 GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder;
103 GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler; 106 GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
104 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; 107 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
105 108
106 // emit attributes 109 // emit attributes
107 varyingHandler->emitAttributes(ce); 110 varyingHandler->emitAttributes(ce);
108 111
109 GrGLSLVertToFrag v(kVec4f_GrSLType); 112 GrGLSLVertToFrag v(kVec4f_GrSLType);
110 varyingHandler->addVarying("CircleEdge", &v); 113 varyingHandler->addVarying("CircleEdge", &v);
111 vertBuilder->codeAppendf("%s = %s;", v.vsOut(), ce.inCircleEdge()->f Name); 114 vertBuilder->codeAppendf("%s = %s;", v.vsOut(), ce.inCircleEdge()->f Name);
112 115
113 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; 116 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
114 // setup pass through color 117 // setup pass through color
115 if (!ce.colorIgnored()) { 118 if (!ce.colorIgnored()) {
116 this->setupUniformColor(fragBuilder, uniformHandler, args.fOutpu tColor, 119 varyingHandler->addPassThroughAttribute(ce.inColor(), args.fOutp utColor);
117 &fColorUniform);
118 } 120 }
119 121
120 // Setup position 122 // Setup position
121 this->setupPosition(vertBuilder, gpArgs, ce.inPosition()->fName); 123 this->setupPosition(vertBuilder, gpArgs, ce.inPosition()->fName);
122 124
123 // emit transforms 125 // emit transforms
124 this->emitTransforms(vertBuilder, 126 this->emitTransforms(vertBuilder,
125 varyingHandler, 127 varyingHandler,
126 uniformHandler, 128 uniformHandler,
127 gpArgs->fPositionVar, 129 gpArgs->fPositionVar,
(...skipping 19 matching lines...) Expand all
147 GrProcessorKeyBuilder* b) { 149 GrProcessorKeyBuilder* b) {
148 const CircleEdgeEffect& ce = gp.cast<CircleEdgeEffect>(); 150 const CircleEdgeEffect& ce = gp.cast<CircleEdgeEffect>();
149 uint16_t key = ce.isStroked() ? 0x1 : 0x0; 151 uint16_t key = ce.isStroked() ? 0x1 : 0x0;
150 key |= ce.usesLocalCoords() && ce.localMatrix().hasPerspective() ? 0 x2 : 0x0; 152 key |= ce.usesLocalCoords() && ce.localMatrix().hasPerspective() ? 0 x2 : 0x0;
151 key |= ce.colorIgnored() ? 0x4 : 0x0; 153 key |= ce.colorIgnored() ? 0x4 : 0x0;
152 b->add32(key); 154 b->add32(key);
153 } 155 }
154 156
155 void setData(const GrGLSLProgramDataManager& pdman, 157 void setData(const GrGLSLProgramDataManager& pdman,
156 const GrPrimitiveProcessor& gp) override { 158 const GrPrimitiveProcessor& gp) override {
157 const CircleEdgeEffect& ce = gp.cast<CircleEdgeEffect>();
158 if (ce.color() != fColor) {
159 float c[4];
160 GrColorToRGBAFloat(ce.color(), c);
161 pdman.set4fv(fColorUniform, 1, c);
162 fColor = ce.color();
163 }
164 } 159 }
165 160
166 void setTransformData(const GrPrimitiveProcessor& primProc, 161 void setTransformData(const GrPrimitiveProcessor& primProc,
167 const GrGLSLProgramDataManager& pdman, 162 const GrGLSLProgramDataManager& pdman,
168 int index, 163 int index,
169 const SkTArray<const GrCoordTransform*, true>& tra nsforms) override { 164 const SkTArray<const GrCoordTransform*, true>& tra nsforms) override {
170 this->setTransformDataHelper<CircleEdgeEffect>(primProc, pdman, inde x, transforms); 165 this->setTransformDataHelper<CircleEdgeEffect>(primProc, pdman, inde x, transforms);
171 } 166 }
172 167
173 private: 168 private:
174 GrColor fColor;
175 UniformHandle fColorUniform;
176 typedef GrGLSLGeometryProcessor INHERITED; 169 typedef GrGLSLGeometryProcessor INHERITED;
177 }; 170 };
178 171
179 void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override { 172 void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override {
180 GLSLProcessor::GenKey(*this, caps, b); 173 GLSLProcessor::GenKey(*this, caps, b);
181 } 174 }
182 175
183 GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const overri de { 176 GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const overri de {
184 return new GLSLProcessor(); 177 return new GLSLProcessor();
185 } 178 }
186 179
187 private: 180 private:
188 CircleEdgeEffect(GrColor color, bool stroke, const SkMatrix& localMatrix, bo ol usesLocalCoords) 181 CircleEdgeEffect(GrColor color, bool stroke, const SkMatrix& localMatrix, bo ol usesLocalCoords)
189 : fColor(color) 182 : fColor(color)
190 , fLocalMatrix(localMatrix) 183 , fLocalMatrix(localMatrix)
191 , fUsesLocalCoords(usesLocalCoords) { 184 , fUsesLocalCoords(usesLocalCoords) {
192 this->initClassID<CircleEdgeEffect>(); 185 this->initClassID<CircleEdgeEffect>();
193 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe rtexAttribType, 186 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe rtexAttribType,
194 kHigh_GrSLPrecision)); 187 kHigh_GrSLPrecision));
188 fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexA ttribType));
195 fInCircleEdge = &this->addVertexAttrib(Attribute("inCircleEdge", 189 fInCircleEdge = &this->addVertexAttrib(Attribute("inCircleEdge",
196 kVec4f_GrVertexAttrib Type)); 190 kVec4f_GrVertexAttrib Type));
197 fStroke = stroke; 191 fStroke = stroke;
198 } 192 }
199 193
200 GrColor fColor; 194 GrColor fColor;
201 SkMatrix fLocalMatrix; 195 SkMatrix fLocalMatrix;
202 const Attribute* fInPosition; 196 const Attribute* fInPosition;
197 const Attribute* fInColor;
203 const Attribute* fInCircleEdge; 198 const Attribute* fInCircleEdge;
204 bool fStroke; 199 bool fStroke;
205 bool fUsesLocalCoords; 200 bool fUsesLocalCoords;
206 201
207 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; 202 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
208 203
209 typedef GrGeometryProcessor INHERITED; 204 typedef GrGeometryProcessor INHERITED;
210 }; 205 };
211 206
212 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(CircleEdgeEffect); 207 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(CircleEdgeEffect);
(...skipping 20 matching lines...) Expand all
233 static GrGeometryProcessor* Create(GrColor color, bool stroke, const SkMatri x& localMatrix, 228 static GrGeometryProcessor* Create(GrColor color, bool stroke, const SkMatri x& localMatrix,
234 bool usesLocalCoords) { 229 bool usesLocalCoords) {
235 return new EllipseEdgeEffect(color, stroke, localMatrix, usesLocalCoords ); 230 return new EllipseEdgeEffect(color, stroke, localMatrix, usesLocalCoords );
236 } 231 }
237 232
238 virtual ~EllipseEdgeEffect() {} 233 virtual ~EllipseEdgeEffect() {}
239 234
240 const char* name() const override { return "EllipseEdge"; } 235 const char* name() const override { return "EllipseEdge"; }
241 236
242 const Attribute* inPosition() const { return fInPosition; } 237 const Attribute* inPosition() const { return fInPosition; }
238 const Attribute* inColor() const { return fInColor; }
243 const Attribute* inEllipseOffset() const { return fInEllipseOffset; } 239 const Attribute* inEllipseOffset() const { return fInEllipseOffset; }
244 const Attribute* inEllipseRadii() const { return fInEllipseRadii; } 240 const Attribute* inEllipseRadii() const { return fInEllipseRadii; }
245 GrColor color() const { return fColor; } 241 GrColor color() const { return fColor; }
246 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } 242 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; }
247 const SkMatrix& localMatrix() const { return fLocalMatrix; } 243 const SkMatrix& localMatrix() const { return fLocalMatrix; }
248 bool usesLocalCoords() const { return fUsesLocalCoords; } 244 bool usesLocalCoords() const { return fUsesLocalCoords; }
249 245
250 inline bool isStroked() const { return fStroke; } 246 inline bool isStroked() const { return fStroke; }
251 247
252 class GLSLProcessor : public GrGLSLGeometryProcessor { 248 class GLSLProcessor : public GrGLSLGeometryProcessor {
253 public: 249 public:
254 GLSLProcessor() 250 GLSLProcessor() {}
255 : fColor(GrColor_ILLEGAL) {}
256 251
257 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{ 252 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{
258 const EllipseEdgeEffect& ee = args.fGP.cast<EllipseEdgeEffect>(); 253 const EllipseEdgeEffect& ee = args.fGP.cast<EllipseEdgeEffect>();
259 GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder; 254 GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder;
260 GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler; 255 GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
261 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; 256 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
262 257
263 // emit attributes 258 // emit attributes
264 varyingHandler->emitAttributes(ee); 259 varyingHandler->emitAttributes(ee);
265 260
266 GrGLSLVertToFrag ellipseOffsets(kVec2f_GrSLType); 261 GrGLSLVertToFrag ellipseOffsets(kVec2f_GrSLType);
267 varyingHandler->addVarying("EllipseOffsets", &ellipseOffsets); 262 varyingHandler->addVarying("EllipseOffsets", &ellipseOffsets);
268 vertBuilder->codeAppendf("%s = %s;", ellipseOffsets.vsOut(), 263 vertBuilder->codeAppendf("%s = %s;", ellipseOffsets.vsOut(),
269 ee.inEllipseOffset()->fName); 264 ee.inEllipseOffset()->fName);
270 265
271 GrGLSLVertToFrag ellipseRadii(kVec4f_GrSLType); 266 GrGLSLVertToFrag ellipseRadii(kVec4f_GrSLType);
272 varyingHandler->addVarying("EllipseRadii", &ellipseRadii); 267 varyingHandler->addVarying("EllipseRadii", &ellipseRadii);
273 vertBuilder->codeAppendf("%s = %s;", ellipseRadii.vsOut(), 268 vertBuilder->codeAppendf("%s = %s;", ellipseRadii.vsOut(),
274 ee.inEllipseRadii()->fName); 269 ee.inEllipseRadii()->fName);
275 270
276 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; 271 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
277 // setup pass through color 272 // setup pass through color
278 if (!ee.colorIgnored()) { 273 if (!ee.colorIgnored()) {
279 this->setupUniformColor(fragBuilder, uniformHandler, args.fOutpu tColor, 274 varyingHandler->addPassThroughAttribute(ee.inColor(), args.fOutp utColor);
280 &fColorUniform);
281 } 275 }
282 276
283 // Setup position 277 // Setup position
284 this->setupPosition(vertBuilder, gpArgs, ee.inPosition()->fName); 278 this->setupPosition(vertBuilder, gpArgs, ee.inPosition()->fName);
285 279
286 // emit transforms 280 // emit transforms
287 this->emitTransforms(vertBuilder, 281 this->emitTransforms(vertBuilder,
288 varyingHandler, 282 varyingHandler,
289 uniformHandler, 283 uniformHandler,
290 gpArgs->fPositionVar, 284 gpArgs->fPositionVar,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 const GrGLSLCaps&, 317 const GrGLSLCaps&,
324 GrProcessorKeyBuilder* b) { 318 GrProcessorKeyBuilder* b) {
325 const EllipseEdgeEffect& ee = gp.cast<EllipseEdgeEffect>(); 319 const EllipseEdgeEffect& ee = gp.cast<EllipseEdgeEffect>();
326 uint16_t key = ee.isStroked() ? 0x1 : 0x0; 320 uint16_t key = ee.isStroked() ? 0x1 : 0x0;
327 key |= ee.usesLocalCoords() && ee.localMatrix().hasPerspective() ? 0 x2 : 0x0; 321 key |= ee.usesLocalCoords() && ee.localMatrix().hasPerspective() ? 0 x2 : 0x0;
328 key |= ee.colorIgnored() ? 0x4 : 0x0; 322 key |= ee.colorIgnored() ? 0x4 : 0x0;
329 b->add32(key); 323 b->add32(key);
330 } 324 }
331 325
332 void setData(const GrGLSLProgramDataManager& pdman, const GrPrimitivePro cessor& gp) override { 326 void setData(const GrGLSLProgramDataManager& pdman, const GrPrimitivePro cessor& gp) override {
333 const EllipseEdgeEffect& ee = gp.cast<EllipseEdgeEffect>();
334 if (ee.color() != fColor) {
335 float c[4];
336 GrColorToRGBAFloat(ee.color(), c);
337 pdman.set4fv(fColorUniform, 1, c);
338 fColor = ee.color();
339 }
340 } 327 }
341 328
342 void setTransformData(const GrPrimitiveProcessor& primProc, 329 void setTransformData(const GrPrimitiveProcessor& primProc,
343 const GrGLSLProgramDataManager& pdman, 330 const GrGLSLProgramDataManager& pdman,
344 int index, 331 int index,
345 const SkTArray<const GrCoordTransform*, true>& tra nsforms) override { 332 const SkTArray<const GrCoordTransform*, true>& tra nsforms) override {
346 this->setTransformDataHelper<EllipseEdgeEffect>(primProc, pdman, ind ex, transforms); 333 this->setTransformDataHelper<EllipseEdgeEffect>(primProc, pdman, ind ex, transforms);
347 } 334 }
348 335
349 private: 336 private:
350 GrColor fColor;
351 UniformHandle fColorUniform;
352
353 typedef GrGLSLGeometryProcessor INHERITED; 337 typedef GrGLSLGeometryProcessor INHERITED;
354 }; 338 };
355 339
356 void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override { 340 void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override {
357 GLSLProcessor::GenKey(*this, caps, b); 341 GLSLProcessor::GenKey(*this, caps, b);
358 } 342 }
359 343
360 GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const overri de { 344 GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const overri de {
361 return new GLSLProcessor(); 345 return new GLSLProcessor();
362 } 346 }
363 347
364 private: 348 private:
365 EllipseEdgeEffect(GrColor color, bool stroke, const SkMatrix& localMatrix, 349 EllipseEdgeEffect(GrColor color, bool stroke, const SkMatrix& localMatrix,
366 bool usesLocalCoords) 350 bool usesLocalCoords)
367 : fColor(color) 351 : fColor(color)
368 , fLocalMatrix(localMatrix) 352 , fLocalMatrix(localMatrix)
369 , fUsesLocalCoords(usesLocalCoords) { 353 , fUsesLocalCoords(usesLocalCoords) {
370 this->initClassID<EllipseEdgeEffect>(); 354 this->initClassID<EllipseEdgeEffect>();
371 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe rtexAttribType)); 355 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe rtexAttribType));
356 fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexA ttribType));
372 fInEllipseOffset = &this->addVertexAttrib(Attribute("inEllipseOffset", 357 fInEllipseOffset = &this->addVertexAttrib(Attribute("inEllipseOffset",
373 kVec2f_GrVertexAttri bType)); 358 kVec2f_GrVertexAttri bType));
374 fInEllipseRadii = &this->addVertexAttrib(Attribute("inEllipseRadii", 359 fInEllipseRadii = &this->addVertexAttrib(Attribute("inEllipseRadii",
375 kVec4f_GrVertexAttrib Type)); 360 kVec4f_GrVertexAttrib Type));
376 fStroke = stroke; 361 fStroke = stroke;
377 } 362 }
378 363
379 const Attribute* fInPosition; 364 const Attribute* fInPosition;
365 const Attribute* fInColor;
380 const Attribute* fInEllipseOffset; 366 const Attribute* fInEllipseOffset;
381 const Attribute* fInEllipseRadii; 367 const Attribute* fInEllipseRadii;
382 GrColor fColor; 368 GrColor fColor;
383 SkMatrix fLocalMatrix; 369 SkMatrix fLocalMatrix;
384 bool fStroke; 370 bool fStroke;
385 bool fUsesLocalCoords; 371 bool fUsesLocalCoords;
386 372
387 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; 373 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
388 374
389 typedef GrGeometryProcessor INHERITED; 375 typedef GrGeometryProcessor INHERITED;
(...skipping 26 matching lines...) Expand all
416 static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix , Mode mode, 402 static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix , Mode mode,
417 bool usesLocalCoords) { 403 bool usesLocalCoords) {
418 return new DIEllipseEdgeEffect(color, viewMatrix, mode, usesLocalCoords) ; 404 return new DIEllipseEdgeEffect(color, viewMatrix, mode, usesLocalCoords) ;
419 } 405 }
420 406
421 virtual ~DIEllipseEdgeEffect() {} 407 virtual ~DIEllipseEdgeEffect() {}
422 408
423 const char* name() const override { return "DIEllipseEdge"; } 409 const char* name() const override { return "DIEllipseEdge"; }
424 410
425 const Attribute* inPosition() const { return fInPosition; } 411 const Attribute* inPosition() const { return fInPosition; }
412 const Attribute* inColor() const { return fInColor; }
426 const Attribute* inEllipseOffsets0() const { return fInEllipseOffsets0; } 413 const Attribute* inEllipseOffsets0() const { return fInEllipseOffsets0; }
427 const Attribute* inEllipseOffsets1() const { return fInEllipseOffsets1; } 414 const Attribute* inEllipseOffsets1() const { return fInEllipseOffsets1; }
428 GrColor color() const { return fColor; } 415 GrColor color() const { return fColor; }
429 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } 416 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; }
430 const SkMatrix& viewMatrix() const { return fViewMatrix; } 417 const SkMatrix& viewMatrix() const { return fViewMatrix; }
431 bool usesLocalCoords() const { return fUsesLocalCoords; } 418 bool usesLocalCoords() const { return fUsesLocalCoords; }
432 419
433 inline Mode getMode() const { return fMode; } 420 inline Mode getMode() const { return fMode; }
434 421
435 class GLSLProcessor : public GrGLSLGeometryProcessor { 422 class GLSLProcessor : public GrGLSLGeometryProcessor {
436 public: 423 public:
437 GLSLProcessor() 424 GLSLProcessor()
438 : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL) {} 425 : fViewMatrix(SkMatrix::InvalidMatrix()) {}
439 426
440 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override { 427 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
441 const DIEllipseEdgeEffect& ee = args.fGP.cast<DIEllipseEdgeEffect>() ; 428 const DIEllipseEdgeEffect& ee = args.fGP.cast<DIEllipseEdgeEffect>() ;
442 GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder; 429 GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder;
443 GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler; 430 GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
444 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; 431 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
445 432
446 // emit attributes 433 // emit attributes
447 varyingHandler->emitAttributes(ee); 434 varyingHandler->emitAttributes(ee);
448 435
449 GrGLSLVertToFrag offsets0(kVec2f_GrSLType); 436 GrGLSLVertToFrag offsets0(kVec2f_GrSLType);
450 varyingHandler->addVarying("EllipseOffsets0", &offsets0); 437 varyingHandler->addVarying("EllipseOffsets0", &offsets0);
451 vertBuilder->codeAppendf("%s = %s;", offsets0.vsOut(), 438 vertBuilder->codeAppendf("%s = %s;", offsets0.vsOut(),
452 ee.inEllipseOffsets0()->fName); 439 ee.inEllipseOffsets0()->fName);
453 440
454 GrGLSLVertToFrag offsets1(kVec2f_GrSLType); 441 GrGLSLVertToFrag offsets1(kVec2f_GrSLType);
455 varyingHandler->addVarying("EllipseOffsets1", &offsets1); 442 varyingHandler->addVarying("EllipseOffsets1", &offsets1);
456 vertBuilder->codeAppendf("%s = %s;", offsets1.vsOut(), 443 vertBuilder->codeAppendf("%s = %s;", offsets1.vsOut(),
457 ee.inEllipseOffsets1()->fName); 444 ee.inEllipseOffsets1()->fName);
458 445
459 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; 446 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
460 // setup pass through color 447 // setup pass through color
461 if (!ee.colorIgnored()) { 448 if (!ee.colorIgnored()) {
462 this->setupUniformColor(fragBuilder, uniformHandler, args.fOutpu tColor, 449 varyingHandler->addPassThroughAttribute(ee.inColor(), args.fOutp utColor);
463 &fColorUniform);
464 } 450 }
465 451
466 // Setup position 452 // Setup position
467 this->setupPosition(vertBuilder, 453 this->setupPosition(vertBuilder,
468 uniformHandler, 454 uniformHandler,
469 gpArgs, 455 gpArgs,
470 ee.inPosition()->fName, 456 ee.inPosition()->fName,
471 ee.viewMatrix(), 457 ee.viewMatrix(),
472 &fViewMatrixUniform); 458 &fViewMatrixUniform);
473 459
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 void setData(const GrGLSLProgramDataManager& pdman, 519 void setData(const GrGLSLProgramDataManager& pdman,
534 const GrPrimitiveProcessor& gp) override { 520 const GrPrimitiveProcessor& gp) override {
535 const DIEllipseEdgeEffect& dee = gp.cast<DIEllipseEdgeEffect>(); 521 const DIEllipseEdgeEffect& dee = gp.cast<DIEllipseEdgeEffect>();
536 522
537 if (!dee.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dee. viewMatrix())) { 523 if (!dee.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dee. viewMatrix())) {
538 fViewMatrix = dee.viewMatrix(); 524 fViewMatrix = dee.viewMatrix();
539 float viewMatrix[3 * 3]; 525 float viewMatrix[3 * 3];
540 GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix); 526 GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix);
541 pdman.setMatrix3f(fViewMatrixUniform, viewMatrix); 527 pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
542 } 528 }
543
544 if (dee.color() != fColor) {
545 float c[4];
546 GrColorToRGBAFloat(dee.color(), c);
547 pdman.set4fv(fColorUniform, 1, c);
548 fColor = dee.color();
549 }
550 } 529 }
551 530
552 private: 531 private:
553 SkMatrix fViewMatrix; 532 SkMatrix fViewMatrix;
554 GrColor fColor;
555 UniformHandle fColorUniform;
556 UniformHandle fViewMatrixUniform; 533 UniformHandle fViewMatrixUniform;
557 534
558 typedef GrGLSLGeometryProcessor INHERITED; 535 typedef GrGLSLGeometryProcessor INHERITED;
559 }; 536 };
560 537
561 void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override { 538 void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override {
562 GLSLProcessor::GenKey(*this, caps, b); 539 GLSLProcessor::GenKey(*this, caps, b);
563 } 540 }
564 541
565 GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const overri de { 542 GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const overri de {
566 return new GLSLProcessor(); 543 return new GLSLProcessor();
567 } 544 }
568 545
569 private: 546 private:
570 DIEllipseEdgeEffect(GrColor color, const SkMatrix& viewMatrix, Mode mode, 547 DIEllipseEdgeEffect(GrColor color, const SkMatrix& viewMatrix, Mode mode,
571 bool usesLocalCoords) 548 bool usesLocalCoords)
572 : fColor(color) 549 : fColor(color)
573 , fViewMatrix(viewMatrix) 550 , fViewMatrix(viewMatrix)
574 , fUsesLocalCoords(usesLocalCoords) { 551 , fUsesLocalCoords(usesLocalCoords) {
575 this->initClassID<DIEllipseEdgeEffect>(); 552 this->initClassID<DIEllipseEdgeEffect>();
576 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe rtexAttribType, 553 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe rtexAttribType,
577 kHigh_GrSLPrecision)); 554 kHigh_GrSLPrecision));
555 fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexA ttribType));
578 fInEllipseOffsets0 = &this->addVertexAttrib(Attribute("inEllipseOffsets0 ", 556 fInEllipseOffsets0 = &this->addVertexAttrib(Attribute("inEllipseOffsets0 ",
579 kVec2f_GrVertexAtt ribType)); 557 kVec2f_GrVertexAtt ribType));
580 fInEllipseOffsets1 = &this->addVertexAttrib(Attribute("inEllipseOffsets1 ", 558 fInEllipseOffsets1 = &this->addVertexAttrib(Attribute("inEllipseOffsets1 ",
581 kVec2f_GrVertexAtt ribType)); 559 kVec2f_GrVertexAtt ribType));
582 fMode = mode; 560 fMode = mode;
583 } 561 }
584 562
585 const Attribute* fInPosition; 563 const Attribute* fInPosition;
564 const Attribute* fInColor;
586 const Attribute* fInEllipseOffsets0; 565 const Attribute* fInEllipseOffsets0;
587 const Attribute* fInEllipseOffsets1; 566 const Attribute* fInEllipseOffsets1;
588 GrColor fColor; 567 GrColor fColor;
589 SkMatrix fViewMatrix; 568 SkMatrix fViewMatrix;
590 Mode fMode; 569 Mode fMode;
591 bool fUsesLocalCoords; 570 bool fUsesLocalCoords;
592 571
593 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; 572 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
594 573
595 typedef GrGeometryProcessor INHERITED; 574 typedef GrGeometryProcessor INHERITED;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 QuadHelper helper; 694 QuadHelper helper;
716 CircleVertex* verts = reinterpret_cast<CircleVertex*>(helper.init(target , vertexStride, 695 CircleVertex* verts = reinterpret_cast<CircleVertex*>(helper.init(target , vertexStride,
717 instan ceCount)); 696 instan ceCount));
718 if (!verts) { 697 if (!verts) {
719 return; 698 return;
720 } 699 }
721 700
722 for (int i = 0; i < instanceCount; i++) { 701 for (int i = 0; i < instanceCount; i++) {
723 const Geometry& geom = fGeoData[i]; 702 const Geometry& geom = fGeoData[i];
724 703
704 GrColor color = geom.fColor;
725 SkScalar innerRadius = geom.fInnerRadius; 705 SkScalar innerRadius = geom.fInnerRadius;
726 SkScalar outerRadius = geom.fOuterRadius; 706 SkScalar outerRadius = geom.fOuterRadius;
727 707
728 const SkRect& bounds = geom.fDevBounds; 708 const SkRect& bounds = geom.fDevBounds;
729 709
730 // The inner radius in the vertex data must be specified in normaliz ed space. 710 // The inner radius in the vertex data must be specified in normaliz ed space.
731 innerRadius = innerRadius / outerRadius; 711 innerRadius = innerRadius / outerRadius;
732 verts[0].fPos = SkPoint::Make(bounds.fLeft, bounds.fTop); 712 verts[0].fPos = SkPoint::Make(bounds.fLeft, bounds.fTop);
713 verts[0].fColor = color;
733 verts[0].fOffset = SkPoint::Make(-1, -1); 714 verts[0].fOffset = SkPoint::Make(-1, -1);
734 verts[0].fOuterRadius = outerRadius; 715 verts[0].fOuterRadius = outerRadius;
735 verts[0].fInnerRadius = innerRadius; 716 verts[0].fInnerRadius = innerRadius;
736 717
737 verts[1].fPos = SkPoint::Make(bounds.fLeft, bounds.fBottom); 718 verts[1].fPos = SkPoint::Make(bounds.fLeft, bounds.fBottom);
719 verts[1].fColor = color;
738 verts[1].fOffset = SkPoint::Make(-1, 1); 720 verts[1].fOffset = SkPoint::Make(-1, 1);
739 verts[1].fOuterRadius = outerRadius; 721 verts[1].fOuterRadius = outerRadius;
740 verts[1].fInnerRadius = innerRadius; 722 verts[1].fInnerRadius = innerRadius;
741 723
742 verts[2].fPos = SkPoint::Make(bounds.fRight, bounds.fBottom); 724 verts[2].fPos = SkPoint::Make(bounds.fRight, bounds.fBottom);
725 verts[2].fColor = color;
743 verts[2].fOffset = SkPoint::Make(1, 1); 726 verts[2].fOffset = SkPoint::Make(1, 1);
744 verts[2].fOuterRadius = outerRadius; 727 verts[2].fOuterRadius = outerRadius;
745 verts[2].fInnerRadius = innerRadius; 728 verts[2].fInnerRadius = innerRadius;
746 729
747 verts[3].fPos = SkPoint::Make(bounds.fRight, bounds.fTop); 730 verts[3].fPos = SkPoint::Make(bounds.fRight, bounds.fTop);
731 verts[3].fColor = color;
748 verts[3].fOffset = SkPoint::Make(1, -1); 732 verts[3].fOffset = SkPoint::Make(1, -1);
749 verts[3].fOuterRadius = outerRadius; 733 verts[3].fOuterRadius = outerRadius;
750 verts[3].fInnerRadius = innerRadius; 734 verts[3].fInnerRadius = innerRadius;
751 735
752 verts += kVerticesPerQuad; 736 verts += kVerticesPerQuad;
753 } 737 }
754 helper.recordDraw(target); 738 helper.recordDraw(target);
755 } 739 }
756 740
757 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } 741 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
758 742
759 CircleBatch(const Geometry& geometry) : INHERITED(ClassID()) { 743 CircleBatch(const Geometry& geometry) : INHERITED(ClassID()) {
760 fGeoData.push_back(geometry); 744 fGeoData.push_back(geometry);
761 745
762 this->setBounds(geometry.fDevBounds); 746 this->setBounds(geometry.fDevBounds);
763 } 747 }
764 748
765 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { 749 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
766 CircleBatch* that = t->cast<CircleBatch>(); 750 CircleBatch* that = t->cast<CircleBatch>();
767 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi peline(), 751 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi peline(),
768 that->bounds(), caps)) { 752 that->bounds(), caps)) {
769 return false; 753 return false;
770 } 754 }
771 755
772 // TODO use vertex color to avoid breaking batches
773 if (this->color() != that->color()) {
774 return false;
775 }
776
777 if (this->stroke() != that->stroke()) { 756 if (this->stroke() != that->stroke()) {
778 return false; 757 return false;
779 } 758 }
780 759
781 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); 760 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords());
782 if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->vi ewMatrix())) { 761 if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->vi ewMatrix())) {
783 return false; 762 return false;
784 } 763 }
785 764
786 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin()) ; 765 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin()) ;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 SkASSERT(vertexStride == sizeof(EllipseVertex)); 913 SkASSERT(vertexStride == sizeof(EllipseVertex));
935 EllipseVertex* verts = reinterpret_cast<EllipseVertex*>( 914 EllipseVertex* verts = reinterpret_cast<EllipseVertex*>(
936 helper.init(target, vertexStride, instanceCount)); 915 helper.init(target, vertexStride, instanceCount));
937 if (!verts) { 916 if (!verts) {
938 return; 917 return;
939 } 918 }
940 919
941 for (int i = 0; i < instanceCount; i++) { 920 for (int i = 0; i < instanceCount; i++) {
942 const Geometry& geom = fGeoData[i]; 921 const Geometry& geom = fGeoData[i];
943 922
923 GrColor color = geom.fColor;
944 SkScalar xRadius = geom.fXRadius; 924 SkScalar xRadius = geom.fXRadius;
945 SkScalar yRadius = geom.fYRadius; 925 SkScalar yRadius = geom.fYRadius;
946 926
947 // Compute the reciprocals of the radii here to save time in the sha der 927 // Compute the reciprocals of the radii here to save time in the sha der
948 SkScalar xRadRecip = SkScalarInvert(xRadius); 928 SkScalar xRadRecip = SkScalarInvert(xRadius);
949 SkScalar yRadRecip = SkScalarInvert(yRadius); 929 SkScalar yRadRecip = SkScalarInvert(yRadius);
950 SkScalar xInnerRadRecip = SkScalarInvert(geom.fInnerXRadius); 930 SkScalar xInnerRadRecip = SkScalarInvert(geom.fInnerXRadius);
951 SkScalar yInnerRadRecip = SkScalarInvert(geom.fInnerYRadius); 931 SkScalar yInnerRadRecip = SkScalarInvert(geom.fInnerYRadius);
952 932
953 const SkRect& bounds = geom.fDevBounds; 933 const SkRect& bounds = geom.fDevBounds;
954 934
955 // The inner radius in the vertex data must be specified in normaliz ed space. 935 // The inner radius in the vertex data must be specified in normaliz ed space.
956 verts[0].fPos = SkPoint::Make(bounds.fLeft, bounds.fTop); 936 verts[0].fPos = SkPoint::Make(bounds.fLeft, bounds.fTop);
937 verts[0].fColor = color;
957 verts[0].fOffset = SkPoint::Make(-xRadius, -yRadius); 938 verts[0].fOffset = SkPoint::Make(-xRadius, -yRadius);
958 verts[0].fOuterRadii = SkPoint::Make(xRadRecip, yRadRecip); 939 verts[0].fOuterRadii = SkPoint::Make(xRadRecip, yRadRecip);
959 verts[0].fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadRecip) ; 940 verts[0].fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadRecip) ;
960 941
961 verts[1].fPos = SkPoint::Make(bounds.fLeft, bounds.fBottom); 942 verts[1].fPos = SkPoint::Make(bounds.fLeft, bounds.fBottom);
943 verts[1].fColor = color;
962 verts[1].fOffset = SkPoint::Make(-xRadius, yRadius); 944 verts[1].fOffset = SkPoint::Make(-xRadius, yRadius);
963 verts[1].fOuterRadii = SkPoint::Make(xRadRecip, yRadRecip); 945 verts[1].fOuterRadii = SkPoint::Make(xRadRecip, yRadRecip);
964 verts[1].fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadRecip) ; 946 verts[1].fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadRecip) ;
965 947
966 verts[2].fPos = SkPoint::Make(bounds.fRight, bounds.fBottom); 948 verts[2].fPos = SkPoint::Make(bounds.fRight, bounds.fBottom);
949 verts[2].fColor = color;
967 verts[2].fOffset = SkPoint::Make(xRadius, yRadius); 950 verts[2].fOffset = SkPoint::Make(xRadius, yRadius);
968 verts[2].fOuterRadii = SkPoint::Make(xRadRecip, yRadRecip); 951 verts[2].fOuterRadii = SkPoint::Make(xRadRecip, yRadRecip);
969 verts[2].fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadRecip) ; 952 verts[2].fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadRecip) ;
970 953
971 verts[3].fPos = SkPoint::Make(bounds.fRight, bounds.fTop); 954 verts[3].fPos = SkPoint::Make(bounds.fRight, bounds.fTop);
955 verts[3].fColor = color;
972 verts[3].fOffset = SkPoint::Make(xRadius, -yRadius); 956 verts[3].fOffset = SkPoint::Make(xRadius, -yRadius);
973 verts[3].fOuterRadii = SkPoint::Make(xRadRecip, yRadRecip); 957 verts[3].fOuterRadii = SkPoint::Make(xRadRecip, yRadRecip);
974 verts[3].fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadRecip) ; 958 verts[3].fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadRecip) ;
975 959
976 verts += kVerticesPerQuad; 960 verts += kVerticesPerQuad;
977 } 961 }
978 helper.recordDraw(target); 962 helper.recordDraw(target);
979 } 963 }
980 964
981 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } 965 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
982 966
983 EllipseBatch(const Geometry& geometry) : INHERITED(ClassID()) { 967 EllipseBatch(const Geometry& geometry) : INHERITED(ClassID()) {
984 fGeoData.push_back(geometry); 968 fGeoData.push_back(geometry);
985 969
986 this->setBounds(geometry.fDevBounds); 970 this->setBounds(geometry.fDevBounds);
987 } 971 }
988 972
989 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { 973 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
990 EllipseBatch* that = t->cast<EllipseBatch>(); 974 EllipseBatch* that = t->cast<EllipseBatch>();
991 975
992 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi peline(), 976 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi peline(),
993 that->bounds(), caps)) { 977 that->bounds(), caps)) {
994 return false; 978 return false;
995 } 979 }
996 980
997 // TODO use vertex color to avoid breaking batches
998 if (this->color() != that->color()) {
999 return false;
1000 }
1001
1002 if (this->stroke() != that->stroke()) { 981 if (this->stroke() != that->stroke()) {
1003 return false; 982 return false;
1004 } 983 }
1005 984
1006 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); 985 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords());
1007 if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->vi ewMatrix())) { 986 if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->vi ewMatrix())) {
1008 return false; 987 return false;
1009 } 988 }
1010 989
1011 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin()) ; 990 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin()) ;
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 QuadHelper helper; 1180 QuadHelper helper;
1202 DIEllipseVertex* verts = reinterpret_cast<DIEllipseVertex*>( 1181 DIEllipseVertex* verts = reinterpret_cast<DIEllipseVertex*>(
1203 helper.init(target, vertexStride, instanceCount)); 1182 helper.init(target, vertexStride, instanceCount));
1204 if (!verts) { 1183 if (!verts) {
1205 return; 1184 return;
1206 } 1185 }
1207 1186
1208 for (int i = 0; i < instanceCount; i++) { 1187 for (int i = 0; i < instanceCount; i++) {
1209 const Geometry& geom = fGeoData[i]; 1188 const Geometry& geom = fGeoData[i];
1210 1189
1190 GrColor color = geom.fColor;
1211 SkScalar xRadius = geom.fXRadius; 1191 SkScalar xRadius = geom.fXRadius;
1212 SkScalar yRadius = geom.fYRadius; 1192 SkScalar yRadius = geom.fYRadius;
1213 1193
1214 const SkRect& bounds = geom.fBounds; 1194 const SkRect& bounds = geom.fBounds;
1215 1195
1216 // This adjusts the "radius" to include the half-pixel border 1196 // This adjusts the "radius" to include the half-pixel border
1217 SkScalar offsetDx = geom.fGeoDx / xRadius; 1197 SkScalar offsetDx = geom.fGeoDx / xRadius;
1218 SkScalar offsetDy = geom.fGeoDy / yRadius; 1198 SkScalar offsetDy = geom.fGeoDy / yRadius;
1219 1199
1220 SkScalar innerRatioX = xRadius / geom.fInnerXRadius; 1200 SkScalar innerRatioX = xRadius / geom.fInnerXRadius;
1221 SkScalar innerRatioY = yRadius / geom.fInnerYRadius; 1201 SkScalar innerRatioY = yRadius / geom.fInnerYRadius;
1222 1202
1223 verts[0].fPos = SkPoint::Make(bounds.fLeft, bounds.fTop); 1203 verts[0].fPos = SkPoint::Make(bounds.fLeft, bounds.fTop);
1204 verts[0].fColor = color;
1224 verts[0].fOuterOffset = SkPoint::Make(-1.0f - offsetDx, -1.0f - offs etDy); 1205 verts[0].fOuterOffset = SkPoint::Make(-1.0f - offsetDx, -1.0f - offs etDy);
1225 verts[0].fInnerOffset = SkPoint::Make(-innerRatioX - offsetDx, -inne rRatioY - offsetDy); 1206 verts[0].fInnerOffset = SkPoint::Make(-innerRatioX - offsetDx, -inne rRatioY - offsetDy);
1226 1207
1227 verts[1].fPos = SkPoint::Make(bounds.fLeft, bounds.fBottom); 1208 verts[1].fPos = SkPoint::Make(bounds.fLeft, bounds.fBottom);
1209 verts[1].fColor = color;
1228 verts[1].fOuterOffset = SkPoint::Make(-1.0f - offsetDx, 1.0f + offse tDy); 1210 verts[1].fOuterOffset = SkPoint::Make(-1.0f - offsetDx, 1.0f + offse tDy);
1229 verts[1].fInnerOffset = SkPoint::Make(-innerRatioX - offsetDx, inner RatioY + offsetDy); 1211 verts[1].fInnerOffset = SkPoint::Make(-innerRatioX - offsetDx, inner RatioY + offsetDy);
1230 1212
1231 verts[2].fPos = SkPoint::Make(bounds.fRight, bounds.fBottom); 1213 verts[2].fPos = SkPoint::Make(bounds.fRight, bounds.fBottom);
1214 verts[2].fColor = color;
1232 verts[2].fOuterOffset = SkPoint::Make(1.0f + offsetDx, 1.0f + offset Dy); 1215 verts[2].fOuterOffset = SkPoint::Make(1.0f + offsetDx, 1.0f + offset Dy);
1233 verts[2].fInnerOffset = SkPoint::Make(innerRatioX + offsetDx, innerR atioY + offsetDy); 1216 verts[2].fInnerOffset = SkPoint::Make(innerRatioX + offsetDx, innerR atioY + offsetDy);
1234 1217
1235 verts[3].fPos = SkPoint::Make(bounds.fRight, bounds.fTop); 1218 verts[3].fPos = SkPoint::Make(bounds.fRight, bounds.fTop);
1219 verts[3].fColor = color;
1236 verts[3].fOuterOffset = SkPoint::Make(1.0f + offsetDx, -1.0f - offse tDy); 1220 verts[3].fOuterOffset = SkPoint::Make(1.0f + offsetDx, -1.0f - offse tDy);
1237 verts[3].fInnerOffset = SkPoint::Make(innerRatioX + offsetDx, -inner RatioY - offsetDy); 1221 verts[3].fInnerOffset = SkPoint::Make(innerRatioX + offsetDx, -inner RatioY - offsetDy);
1238 1222
1239 verts += kVerticesPerQuad; 1223 verts += kVerticesPerQuad;
1240 } 1224 }
1241 helper.recordDraw(target); 1225 helper.recordDraw(target);
1242 } 1226 }
1243 1227
1244 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } 1228 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
1245 1229
1246 DIEllipseBatch(const Geometry& geometry, const SkRect& bounds) : INHERITED(C lassID()) { 1230 DIEllipseBatch(const Geometry& geometry, const SkRect& bounds) : INHERITED(C lassID()) {
1247 fGeoData.push_back(geometry); 1231 fGeoData.push_back(geometry);
1248 1232
1249 this->setBounds(bounds); 1233 this->setBounds(bounds);
1250 } 1234 }
1251 1235
1252 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { 1236 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
1253 DIEllipseBatch* that = t->cast<DIEllipseBatch>(); 1237 DIEllipseBatch* that = t->cast<DIEllipseBatch>();
1254 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi peline(), 1238 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi peline(),
1255 that->bounds(), caps)) { 1239 that->bounds(), caps)) {
1256 return false; 1240 return false;
1257 } 1241 }
1258 1242
1259 // TODO use vertex color to avoid breaking batches
1260 if (this->color() != that->color()) {
1261 return false;
1262 }
1263
1264 if (this->mode() != that->mode()) { 1243 if (this->mode() != that->mode()) {
1265 return false; 1244 return false;
1266 } 1245 }
1267 1246
1268 // TODO rewrite to allow positioning on CPU 1247 // TODO rewrite to allow positioning on CPU
1269 if (!this->viewMatrix().cheapEqualTo(that->viewMatrix())) { 1248 if (!this->viewMatrix().cheapEqualTo(that->viewMatrix())) {
1270 return false; 1249 return false;
1271 } 1250 }
1272 1251
1273 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin()) ; 1252 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin()) ;
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1572 kTriangles_GrPrimitiveType, vertexStride, indexBuffer, kVertsPerRRec t, 1551 kTriangles_GrPrimitiveType, vertexStride, indexBuffer, kVertsPerRRec t,
1573 indicesPerInstance, instanceCount)); 1552 indicesPerInstance, instanceCount));
1574 if (!verts || !indexBuffer) { 1553 if (!verts || !indexBuffer) {
1575 SkDebugf("Could not allocate vertices\n"); 1554 SkDebugf("Could not allocate vertices\n");
1576 return; 1555 return;
1577 } 1556 }
1578 1557
1579 for (int i = 0; i < instanceCount; i++) { 1558 for (int i = 0; i < instanceCount; i++) {
1580 const Geometry& args = fGeoData[i]; 1559 const Geometry& args = fGeoData[i];
1581 1560
1561 GrColor color = args.fColor;
1582 SkScalar outerRadius = args.fOuterRadius; 1562 SkScalar outerRadius = args.fOuterRadius;
1583 1563
1584 const SkRect& bounds = args.fDevBounds; 1564 const SkRect& bounds = args.fDevBounds;
1585 1565
1586 SkScalar yCoords[4] = { 1566 SkScalar yCoords[4] = {
1587 bounds.fTop, 1567 bounds.fTop,
1588 bounds.fTop + outerRadius, 1568 bounds.fTop + outerRadius,
1589 bounds.fBottom - outerRadius, 1569 bounds.fBottom - outerRadius,
1590 bounds.fBottom 1570 bounds.fBottom
1591 }; 1571 };
1592 1572
1593 SkScalar yOuterRadii[4] = {-1, 0, 0, 1 }; 1573 SkScalar yOuterRadii[4] = {-1, 0, 0, 1 };
1594 // The inner radius in the vertex data must be specified in normaliz ed space. 1574 // The inner radius in the vertex data must be specified in normaliz ed space.
1595 SkScalar innerRadius = args.fInnerRadius / args.fOuterRadius; 1575 SkScalar innerRadius = args.fInnerRadius / args.fOuterRadius;
1596 for (int i = 0; i < 4; ++i) { 1576 for (int i = 0; i < 4; ++i) {
1597 verts->fPos = SkPoint::Make(bounds.fLeft, yCoords[i]); 1577 verts->fPos = SkPoint::Make(bounds.fLeft, yCoords[i]);
1578 verts->fColor = color;
1598 verts->fOffset = SkPoint::Make(-1, yOuterRadii[i]); 1579 verts->fOffset = SkPoint::Make(-1, yOuterRadii[i]);
1599 verts->fOuterRadius = outerRadius; 1580 verts->fOuterRadius = outerRadius;
1600 verts->fInnerRadius = innerRadius; 1581 verts->fInnerRadius = innerRadius;
1601 verts++; 1582 verts++;
1602 1583
1603 verts->fPos = SkPoint::Make(bounds.fLeft + outerRadius, yCoords[ i]); 1584 verts->fPos = SkPoint::Make(bounds.fLeft + outerRadius, yCoords[ i]);
1585 verts->fColor = color;
1604 verts->fOffset = SkPoint::Make(0, yOuterRadii[i]); 1586 verts->fOffset = SkPoint::Make(0, yOuterRadii[i]);
1605 verts->fOuterRadius = outerRadius; 1587 verts->fOuterRadius = outerRadius;
1606 verts->fInnerRadius = innerRadius; 1588 verts->fInnerRadius = innerRadius;
1607 verts++; 1589 verts++;
1608 1590
1609 verts->fPos = SkPoint::Make(bounds.fRight - outerRadius, yCoords [i]); 1591 verts->fPos = SkPoint::Make(bounds.fRight - outerRadius, yCoords [i]);
1592 verts->fColor = color;
1610 verts->fOffset = SkPoint::Make(0, yOuterRadii[i]); 1593 verts->fOffset = SkPoint::Make(0, yOuterRadii[i]);
1611 verts->fOuterRadius = outerRadius; 1594 verts->fOuterRadius = outerRadius;
1612 verts->fInnerRadius = innerRadius; 1595 verts->fInnerRadius = innerRadius;
1613 verts++; 1596 verts++;
1614 1597
1615 verts->fPos = SkPoint::Make(bounds.fRight, yCoords[i]); 1598 verts->fPos = SkPoint::Make(bounds.fRight, yCoords[i]);
1599 verts->fColor = color;
1616 verts->fOffset = SkPoint::Make(1, yOuterRadii[i]); 1600 verts->fOffset = SkPoint::Make(1, yOuterRadii[i]);
1617 verts->fOuterRadius = outerRadius; 1601 verts->fOuterRadius = outerRadius;
1618 verts->fInnerRadius = innerRadius; 1602 verts->fInnerRadius = innerRadius;
1619 verts++; 1603 verts++;
1620 } 1604 }
1621 } 1605 }
1622 1606
1623 helper.recordDraw(target); 1607 helper.recordDraw(target);
1624 } 1608 }
1625 1609
1626 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } 1610 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
1627 1611
1628 RRectCircleRendererBatch(const Geometry& geometry) : INHERITED(ClassID()) { 1612 RRectCircleRendererBatch(const Geometry& geometry) : INHERITED(ClassID()) {
1629 fGeoData.push_back(geometry); 1613 fGeoData.push_back(geometry);
1630 1614
1631 this->setBounds(geometry.fDevBounds); 1615 this->setBounds(geometry.fDevBounds);
1632 } 1616 }
1633 1617
1634 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { 1618 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
1635 RRectCircleRendererBatch* that = t->cast<RRectCircleRendererBatch>(); 1619 RRectCircleRendererBatch* that = t->cast<RRectCircleRendererBatch>();
1636 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi peline(), 1620 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi peline(),
1637 that->bounds(), caps)) { 1621 that->bounds(), caps)) {
1638 return false; 1622 return false;
1639 } 1623 }
1640 1624
1641 // TODO use vertex color to avoid breaking batches
1642 if (this->color() != that->color()) {
1643 return false;
1644 }
1645
1646 if (this->stroke() != that->stroke()) { 1625 if (this->stroke() != that->stroke()) {
1647 return false; 1626 return false;
1648 } 1627 }
1649 1628
1650 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); 1629 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords());
1651 if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->vi ewMatrix())) { 1630 if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->vi ewMatrix())) {
1652 return false; 1631 return false;
1653 } 1632 }
1654 1633
1655 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin()) ; 1634 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin()) ;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1751 helper.init(target, kTriangles_GrPrimitiveType, vertexStride, indexB uffer, 1730 helper.init(target, kTriangles_GrPrimitiveType, vertexStride, indexB uffer,
1752 kVertsPerRRect, indicesPerInstance, instanceCount)); 1731 kVertsPerRRect, indicesPerInstance, instanceCount));
1753 if (!verts || !indexBuffer) { 1732 if (!verts || !indexBuffer) {
1754 SkDebugf("Could not allocate vertices\n"); 1733 SkDebugf("Could not allocate vertices\n");
1755 return; 1734 return;
1756 } 1735 }
1757 1736
1758 for (int i = 0; i < instanceCount; i++) { 1737 for (int i = 0; i < instanceCount; i++) {
1759 const Geometry& args = fGeoData[i]; 1738 const Geometry& args = fGeoData[i];
1760 1739
1740 GrColor color = args.fColor;
1741
1761 // Compute the reciprocals of the radii here to save time in the sha der 1742 // Compute the reciprocals of the radii here to save time in the sha der
1762 SkScalar xRadRecip = SkScalarInvert(args.fXRadius); 1743 SkScalar xRadRecip = SkScalarInvert(args.fXRadius);
1763 SkScalar yRadRecip = SkScalarInvert(args.fYRadius); 1744 SkScalar yRadRecip = SkScalarInvert(args.fYRadius);
1764 SkScalar xInnerRadRecip = SkScalarInvert(args.fInnerXRadius); 1745 SkScalar xInnerRadRecip = SkScalarInvert(args.fInnerXRadius);
1765 SkScalar yInnerRadRecip = SkScalarInvert(args.fInnerYRadius); 1746 SkScalar yInnerRadRecip = SkScalarInvert(args.fInnerYRadius);
1766 1747
1767 // Extend the radii out half a pixel to antialias. 1748 // Extend the radii out half a pixel to antialias.
1768 SkScalar xOuterRadius = args.fXRadius + SK_ScalarHalf; 1749 SkScalar xOuterRadius = args.fXRadius + SK_ScalarHalf;
1769 SkScalar yOuterRadius = args.fYRadius + SK_ScalarHalf; 1750 SkScalar yOuterRadius = args.fYRadius + SK_ScalarHalf;
1770 1751
1771 const SkRect& bounds = args.fDevBounds; 1752 const SkRect& bounds = args.fDevBounds;
1772 1753
1773 SkScalar yCoords[4] = { 1754 SkScalar yCoords[4] = {
1774 bounds.fTop, 1755 bounds.fTop,
1775 bounds.fTop + yOuterRadius, 1756 bounds.fTop + yOuterRadius,
1776 bounds.fBottom - yOuterRadius, 1757 bounds.fBottom - yOuterRadius,
1777 bounds.fBottom 1758 bounds.fBottom
1778 }; 1759 };
1779 SkScalar yOuterOffsets[4] = { 1760 SkScalar yOuterOffsets[4] = {
1780 yOuterRadius, 1761 yOuterRadius,
1781 SK_ScalarNearlyZero, // we're using inversesqrt() in shader, so can't be exactly 0 1762 SK_ScalarNearlyZero, // we're using inversesqrt() in shader, so can't be exactly 0
1782 SK_ScalarNearlyZero, 1763 SK_ScalarNearlyZero,
1783 yOuterRadius 1764 yOuterRadius
1784 }; 1765 };
1785 1766
1786 for (int i = 0; i < 4; ++i) { 1767 for (int i = 0; i < 4; ++i) {
1787 verts->fPos = SkPoint::Make(bounds.fLeft, yCoords[i]); 1768 verts->fPos = SkPoint::Make(bounds.fLeft, yCoords[i]);
1769 verts->fColor = color;
1788 verts->fOffset = SkPoint::Make(xOuterRadius, yOuterOffsets[i]); 1770 verts->fOffset = SkPoint::Make(xOuterRadius, yOuterOffsets[i]);
1789 verts->fOuterRadii = SkPoint::Make(xRadRecip, yRadRecip); 1771 verts->fOuterRadii = SkPoint::Make(xRadRecip, yRadRecip);
1790 verts->fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadReci p); 1772 verts->fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadReci p);
1791 verts++; 1773 verts++;
1792 1774
1793 verts->fPos = SkPoint::Make(bounds.fLeft + xOuterRadius, yCoords [i]); 1775 verts->fPos = SkPoint::Make(bounds.fLeft + xOuterRadius, yCoords [i]);
1776 verts->fColor = color;
1794 verts->fOffset = SkPoint::Make(SK_ScalarNearlyZero, yOuterOffset s[i]); 1777 verts->fOffset = SkPoint::Make(SK_ScalarNearlyZero, yOuterOffset s[i]);
1795 verts->fOuterRadii = SkPoint::Make(xRadRecip, yRadRecip); 1778 verts->fOuterRadii = SkPoint::Make(xRadRecip, yRadRecip);
1796 verts->fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadReci p); 1779 verts->fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadReci p);
1797 verts++; 1780 verts++;
1798 1781
1799 verts->fPos = SkPoint::Make(bounds.fRight - xOuterRadius, yCoord s[i]); 1782 verts->fPos = SkPoint::Make(bounds.fRight - xOuterRadius, yCoord s[i]);
1783 verts->fColor = color;
1800 verts->fOffset = SkPoint::Make(SK_ScalarNearlyZero, yOuterOffset s[i]); 1784 verts->fOffset = SkPoint::Make(SK_ScalarNearlyZero, yOuterOffset s[i]);
1801 verts->fOuterRadii = SkPoint::Make(xRadRecip, yRadRecip); 1785 verts->fOuterRadii = SkPoint::Make(xRadRecip, yRadRecip);
1802 verts->fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadReci p); 1786 verts->fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadReci p);
1803 verts++; 1787 verts++;
1804 1788
1805 verts->fPos = SkPoint::Make(bounds.fRight, yCoords[i]); 1789 verts->fPos = SkPoint::Make(bounds.fRight, yCoords[i]);
1790 verts->fColor = color;
1806 verts->fOffset = SkPoint::Make(xOuterRadius, yOuterOffsets[i]); 1791 verts->fOffset = SkPoint::Make(xOuterRadius, yOuterOffsets[i]);
1807 verts->fOuterRadii = SkPoint::Make(xRadRecip, yRadRecip); 1792 verts->fOuterRadii = SkPoint::Make(xRadRecip, yRadRecip);
1808 verts->fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadReci p); 1793 verts->fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadReci p);
1809 verts++; 1794 verts++;
1810 } 1795 }
1811 } 1796 }
1812 helper.recordDraw(target); 1797 helper.recordDraw(target);
1813 } 1798 }
1814 1799
1815 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } 1800 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
1816 1801
1817 RRectEllipseRendererBatch(const Geometry& geometry) : INHERITED(ClassID()) { 1802 RRectEllipseRendererBatch(const Geometry& geometry) : INHERITED(ClassID()) {
1818 fGeoData.push_back(geometry); 1803 fGeoData.push_back(geometry);
1819 1804
1820 this->setBounds(geometry.fDevBounds); 1805 this->setBounds(geometry.fDevBounds);
1821 } 1806 }
1822 1807
1823 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { 1808 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
1824 RRectEllipseRendererBatch* that = t->cast<RRectEllipseRendererBatch>(); 1809 RRectEllipseRendererBatch* that = t->cast<RRectEllipseRendererBatch>();
1825 1810
1826 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi peline(), 1811 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi peline(),
1827 that->bounds(), caps)) { 1812 that->bounds(), caps)) {
1828 return false; 1813 return false;
1829 } 1814 }
1830 1815
1831 // TODO use vertex color to avoid breaking batches
1832 if (this->color() != that->color()) {
1833 return false;
1834 }
1835
1836 if (this->stroke() != that->stroke()) { 1816 if (this->stroke() != that->stroke()) {
1837 return false; 1817 return false;
1838 } 1818 }
1839 1819
1840 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); 1820 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords());
1841 if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->vi ewMatrix())) { 1821 if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->vi ewMatrix())) {
1842 return false; 1822 return false;
1843 } 1823 }
1844 1824
1845 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin()) ; 1825 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin()) ;
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
2078 } 2058 }
2079 2059
2080 DRAW_BATCH_TEST_DEFINE(RRectBatch) { 2060 DRAW_BATCH_TEST_DEFINE(RRectBatch) {
2081 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); 2061 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random);
2082 GrColor color = GrRandomColor(random); 2062 GrColor color = GrRandomColor(random);
2083 const SkRRect& rrect = GrTest::TestRRectSimple(random); 2063 const SkRRect& rrect = GrTest::TestRRectSimple(random);
2084 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra ndom)); 2064 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra ndom));
2085 } 2065 }
2086 2066
2087 #endif 2067 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698