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 "glsl/GrGLSLFragmentShaderBuilder.h" | 10 #include "glsl/GrGLSLFragmentShaderBuilder.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType, | 265 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType, |
266 kHigh_GrSLPrecision)); | 266 kHigh_GrSLPrecision)); |
267 fInConicCoeffs = &this->addVertexAttrib(Attribute("inConicCoeffs", | 267 fInConicCoeffs = &this->addVertexAttrib(Attribute("inConicCoeffs", |
268 kVec4f_GrVertexAttribType)
); | 268 kVec4f_GrVertexAttribType)
); |
269 } | 269 } |
270 | 270 |
271 ////////////////////////////////////////////////////////////////////////////// | 271 ////////////////////////////////////////////////////////////////////////////// |
272 | 272 |
273 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrConicEffect); | 273 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrConicEffect); |
274 | 274 |
275 const GrGeometryProcessor* GrConicEffect::TestCreate(GrProcessorTestData* d) { | 275 sk_sp<GrGeometryProcessor> GrConicEffect::TestCreate(GrProcessorTestData* d) { |
276 GrGeometryProcessor* gp; | 276 sk_sp<GrGeometryProcessor> gp; |
277 do { | 277 do { |
278 GrPrimitiveEdgeType edgeType = | 278 GrPrimitiveEdgeType edgeType = |
279 static_cast<GrPrimitiveEdgeType>( | 279 static_cast<GrPrimitiveEdgeType>( |
280 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); | 280 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); |
281 gp = GrConicEffect::Create(GrRandomColor(d->fRandom), GrTest::TestMatrix
(d->fRandom), | 281 gp = GrConicEffect::Make(GrRandomColor(d->fRandom), GrTest::TestMatrix(d
->fRandom), |
282 edgeType, *d->fCaps, | 282 edgeType, *d->fCaps, |
283 GrTest::TestMatrix(d->fRandom), d->fRandom->n
extBool()); | 283 GrTest::TestMatrix(d->fRandom), d->fRandom->nex
tBool()); |
284 } while (nullptr == gp); | 284 } while (nullptr == gp); |
285 return gp; | 285 return gp; |
286 } | 286 } |
287 | 287 |
288 ////////////////////////////////////////////////////////////////////////////// | 288 ////////////////////////////////////////////////////////////////////////////// |
289 // Quad | 289 // Quad |
290 ////////////////////////////////////////////////////////////////////////////// | 290 ////////////////////////////////////////////////////////////////////////////// |
291 | 291 |
292 class GrGLQuadEffect : public GrGLSLGeometryProcessor { | 292 class GrGLQuadEffect : public GrGLSLGeometryProcessor { |
293 public: | 293 public: |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType, | 481 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType, |
482 kHigh_GrSLPrecision)); | 482 kHigh_GrSLPrecision)); |
483 fInHairQuadEdge = &this->addVertexAttrib(Attribute("inHairQuadEdge", | 483 fInHairQuadEdge = &this->addVertexAttrib(Attribute("inHairQuadEdge", |
484 kVec4f_GrVertexAttribTyp
e)); | 484 kVec4f_GrVertexAttribTyp
e)); |
485 } | 485 } |
486 | 486 |
487 ////////////////////////////////////////////////////////////////////////////// | 487 ////////////////////////////////////////////////////////////////////////////// |
488 | 488 |
489 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrQuadEffect); | 489 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrQuadEffect); |
490 | 490 |
491 const GrGeometryProcessor* GrQuadEffect::TestCreate(GrProcessorTestData* d) { | 491 sk_sp<GrGeometryProcessor> GrQuadEffect::TestCreate(GrProcessorTestData* d) { |
492 GrGeometryProcessor* gp; | 492 sk_sp<GrGeometryProcessor> gp; |
493 do { | 493 do { |
494 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( | 494 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( |
495 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); | 495 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); |
496 gp = GrQuadEffect::Create(GrRandomColor(d->fRandom), | 496 gp = GrQuadEffect::Make(GrRandomColor(d->fRandom), |
497 GrTest::TestMatrix(d->fRandom), | 497 GrTest::TestMatrix(d->fRandom), |
498 edgeType, *d->fCaps, | 498 edgeType, *d->fCaps, |
499 GrTest::TestMatrix(d->fRandom), | 499 GrTest::TestMatrix(d->fRandom), |
500 d->fRandom->nextBool()); | 500 d->fRandom->nextBool()); |
501 } while (nullptr == gp); | 501 } while (nullptr == gp); |
502 return gp; | 502 return gp; |
503 } | 503 } |
504 | 504 |
505 ////////////////////////////////////////////////////////////////////////////// | 505 ////////////////////////////////////////////////////////////////////////////// |
506 // Cubic | 506 // Cubic |
507 ////////////////////////////////////////////////////////////////////////////// | 507 ////////////////////////////////////////////////////////////////////////////// |
508 | 508 |
509 class GrGLCubicEffect : public GrGLSLGeometryProcessor { | 509 class GrGLCubicEffect : public GrGLSLGeometryProcessor { |
510 public: | 510 public: |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType, | 709 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType, |
710 kHigh_GrSLPrecision)); | 710 kHigh_GrSLPrecision)); |
711 fInCubicCoeffs = &this->addVertexAttrib(Attribute("inCubicCoeffs", | 711 fInCubicCoeffs = &this->addVertexAttrib(Attribute("inCubicCoeffs", |
712 kVec4f_GrVertexAttribTyp
e)); | 712 kVec4f_GrVertexAttribTyp
e)); |
713 } | 713 } |
714 | 714 |
715 ////////////////////////////////////////////////////////////////////////////// | 715 ////////////////////////////////////////////////////////////////////////////// |
716 | 716 |
717 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrCubicEffect); | 717 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrCubicEffect); |
718 | 718 |
719 const GrGeometryProcessor* GrCubicEffect::TestCreate(GrProcessorTestData* d) { | 719 sk_sp<GrGeometryProcessor> GrCubicEffect::TestCreate(GrProcessorTestData* d) { |
720 GrGeometryProcessor* gp; | 720 sk_sp<GrGeometryProcessor> gp; |
721 do { | 721 do { |
722 GrPrimitiveEdgeType edgeType = | 722 GrPrimitiveEdgeType edgeType = |
723 static_cast<GrPrimitiveEdgeType>( | 723 static_cast<GrPrimitiveEdgeType>( |
724 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); | 724 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); |
725 gp = GrCubicEffect::Create(GrRandomColor(d->fRandom), | 725 gp = GrCubicEffect::Make(GrRandomColor(d->fRandom), |
726 GrTest::TestMatrix(d->fRandom), edgeType, *d-
>fCaps); | 726 GrTest::TestMatrix(d->fRandom), edgeType, *d->f
Caps); |
727 } while (nullptr == gp); | 727 } while (nullptr == gp); |
728 return gp; | 728 return gp; |
729 } | 729 } |
OLD | NEW |