OLD | NEW |
---|---|
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 const SkMatrix& localMatrix() const { return fLocalMatrix; } | 82 const SkMatrix& localMatrix() const { return fLocalMatrix; } |
83 bool usesLocalCoords() const { return fUsesLocalCoords; } | 83 bool usesLocalCoords() const { return fUsesLocalCoords; } |
84 virtual ~CircleEdgeEffect() {} | 84 virtual ~CircleEdgeEffect() {} |
85 | 85 |
86 const char* name() const override { return "CircleEdge"; } | 86 const char* name() const override { return "CircleEdge"; } |
87 | 87 |
88 inline bool isStroked() const { return fStroke; } | 88 inline bool isStroked() const { return fStroke; } |
89 | 89 |
90 class GLProcessor : public GrGLGeometryProcessor { | 90 class GLProcessor : public GrGLGeometryProcessor { |
91 public: | 91 public: |
92 GLProcessor(const GrGeometryProcessor&, | 92 GLProcessor() |
93 const GrBatchTracker&) | |
94 : fColor(GrColor_ILLEGAL) {} | 93 : fColor(GrColor_ILLEGAL) {} |
95 | 94 |
96 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{ | 95 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{ |
97 const CircleEdgeEffect& ce = args.fGP.cast<CircleEdgeEffect>(); | 96 const CircleEdgeEffect& ce = args.fGP.cast<CircleEdgeEffect>(); |
98 GrGLGPBuilder* pb = args.fPB; | 97 GrGLGPBuilder* pb = args.fPB; |
99 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); | 98 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); |
100 | 99 |
101 // emit attributes | 100 // emit attributes |
102 vsBuilder->emitAttributes(ce); | 101 vsBuilder->emitAttributes(ce); |
103 | 102 |
(...skipping 19 matching lines...) Expand all Loading... | |
123 if (ce.isStroked()) { | 122 if (ce.isStroked()) { |
124 fsBuilder->codeAppendf("float innerAlpha = clamp(%s.z * (d - %s. w), 0.0, 1.0);", | 123 fsBuilder->codeAppendf("float innerAlpha = clamp(%s.z * (d - %s. w), 0.0, 1.0);", |
125 v.fsIn(), v.fsIn()); | 124 v.fsIn(), v.fsIn()); |
126 fsBuilder->codeAppend("edgeAlpha *= innerAlpha;"); | 125 fsBuilder->codeAppend("edgeAlpha *= innerAlpha;"); |
127 } | 126 } |
128 | 127 |
129 fsBuilder->codeAppendf("%s = vec4(edgeAlpha);", args.fOutputCoverage ); | 128 fsBuilder->codeAppendf("%s = vec4(edgeAlpha);", args.fOutputCoverage ); |
130 } | 129 } |
131 | 130 |
132 static void GenKey(const GrGeometryProcessor& gp, | 131 static void GenKey(const GrGeometryProcessor& gp, |
133 const GrBatchTracker& bt, | |
134 const GrGLSLCaps&, | 132 const GrGLSLCaps&, |
135 GrProcessorKeyBuilder* b) { | 133 GrProcessorKeyBuilder* b) { |
136 const CircleEdgeEffect& ce = gp.cast<CircleEdgeEffect>(); | 134 const CircleEdgeEffect& ce = gp.cast<CircleEdgeEffect>(); |
137 uint16_t key = ce.isStroked() ? 0x1 : 0x0; | 135 uint16_t key = ce.isStroked() ? 0x1 : 0x0; |
138 key |= ce.usesLocalCoords() && ce.localMatrix().hasPerspective() ? 0 x2 : 0x0; | 136 key |= ce.usesLocalCoords() && ce.localMatrix().hasPerspective() ? 0 x2 : 0x0; |
139 key |= ce.colorIgnored() ? 0x4 : 0x0; | 137 key |= ce.colorIgnored() ? 0x4 : 0x0; |
140 b->add32(key); | 138 b->add32(key); |
141 } | 139 } |
142 | 140 |
143 virtual void setData(const GrGLProgramDataManager& pdman, | 141 virtual void setData(const GrGLProgramDataManager& pdman, |
144 const GrPrimitiveProcessor& gp, | 142 const GrPrimitiveProcessor& gp) override { |
145 const GrBatchTracker& bt) override { | |
146 const CircleEdgeEffect& ce = gp.cast<CircleEdgeEffect>(); | 143 const CircleEdgeEffect& ce = gp.cast<CircleEdgeEffect>(); |
147 if (ce.color() != fColor) { | 144 if (ce.color() != fColor) { |
148 GrGLfloat c[4]; | 145 GrGLfloat c[4]; |
149 GrColorToRGBAFloat(ce.color(), c); | 146 GrColorToRGBAFloat(ce.color(), c); |
150 pdman.set4fv(fColorUniform, 1, c); | 147 pdman.set4fv(fColorUniform, 1, c); |
151 fColor = ce.color(); | 148 fColor = ce.color(); |
152 } | 149 } |
153 } | 150 } |
154 | 151 |
155 void setTransformData(const GrPrimitiveProcessor& primProc, | 152 void setTransformData(const GrPrimitiveProcessor& primProc, |
156 const GrGLProgramDataManager& pdman, | 153 const GrGLProgramDataManager& pdman, |
157 int index, | 154 int index, |
158 const SkTArray<const GrCoordTransform*, true>& tra nsforms) override { | 155 const SkTArray<const GrCoordTransform*, true>& tra nsforms) override { |
159 this->setTransformDataHelper<CircleEdgeEffect>(primProc, pdman, inde x, transforms); | 156 this->setTransformDataHelper<CircleEdgeEffect>(primProc, pdman, inde x, transforms); |
160 } | 157 } |
161 | 158 |
162 private: | 159 private: |
163 GrColor fColor; | 160 GrColor fColor; |
164 UniformHandle fColorUniform; | 161 UniformHandle fColorUniform; |
165 typedef GrGLGeometryProcessor INHERITED; | 162 typedef GrGLGeometryProcessor INHERITED; |
166 }; | 163 }; |
167 | 164 |
168 virtual void getGLProcessorKey(const GrBatchTracker& bt, | 165 virtual void getGLProcessorKey(const GrGLSLCaps& caps, |
169 const GrGLSLCaps& caps, | |
170 GrProcessorKeyBuilder* b) const override { | 166 GrProcessorKeyBuilder* b) const override { |
171 GLProcessor::GenKey(*this, bt, caps, b); | 167 GLProcessor::GenKey(*this, caps, b); |
172 } | 168 } |
173 | 169 |
174 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, | 170 virtual GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const ov erride { |
bsalomon
2015/09/10 18:55:30
-virtual
joshualitt
2015/09/10 20:08:05
Acknowledged.
| |
175 const GrGLSLCaps&) const ov erride { | 171 return new GLProcessor(); |
176 return new GLProcessor(*this, bt); | |
177 } | 172 } |
178 | 173 |
179 private: | 174 private: |
180 CircleEdgeEffect(GrColor color, bool stroke, const SkMatrix& localMatrix, bo ol usesLocalCoords) | 175 CircleEdgeEffect(GrColor color, bool stroke, const SkMatrix& localMatrix, bo ol usesLocalCoords) |
181 : fColor(color) | 176 : fColor(color) |
182 , fLocalMatrix(localMatrix) | 177 , fLocalMatrix(localMatrix) |
183 , fUsesLocalCoords(usesLocalCoords) { | 178 , fUsesLocalCoords(usesLocalCoords) { |
184 this->initClassID<CircleEdgeEffect>(); | 179 this->initClassID<CircleEdgeEffect>(); |
185 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe rtexAttribType, | 180 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe rtexAttribType, |
186 kHigh_GrSLPrecision)); | 181 kHigh_GrSLPrecision)); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
236 const Attribute* inEllipseRadii() const { return fInEllipseRadii; } | 231 const Attribute* inEllipseRadii() const { return fInEllipseRadii; } |
237 GrColor color() const { return fColor; } | 232 GrColor color() const { return fColor; } |
238 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } | 233 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } |
239 const SkMatrix& localMatrix() const { return fLocalMatrix; } | 234 const SkMatrix& localMatrix() const { return fLocalMatrix; } |
240 bool usesLocalCoords() const { return fUsesLocalCoords; } | 235 bool usesLocalCoords() const { return fUsesLocalCoords; } |
241 | 236 |
242 inline bool isStroked() const { return fStroke; } | 237 inline bool isStroked() const { return fStroke; } |
243 | 238 |
244 class GLProcessor : public GrGLGeometryProcessor { | 239 class GLProcessor : public GrGLGeometryProcessor { |
245 public: | 240 public: |
246 GLProcessor(const GrGeometryProcessor&, | 241 GLProcessor() |
247 const GrBatchTracker&) | |
248 : fColor(GrColor_ILLEGAL) {} | 242 : fColor(GrColor_ILLEGAL) {} |
249 | 243 |
250 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{ | 244 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{ |
251 const EllipseEdgeEffect& ee = args.fGP.cast<EllipseEdgeEffect>(); | 245 const EllipseEdgeEffect& ee = args.fGP.cast<EllipseEdgeEffect>(); |
252 GrGLGPBuilder* pb = args.fPB; | 246 GrGLGPBuilder* pb = args.fPB; |
253 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); | 247 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); |
254 | 248 |
255 // emit attributes | 249 // emit attributes |
256 vsBuilder->emitAttributes(ee); | 250 vsBuilder->emitAttributes(ee); |
257 | 251 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
298 fsBuilder->codeAppendf("grad = 2.0*scaledOffset*%s.zw;", | 292 fsBuilder->codeAppendf("grad = 2.0*scaledOffset*%s.zw;", |
299 ellipseRadii.fsIn()); | 293 ellipseRadii.fsIn()); |
300 fsBuilder->codeAppend("invlen = inversesqrt(dot(grad, grad));"); | 294 fsBuilder->codeAppend("invlen = inversesqrt(dot(grad, grad));"); |
301 fsBuilder->codeAppend("edgeAlpha *= clamp(0.5+test*invlen, 0.0, 1.0);"); | 295 fsBuilder->codeAppend("edgeAlpha *= clamp(0.5+test*invlen, 0.0, 1.0);"); |
302 } | 296 } |
303 | 297 |
304 fsBuilder->codeAppendf("%s = vec4(edgeAlpha);", args.fOutputCoverage ); | 298 fsBuilder->codeAppendf("%s = vec4(edgeAlpha);", args.fOutputCoverage ); |
305 } | 299 } |
306 | 300 |
307 static void GenKey(const GrGeometryProcessor& gp, | 301 static void GenKey(const GrGeometryProcessor& gp, |
308 const GrBatchTracker& bt, | |
309 const GrGLSLCaps&, | 302 const GrGLSLCaps&, |
310 GrProcessorKeyBuilder* b) { | 303 GrProcessorKeyBuilder* b) { |
311 const EllipseEdgeEffect& ee = gp.cast<EllipseEdgeEffect>(); | 304 const EllipseEdgeEffect& ee = gp.cast<EllipseEdgeEffect>(); |
312 uint16_t key = ee.isStroked() ? 0x1 : 0x0; | 305 uint16_t key = ee.isStroked() ? 0x1 : 0x0; |
313 key |= ee.usesLocalCoords() && ee.localMatrix().hasPerspective() ? 0 x2 : 0x0; | 306 key |= ee.usesLocalCoords() && ee.localMatrix().hasPerspective() ? 0 x2 : 0x0; |
314 key |= ee.colorIgnored() ? 0x4 : 0x0; | 307 key |= ee.colorIgnored() ? 0x4 : 0x0; |
315 b->add32(key); | 308 b->add32(key); |
316 } | 309 } |
317 | 310 |
318 virtual void setData(const GrGLProgramDataManager& pdman, | 311 virtual void setData(const GrGLProgramDataManager& pdman, |
319 const GrPrimitiveProcessor& gp, | 312 const GrPrimitiveProcessor& gp) override { |
320 const GrBatchTracker& bt) override { | |
321 const EllipseEdgeEffect& ee = gp.cast<EllipseEdgeEffect>(); | 313 const EllipseEdgeEffect& ee = gp.cast<EllipseEdgeEffect>(); |
322 if (ee.color() != fColor) { | 314 if (ee.color() != fColor) { |
323 GrGLfloat c[4]; | 315 GrGLfloat c[4]; |
324 GrColorToRGBAFloat(ee.color(), c); | 316 GrColorToRGBAFloat(ee.color(), c); |
325 pdman.set4fv(fColorUniform, 1, c); | 317 pdman.set4fv(fColorUniform, 1, c); |
326 fColor = ee.color(); | 318 fColor = ee.color(); |
327 } | 319 } |
328 } | 320 } |
329 | 321 |
330 void setTransformData(const GrPrimitiveProcessor& primProc, | 322 void setTransformData(const GrPrimitiveProcessor& primProc, |
331 const GrGLProgramDataManager& pdman, | 323 const GrGLProgramDataManager& pdman, |
332 int index, | 324 int index, |
333 const SkTArray<const GrCoordTransform*, true>& tra nsforms) override { | 325 const SkTArray<const GrCoordTransform*, true>& tra nsforms) override { |
334 this->setTransformDataHelper<EllipseEdgeEffect>(primProc, pdman, ind ex, transforms); | 326 this->setTransformDataHelper<EllipseEdgeEffect>(primProc, pdman, ind ex, transforms); |
335 } | 327 } |
336 | 328 |
337 private: | 329 private: |
338 GrColor fColor; | 330 GrColor fColor; |
339 UniformHandle fColorUniform; | 331 UniformHandle fColorUniform; |
340 | 332 |
341 typedef GrGLGeometryProcessor INHERITED; | 333 typedef GrGLGeometryProcessor INHERITED; |
342 }; | 334 }; |
343 | 335 |
344 virtual void getGLProcessorKey(const GrBatchTracker& bt, | 336 virtual void getGLProcessorKey(const GrGLSLCaps& caps, |
345 const GrGLSLCaps& caps, | |
346 GrProcessorKeyBuilder* b) const override { | 337 GrProcessorKeyBuilder* b) const override { |
347 GLProcessor::GenKey(*this, bt, caps, b); | 338 GLProcessor::GenKey(*this, caps, b); |
348 } | 339 } |
349 | 340 |
350 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, | 341 virtual GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const ov erride { |
bsalomon
2015/09/10 18:55:30
-virtual?
joshualitt
2015/09/10 20:08:04
Acknowledged.
| |
351 const GrGLSLCaps&) const ov erride { | 342 return new GLProcessor(); |
352 return new GLProcessor(*this, bt); | |
353 } | 343 } |
354 | 344 |
355 private: | 345 private: |
356 EllipseEdgeEffect(GrColor color, bool stroke, const SkMatrix& localMatrix, | 346 EllipseEdgeEffect(GrColor color, bool stroke, const SkMatrix& localMatrix, |
357 bool usesLocalCoords) | 347 bool usesLocalCoords) |
358 : fColor(color) | 348 : fColor(color) |
359 , fLocalMatrix(localMatrix) | 349 , fLocalMatrix(localMatrix) |
360 , fUsesLocalCoords(usesLocalCoords) { | 350 , fUsesLocalCoords(usesLocalCoords) { |
361 this->initClassID<EllipseEdgeEffect>(); | 351 this->initClassID<EllipseEdgeEffect>(); |
362 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe rtexAttribType)); | 352 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe rtexAttribType)); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
418 const Attribute* inEllipseOffsets1() const { return fInEllipseOffsets1; } | 408 const Attribute* inEllipseOffsets1() const { return fInEllipseOffsets1; } |
419 GrColor color() const { return fColor; } | 409 GrColor color() const { return fColor; } |
420 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } | 410 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } |
421 const SkMatrix& viewMatrix() const { return fViewMatrix; } | 411 const SkMatrix& viewMatrix() const { return fViewMatrix; } |
422 bool usesLocalCoords() const { return fUsesLocalCoords; } | 412 bool usesLocalCoords() const { return fUsesLocalCoords; } |
423 | 413 |
424 inline Mode getMode() const { return fMode; } | 414 inline Mode getMode() const { return fMode; } |
425 | 415 |
426 class GLProcessor : public GrGLGeometryProcessor { | 416 class GLProcessor : public GrGLGeometryProcessor { |
427 public: | 417 public: |
428 GLProcessor(const GrGeometryProcessor&, | 418 GLProcessor() |
429 const GrBatchTracker&) | |
430 : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL) {} | 419 : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL) {} |
431 | 420 |
432 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{ | 421 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{ |
433 const DIEllipseEdgeEffect& ee = args.fGP.cast<DIEllipseEdgeEffect>() ; | 422 const DIEllipseEdgeEffect& ee = args.fGP.cast<DIEllipseEdgeEffect>() ; |
434 GrGLGPBuilder* pb = args.fPB; | 423 GrGLGPBuilder* pb = args.fPB; |
435 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); | 424 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); |
436 | 425 |
437 // emit attributes | 426 // emit attributes |
438 vsBuilder->emitAttributes(ee); | 427 vsBuilder->emitAttributes(ee); |
439 | 428 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
495 offsets1.fsIn(), offsets1.fsIn(), offsets 1.fsIn(), | 484 offsets1.fsIn(), offsets1.fsIn(), offsets 1.fsIn(), |
496 offsets1.fsIn()); | 485 offsets1.fsIn()); |
497 fsBuilder->codeAppend("invlen = inversesqrt(dot(grad, grad));"); | 486 fsBuilder->codeAppend("invlen = inversesqrt(dot(grad, grad));"); |
498 fsBuilder->codeAppend("edgeAlpha *= clamp(0.5+test*invlen, 0.0, 1.0);"); | 487 fsBuilder->codeAppend("edgeAlpha *= clamp(0.5+test*invlen, 0.0, 1.0);"); |
499 } | 488 } |
500 | 489 |
501 fsBuilder->codeAppendf("%s = vec4(edgeAlpha);", args.fOutputCoverage ); | 490 fsBuilder->codeAppendf("%s = vec4(edgeAlpha);", args.fOutputCoverage ); |
502 } | 491 } |
503 | 492 |
504 static void GenKey(const GrGeometryProcessor& gp, | 493 static void GenKey(const GrGeometryProcessor& gp, |
505 const GrBatchTracker& bt, | |
506 const GrGLSLCaps&, | 494 const GrGLSLCaps&, |
507 GrProcessorKeyBuilder* b) { | 495 GrProcessorKeyBuilder* b) { |
508 const DIEllipseEdgeEffect& ellipseEffect = gp.cast<DIEllipseEdgeEffe ct>(); | 496 const DIEllipseEdgeEffect& ellipseEffect = gp.cast<DIEllipseEdgeEffe ct>(); |
509 uint16_t key = ellipseEffect.getMode(); | 497 uint16_t key = ellipseEffect.getMode(); |
510 key |= ellipseEffect.colorIgnored() << 9; | 498 key |= ellipseEffect.colorIgnored() << 9; |
511 key |= ComputePosKey(ellipseEffect.viewMatrix()) << 10; | 499 key |= ComputePosKey(ellipseEffect.viewMatrix()) << 10; |
512 b->add32(key); | 500 b->add32(key); |
513 } | 501 } |
514 | 502 |
515 virtual void setData(const GrGLProgramDataManager& pdman, | 503 virtual void setData(const GrGLProgramDataManager& pdman, |
bsalomon
2015/09/10 18:55:30
-virtual?
joshualitt
2015/09/10 20:08:04
Acknowledged.
| |
516 const GrPrimitiveProcessor& gp, | 504 const GrPrimitiveProcessor& gp) override { |
517 const GrBatchTracker& bt) override { | |
518 const DIEllipseEdgeEffect& dee = gp.cast<DIEllipseEdgeEffect>(); | 505 const DIEllipseEdgeEffect& dee = gp.cast<DIEllipseEdgeEffect>(); |
519 | 506 |
520 if (!dee.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dee. viewMatrix())) { | 507 if (!dee.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dee. viewMatrix())) { |
521 fViewMatrix = dee.viewMatrix(); | 508 fViewMatrix = dee.viewMatrix(); |
522 GrGLfloat viewMatrix[3 * 3]; | 509 GrGLfloat viewMatrix[3 * 3]; |
523 GrGLGetMatrix<3>(viewMatrix, fViewMatrix); | 510 GrGLGetMatrix<3>(viewMatrix, fViewMatrix); |
524 pdman.setMatrix3f(fViewMatrixUniform, viewMatrix); | 511 pdman.setMatrix3f(fViewMatrixUniform, viewMatrix); |
525 } | 512 } |
526 | 513 |
527 if (dee.color() != fColor) { | 514 if (dee.color() != fColor) { |
528 GrGLfloat c[4]; | 515 GrGLfloat c[4]; |
529 GrColorToRGBAFloat(dee.color(), c); | 516 GrColorToRGBAFloat(dee.color(), c); |
530 pdman.set4fv(fColorUniform, 1, c); | 517 pdman.set4fv(fColorUniform, 1, c); |
531 fColor = dee.color(); | 518 fColor = dee.color(); |
532 } | 519 } |
533 } | 520 } |
534 | 521 |
535 private: | 522 private: |
536 SkMatrix fViewMatrix; | 523 SkMatrix fViewMatrix; |
537 GrColor fColor; | 524 GrColor fColor; |
538 UniformHandle fColorUniform; | 525 UniformHandle fColorUniform; |
539 UniformHandle fViewMatrixUniform; | 526 UniformHandle fViewMatrixUniform; |
540 | 527 |
541 typedef GrGLGeometryProcessor INHERITED; | 528 typedef GrGLGeometryProcessor INHERITED; |
542 }; | 529 }; |
543 | 530 |
544 virtual void getGLProcessorKey(const GrBatchTracker& bt, | 531 virtual void getGLProcessorKey(const GrGLSLCaps& caps, |
545 const GrGLSLCaps& caps, | |
546 GrProcessorKeyBuilder* b) const override { | 532 GrProcessorKeyBuilder* b) const override { |
547 GLProcessor::GenKey(*this, bt, caps, b); | 533 GLProcessor::GenKey(*this, caps, b); |
548 } | 534 } |
549 | 535 |
550 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, | 536 virtual GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const ov erride { |
551 const GrGLSLCaps&) const ov erride { | 537 return new GLProcessor(); |
552 return new GLProcessor(*this, bt); | |
553 } | 538 } |
554 | 539 |
555 private: | 540 private: |
556 DIEllipseEdgeEffect(GrColor color, const SkMatrix& viewMatrix, Mode mode, | 541 DIEllipseEdgeEffect(GrColor color, const SkMatrix& viewMatrix, Mode mode, |
557 bool usesLocalCoords) | 542 bool usesLocalCoords) |
558 : fColor(color) | 543 : fColor(color) |
559 , fViewMatrix(viewMatrix) | 544 , fViewMatrix(viewMatrix) |
560 , fUsesLocalCoords(usesLocalCoords) { | 545 , fUsesLocalCoords(usesLocalCoords) { |
561 this->initClassID<DIEllipseEdgeEffect>(); | 546 this->initClassID<DIEllipseEdgeEffect>(); |
562 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe rtexAttribType, | 547 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe rtexAttribType, |
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2033 } | 2018 } |
2034 | 2019 |
2035 DRAW_BATCH_TEST_DEFINE(RRectBatch) { | 2020 DRAW_BATCH_TEST_DEFINE(RRectBatch) { |
2036 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); | 2021 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); |
2037 GrColor color = GrRandomColor(random); | 2022 GrColor color = GrRandomColor(random); |
2038 const SkRRect& rrect = GrTest::TestRRectSimple(random); | 2023 const SkRRect& rrect = GrTest::TestRRectSimple(random); |
2039 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra ndom)); | 2024 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra ndom)); |
2040 } | 2025 } |
2041 | 2026 |
2042 #endif | 2027 #endif |
OLD | NEW |