| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType, | 210 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType, |
| 211 kHigh_GrSLPrecision)); | 211 kHigh_GrSLPrecision)); |
| 212 fInConicCoeffs = &this->addVertexAttrib(Attribute("inConicCoeffs", | 212 fInConicCoeffs = &this->addVertexAttrib(Attribute("inConicCoeffs", |
| 213 kVec4f_GrVertexAttribType)
); | 213 kVec4f_GrVertexAttribType)
); |
| 214 } | 214 } |
| 215 | 215 |
| 216 ////////////////////////////////////////////////////////////////////////////// | 216 ////////////////////////////////////////////////////////////////////////////// |
| 217 | 217 |
| 218 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrConicEffect); | 218 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrConicEffect); |
| 219 | 219 |
| 220 GrGeometryProcessor* GrConicEffect::TestCreate(SkRandom* random, | 220 GrGeometryProcessor* GrConicEffect::TestCreate(GrProcessorTestData* d) { |
| 221 GrContext*, | |
| 222 const GrCaps& caps, | |
| 223 GrTexture*[]) { | |
| 224 GrGeometryProcessor* gp; | 221 GrGeometryProcessor* gp; |
| 225 do { | 222 do { |
| 226 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( | 223 GrPrimitiveEdgeType edgeType = |
| 227 random->nextULessThan(kGrPro
cessorEdgeTypeCnt)); | 224 static_cast<GrPrimitiveEdgeType>( |
| 228 gp = GrConicEffect::Create(GrRandomColor(random), GrTest::TestMatrix(ran
dom), | 225 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); |
| 229 edgeType, caps, | 226 gp = GrConicEffect::Create(GrRandomColor(d->fRandom), GrTest::TestMatrix
(d->fRandom), |
| 230 GrTest::TestMatrix(random), random->nextBool(
)); | 227 edgeType, *d->fCaps, |
| 228 GrTest::TestMatrix(d->fRandom), d->fRandom->n
extBool()); |
| 231 } while (NULL == gp); | 229 } while (NULL == gp); |
| 232 return gp; | 230 return gp; |
| 233 } | 231 } |
| 234 | 232 |
| 235 ////////////////////////////////////////////////////////////////////////////// | 233 ////////////////////////////////////////////////////////////////////////////// |
| 236 // Quad | 234 // Quad |
| 237 ////////////////////////////////////////////////////////////////////////////// | 235 ////////////////////////////////////////////////////////////////////////////// |
| 238 | 236 |
| 239 class GrGLQuadEffect : public GrGLGeometryProcessor { | 237 class GrGLQuadEffect : public GrGLGeometryProcessor { |
| 240 public: | 238 public: |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType, | 418 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType, |
| 421 kHigh_GrSLPrecision)); | 419 kHigh_GrSLPrecision)); |
| 422 fInHairQuadEdge = &this->addVertexAttrib(Attribute("inHairQuadEdge", | 420 fInHairQuadEdge = &this->addVertexAttrib(Attribute("inHairQuadEdge", |
| 423 kVec4f_GrVertexAttribTyp
e)); | 421 kVec4f_GrVertexAttribTyp
e)); |
| 424 } | 422 } |
| 425 | 423 |
| 426 ////////////////////////////////////////////////////////////////////////////// | 424 ////////////////////////////////////////////////////////////////////////////// |
| 427 | 425 |
| 428 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrQuadEffect); | 426 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrQuadEffect); |
| 429 | 427 |
| 430 GrGeometryProcessor* GrQuadEffect::TestCreate(SkRandom* random, | 428 GrGeometryProcessor* GrQuadEffect::TestCreate(GrProcessorTestData* d) { |
| 431 GrContext*, | |
| 432 const GrCaps& caps, | |
| 433 GrTexture*[]) { | |
| 434 GrGeometryProcessor* gp; | 429 GrGeometryProcessor* gp; |
| 435 do { | 430 do { |
| 436 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( | 431 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( |
| 437 random->nextULessThan(kGrProcessorEdgeTypeCnt)); | 432 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); |
| 438 gp = GrQuadEffect::Create(GrRandomColor(random), | 433 gp = GrQuadEffect::Create(GrRandomColor(d->fRandom), |
| 439 GrTest::TestMatrix(random), | 434 GrTest::TestMatrix(d->fRandom), |
| 440 edgeType, caps, | 435 edgeType, *d->fCaps, |
| 441 GrTest::TestMatrix(random), | 436 GrTest::TestMatrix(d->fRandom), |
| 442 random->nextBool()); | 437 d->fRandom->nextBool()); |
| 443 } while (NULL == gp); | 438 } while (NULL == gp); |
| 444 return gp; | 439 return gp; |
| 445 } | 440 } |
| 446 | 441 |
| 447 ////////////////////////////////////////////////////////////////////////////// | 442 ////////////////////////////////////////////////////////////////////////////// |
| 448 // Cubic | 443 // Cubic |
| 449 ////////////////////////////////////////////////////////////////////////////// | 444 ////////////////////////////////////////////////////////////////////////////// |
| 450 | 445 |
| 451 class GrGLCubicEffect : public GrGLGeometryProcessor { | 446 class GrGLCubicEffect : public GrGLGeometryProcessor { |
| 452 public: | 447 public: |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType, | 638 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType, |
| 644 kHigh_GrSLPrecision)); | 639 kHigh_GrSLPrecision)); |
| 645 fInCubicCoeffs = &this->addVertexAttrib(Attribute("inCubicCoeffs", | 640 fInCubicCoeffs = &this->addVertexAttrib(Attribute("inCubicCoeffs", |
| 646 kVec4f_GrVertexAttribTyp
e)); | 641 kVec4f_GrVertexAttribTyp
e)); |
| 647 } | 642 } |
| 648 | 643 |
| 649 ////////////////////////////////////////////////////////////////////////////// | 644 ////////////////////////////////////////////////////////////////////////////// |
| 650 | 645 |
| 651 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrCubicEffect); | 646 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrCubicEffect); |
| 652 | 647 |
| 653 GrGeometryProcessor* GrCubicEffect::TestCreate(SkRandom* random, | 648 GrGeometryProcessor* GrCubicEffect::TestCreate(GrProcessorTestData* d) { |
| 654 GrContext*, | |
| 655 const GrCaps& caps, | |
| 656 GrTexture*[]) { | |
| 657 GrGeometryProcessor* gp; | 649 GrGeometryProcessor* gp; |
| 658 do { | 650 do { |
| 659 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( | 651 GrPrimitiveEdgeType edgeType = |
| 660 random->nextULessThan(kGrPro
cessorEdgeTypeCnt)); | 652 static_cast<GrPrimitiveEdgeType>( |
| 661 gp = GrCubicEffect::Create(GrRandomColor(random), | 653 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); |
| 662 GrTest::TestMatrix(random), edgeType, caps); | 654 gp = GrCubicEffect::Create(GrRandomColor(d->fRandom), |
| 655 GrTest::TestMatrix(d->fRandom), edgeType, *d-
>fCaps); |
| 663 } while (NULL == gp); | 656 } while (NULL == gp); |
| 664 return gp; | 657 return gp; |
| 665 } | 658 } |
| 666 | 659 |
| OLD | NEW |