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 "GrBezierEffect.h" | 8 #include "GrBezierEffect.h" |
9 | 9 |
10 #include "gl/GrGLProcessor.h" | 10 #include "gl/GrGLProcessor.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 void GrConicEffect::getGLProcessorKey(const GrBatchTracker& bt, | 176 void GrConicEffect::getGLProcessorKey(const GrBatchTracker& bt, |
177 const GrGLCaps& caps, | 177 const GrGLCaps& caps, |
178 GrProcessorKeyBuilder* b) const { | 178 GrProcessorKeyBuilder* b) const { |
179 GrGLConicEffect::GenKey(*this, bt, caps, b); | 179 GrGLConicEffect::GenKey(*this, bt, caps, b); |
180 } | 180 } |
181 | 181 |
182 GrGLGeometryProcessor* GrConicEffect::createGLInstance(const GrBatchTracker& bt)
const { | 182 GrGLGeometryProcessor* GrConicEffect::createGLInstance(const GrBatchTracker& bt)
const { |
183 return SkNEW_ARGS(GrGLConicEffect, (*this, bt)); | 183 return SkNEW_ARGS(GrGLConicEffect, (*this, bt)); |
184 } | 184 } |
185 | 185 |
186 GrConicEffect::GrConicEffect(GrColor color, uint8_t coverage, GrPrimitiveEdgeTyp
e edgeType, | 186 GrConicEffect::GrConicEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t
coverage, |
187 const SkMatrix& localMatrix) | 187 GrPrimitiveEdgeType edgeType, const SkMatrix& local
Matrix) |
188 : INHERITED(color, false, localMatrix), fCoverageScale(coverage), fEdgeType(
edgeType) { | 188 : INHERITED(color, viewMatrix, localMatrix) |
| 189 , fCoverageScale(coverage) |
| 190 , fEdgeType(edgeType) { |
189 this->initClassID<GrConicEffect>(); | 191 this->initClassID<GrConicEffect>(); |
190 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVert
exAttribType)); | 192 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVert
exAttribType)); |
191 fInConicCoeffs = &this->addVertexAttrib(GrAttribute("inConicCoeffs", | 193 fInConicCoeffs = &this->addVertexAttrib(GrAttribute("inConicCoeffs", |
192 kVec4f_GrVertexAttribTyp
e)); | 194 kVec4f_GrVertexAttribTyp
e)); |
193 } | 195 } |
194 | 196 |
195 bool GrConicEffect::onIsEqual(const GrGeometryProcessor& other) const { | 197 bool GrConicEffect::onIsEqual(const GrGeometryProcessor& other) const { |
196 const GrConicEffect& ce = other.cast<GrConicEffect>(); | 198 const GrConicEffect& ce = other.cast<GrConicEffect>(); |
197 return (ce.fEdgeType == fEdgeType); | 199 return (ce.fEdgeType == fEdgeType); |
198 } | 200 } |
(...skipping 22 matching lines...) Expand all Loading... |
221 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrConicEffect); | 223 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrConicEffect); |
222 | 224 |
223 GrGeometryProcessor* GrConicEffect::TestCreate(SkRandom* random, | 225 GrGeometryProcessor* GrConicEffect::TestCreate(SkRandom* random, |
224 GrContext*, | 226 GrContext*, |
225 const GrDrawTargetCaps& caps, | 227 const GrDrawTargetCaps& caps, |
226 GrTexture*[]) { | 228 GrTexture*[]) { |
227 GrGeometryProcessor* gp; | 229 GrGeometryProcessor* gp; |
228 do { | 230 do { |
229 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( | 231 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( |
230 random->nextULessThan(kGrPro
cessorEdgeTypeCnt)); | 232 random->nextULessThan(kGrPro
cessorEdgeTypeCnt)); |
231 gp = GrConicEffect::Create(GrRandomColor(random), edgeType, caps, | 233 gp = GrConicEffect::Create(GrRandomColor(random), GrProcessorUnitTest::T
estMatrix(random), |
| 234 edgeType, caps, |
232 GrProcessorUnitTest::TestMatrix(random)); | 235 GrProcessorUnitTest::TestMatrix(random)); |
233 } while (NULL == gp); | 236 } while (NULL == gp); |
234 return gp; | 237 return gp; |
235 } | 238 } |
236 | 239 |
237 ////////////////////////////////////////////////////////////////////////////// | 240 ////////////////////////////////////////////////////////////////////////////// |
238 // Quad | 241 // Quad |
239 ////////////////////////////////////////////////////////////////////////////// | 242 ////////////////////////////////////////////////////////////////////////////// |
240 | 243 |
241 struct QuadBatchTracker { | 244 struct QuadBatchTracker { |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 void GrQuadEffect::getGLProcessorKey(const GrBatchTracker& bt, | 391 void GrQuadEffect::getGLProcessorKey(const GrBatchTracker& bt, |
389 const GrGLCaps& caps, | 392 const GrGLCaps& caps, |
390 GrProcessorKeyBuilder* b) const { | 393 GrProcessorKeyBuilder* b) const { |
391 GrGLQuadEffect::GenKey(*this, bt, caps, b); | 394 GrGLQuadEffect::GenKey(*this, bt, caps, b); |
392 } | 395 } |
393 | 396 |
394 GrGLGeometryProcessor* GrQuadEffect::createGLInstance(const GrBatchTracker& bt)
const { | 397 GrGLGeometryProcessor* GrQuadEffect::createGLInstance(const GrBatchTracker& bt)
const { |
395 return SkNEW_ARGS(GrGLQuadEffect, (*this, bt)); | 398 return SkNEW_ARGS(GrGLQuadEffect, (*this, bt)); |
396 } | 399 } |
397 | 400 |
398 GrQuadEffect::GrQuadEffect(GrColor color, uint8_t coverage, GrPrimitiveEdgeType
edgeType, | 401 GrQuadEffect::GrQuadEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t co
verage, |
399 const SkMatrix& localMatrix) | 402 GrPrimitiveEdgeType edgeType, const SkMatrix& localMa
trix) |
400 : INHERITED(color, false, localMatrix), fCoverageScale(coverage), fEdgeType(
edgeType) { | 403 : INHERITED(color, viewMatrix, localMatrix) |
| 404 , fCoverageScale(coverage) |
| 405 , fEdgeType(edgeType) { |
401 this->initClassID<GrQuadEffect>(); | 406 this->initClassID<GrQuadEffect>(); |
402 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVert
exAttribType)); | 407 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVert
exAttribType)); |
403 fInHairQuadEdge = &this->addVertexAttrib(GrAttribute("inHairQuadEdge", | 408 fInHairQuadEdge = &this->addVertexAttrib(GrAttribute("inHairQuadEdge", |
404 kVec4f_GrVertexAttribTyp
e)); | 409 kVec4f_GrVertexAttribTyp
e)); |
405 } | 410 } |
406 | 411 |
407 bool GrQuadEffect::onIsEqual(const GrGeometryProcessor& other) const { | 412 bool GrQuadEffect::onIsEqual(const GrGeometryProcessor& other) const { |
408 const GrQuadEffect& ce = other.cast<GrQuadEffect>(); | 413 const GrQuadEffect& ce = other.cast<GrQuadEffect>(); |
409 return (ce.fEdgeType == fEdgeType); | 414 return (ce.fEdgeType == fEdgeType); |
410 } | 415 } |
(...skipping 22 matching lines...) Expand all Loading... |
433 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrQuadEffect); | 438 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrQuadEffect); |
434 | 439 |
435 GrGeometryProcessor* GrQuadEffect::TestCreate(SkRandom* random, | 440 GrGeometryProcessor* GrQuadEffect::TestCreate(SkRandom* random, |
436 GrContext*, | 441 GrContext*, |
437 const GrDrawTargetCaps& caps, | 442 const GrDrawTargetCaps& caps, |
438 GrTexture*[]) { | 443 GrTexture*[]) { |
439 GrGeometryProcessor* gp; | 444 GrGeometryProcessor* gp; |
440 do { | 445 do { |
441 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( | 446 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( |
442 random->nextULessThan(kGrProcessorEdgeTypeCnt)); | 447 random->nextULessThan(kGrProcessorEdgeTypeCnt)); |
443 gp = GrQuadEffect::Create(GrRandomColor(random), edgeType, caps, | 448 gp = GrQuadEffect::Create(GrRandomColor(random), |
| 449 GrProcessorUnitTest::TestMatrix(random), |
| 450 edgeType, caps, |
444 GrProcessorUnitTest::TestMatrix(random)); | 451 GrProcessorUnitTest::TestMatrix(random)); |
445 } while (NULL == gp); | 452 } while (NULL == gp); |
446 return gp; | 453 return gp; |
447 } | 454 } |
448 | 455 |
449 ////////////////////////////////////////////////////////////////////////////// | 456 ////////////////////////////////////////////////////////////////////////////// |
450 // Cubic | 457 // Cubic |
451 ////////////////////////////////////////////////////////////////////////////// | 458 ////////////////////////////////////////////////////////////////////////////// |
452 | 459 |
453 struct CubicBatchTracker { | 460 struct CubicBatchTracker { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 void GrCubicEffect::getGLProcessorKey(const GrBatchTracker& bt, | 629 void GrCubicEffect::getGLProcessorKey(const GrBatchTracker& bt, |
623 const GrGLCaps& caps, | 630 const GrGLCaps& caps, |
624 GrProcessorKeyBuilder* b) const { | 631 GrProcessorKeyBuilder* b) const { |
625 GrGLCubicEffect::GenKey(*this, bt, caps, b); | 632 GrGLCubicEffect::GenKey(*this, bt, caps, b); |
626 } | 633 } |
627 | 634 |
628 GrGLGeometryProcessor* GrCubicEffect::createGLInstance(const GrBatchTracker& bt)
const { | 635 GrGLGeometryProcessor* GrCubicEffect::createGLInstance(const GrBatchTracker& bt)
const { |
629 return SkNEW_ARGS(GrGLCubicEffect, (*this, bt)); | 636 return SkNEW_ARGS(GrGLCubicEffect, (*this, bt)); |
630 } | 637 } |
631 | 638 |
632 GrCubicEffect::GrCubicEffect(GrColor color, GrPrimitiveEdgeType edgeType) | 639 GrCubicEffect::GrCubicEffect(GrColor color, const SkMatrix& viewMatrix, |
633 : INHERITED(color), fEdgeType(edgeType) { | 640 GrPrimitiveEdgeType edgeType) |
| 641 : INHERITED(color, viewMatrix), fEdgeType(edgeType) { |
634 this->initClassID<GrCubicEffect>(); | 642 this->initClassID<GrCubicEffect>(); |
635 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVert
exAttribType)); | 643 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVert
exAttribType)); |
636 fInCubicCoeffs = &this->addVertexAttrib(GrAttribute("inCubicCoeffs", | 644 fInCubicCoeffs = &this->addVertexAttrib(GrAttribute("inCubicCoeffs", |
637 kVec4f_GrVertexAttribTyp
e)); | 645 kVec4f_GrVertexAttribTyp
e)); |
638 } | 646 } |
639 | 647 |
640 bool GrCubicEffect::onIsEqual(const GrGeometryProcessor& other) const { | 648 bool GrCubicEffect::onIsEqual(const GrGeometryProcessor& other) const { |
641 const GrCubicEffect& ce = other.cast<GrCubicEffect>(); | 649 const GrCubicEffect& ce = other.cast<GrCubicEffect>(); |
642 return (ce.fEdgeType == fEdgeType); | 650 return (ce.fEdgeType == fEdgeType); |
643 } | 651 } |
(...skipping 20 matching lines...) Expand all Loading... |
664 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrCubicEffect); | 672 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrCubicEffect); |
665 | 673 |
666 GrGeometryProcessor* GrCubicEffect::TestCreate(SkRandom* random, | 674 GrGeometryProcessor* GrCubicEffect::TestCreate(SkRandom* random, |
667 GrContext*, | 675 GrContext*, |
668 const GrDrawTargetCaps& caps, | 676 const GrDrawTargetCaps& caps, |
669 GrTexture*[]) { | 677 GrTexture*[]) { |
670 GrGeometryProcessor* gp; | 678 GrGeometryProcessor* gp; |
671 do { | 679 do { |
672 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( | 680 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( |
673 random->nextULessThan(kGrPro
cessorEdgeTypeCnt)); | 681 random->nextULessThan(kGrPro
cessorEdgeTypeCnt)); |
674 gp = GrCubicEffect::Create(GrRandomColor(random), edgeType, caps); | 682 gp = GrCubicEffect::Create(GrRandomColor(random), |
| 683 GrProcessorUnitTest::TestMatrix(random), edge
Type, caps); |
675 } while (NULL == gp); | 684 } while (NULL == gp); |
676 return gp; | 685 return gp; |
677 } | 686 } |
678 | 687 |
OLD | NEW |