| 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 const GrGLCaps&) const { | 191 const GrGLCaps&) const { |
| 192 return SkNEW_ARGS(GrGLConicEffect, (*this, bt)); | 192 return SkNEW_ARGS(GrGLConicEffect, (*this, bt)); |
| 193 } | 193 } |
| 194 | 194 |
| 195 GrConicEffect::GrConicEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t
coverage, | 195 GrConicEffect::GrConicEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t
coverage, |
| 196 GrPrimitiveEdgeType edgeType, const SkMatrix& local
Matrix) | 196 GrPrimitiveEdgeType edgeType, const SkMatrix& local
Matrix) |
| 197 : INHERITED(color, viewMatrix, localMatrix) | 197 : INHERITED(color, viewMatrix, localMatrix) |
| 198 , fCoverageScale(coverage) | 198 , fCoverageScale(coverage) |
| 199 , fEdgeType(edgeType) { | 199 , fEdgeType(edgeType) { |
| 200 this->initClassID<GrConicEffect>(); | 200 this->initClassID<GrConicEffect>(); |
| 201 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVert
exAttribType)); | 201 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); |
| 202 fInConicCoeffs = &this->addVertexAttrib(GrAttribute("inConicCoeffs", | 202 fInConicCoeffs = &this->addVertexAttrib(Attribute("inConicCoeffs", |
| 203 kVec4f_GrVertexAttribTyp
e)); | 203 kVec4f_GrVertexAttribTyp
e)); |
| 204 } | 204 } |
| 205 | 205 |
| 206 bool GrConicEffect::onIsEqual(const GrGeometryProcessor& other) const { | 206 bool GrConicEffect::onIsEqual(const GrGeometryProcessor& other) const { |
| 207 const GrConicEffect& ce = other.cast<GrConicEffect>(); | 207 const GrConicEffect& ce = other.cast<GrConicEffect>(); |
| 208 return (ce.fEdgeType == fEdgeType); | 208 return (ce.fEdgeType == fEdgeType); |
| 209 } | 209 } |
| 210 | 210 |
| 211 void GrConicEffect::initBatchTracker(GrBatchTracker* bt, const InitBT& init) con
st { | 211 void GrConicEffect::initBatchTracker(GrBatchTracker* bt, const InitBT& init) con
st { |
| 212 ConicBatchTracker* local = bt->cast<ConicBatchTracker>(); | 212 ConicBatchTracker* local = bt->cast<ConicBatchTracker>(); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 const GrGLCaps&) const { | 415 const GrGLCaps&) const { |
| 416 return SkNEW_ARGS(GrGLQuadEffect, (*this, bt)); | 416 return SkNEW_ARGS(GrGLQuadEffect, (*this, bt)); |
| 417 } | 417 } |
| 418 | 418 |
| 419 GrQuadEffect::GrQuadEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t co
verage, | 419 GrQuadEffect::GrQuadEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t co
verage, |
| 420 GrPrimitiveEdgeType edgeType, const SkMatrix& localMa
trix) | 420 GrPrimitiveEdgeType edgeType, const SkMatrix& localMa
trix) |
| 421 : INHERITED(color, viewMatrix, localMatrix) | 421 : INHERITED(color, viewMatrix, localMatrix) |
| 422 , fCoverageScale(coverage) | 422 , fCoverageScale(coverage) |
| 423 , fEdgeType(edgeType) { | 423 , fEdgeType(edgeType) { |
| 424 this->initClassID<GrQuadEffect>(); | 424 this->initClassID<GrQuadEffect>(); |
| 425 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVert
exAttribType)); | 425 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); |
| 426 fInHairQuadEdge = &this->addVertexAttrib(GrAttribute("inHairQuadEdge", | 426 fInHairQuadEdge = &this->addVertexAttrib(Attribute("inHairQuadEdge", |
| 427 kVec4f_GrVertexAttribTyp
e)); | 427 kVec4f_GrVertexAttribTyp
e)); |
| 428 } | 428 } |
| 429 | 429 |
| 430 bool GrQuadEffect::onIsEqual(const GrGeometryProcessor& other) const { | 430 bool GrQuadEffect::onIsEqual(const GrGeometryProcessor& other) const { |
| 431 const GrQuadEffect& ce = other.cast<GrQuadEffect>(); | 431 const GrQuadEffect& ce = other.cast<GrQuadEffect>(); |
| 432 return (ce.fEdgeType == fEdgeType); | 432 return (ce.fEdgeType == fEdgeType); |
| 433 } | 433 } |
| 434 | 434 |
| 435 void GrQuadEffect::initBatchTracker(GrBatchTracker* bt, const InitBT& init) cons
t { | 435 void GrQuadEffect::initBatchTracker(GrBatchTracker* bt, const InitBT& init) cons
t { |
| 436 QuadBatchTracker* local = bt->cast<QuadBatchTracker>(); | 436 QuadBatchTracker* local = bt->cast<QuadBatchTracker>(); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 | 660 |
| 661 GrGLPrimitiveProcessor* GrCubicEffect::createGLInstance(const GrBatchTracker& bt
, | 661 GrGLPrimitiveProcessor* GrCubicEffect::createGLInstance(const GrBatchTracker& bt
, |
| 662 const GrGLCaps&) const { | 662 const GrGLCaps&) const { |
| 663 return SkNEW_ARGS(GrGLCubicEffect, (*this, bt)); | 663 return SkNEW_ARGS(GrGLCubicEffect, (*this, bt)); |
| 664 } | 664 } |
| 665 | 665 |
| 666 GrCubicEffect::GrCubicEffect(GrColor color, const SkMatrix& viewMatrix, | 666 GrCubicEffect::GrCubicEffect(GrColor color, const SkMatrix& viewMatrix, |
| 667 GrPrimitiveEdgeType edgeType) | 667 GrPrimitiveEdgeType edgeType) |
| 668 : INHERITED(color, viewMatrix), fEdgeType(edgeType) { | 668 : INHERITED(color, viewMatrix), fEdgeType(edgeType) { |
| 669 this->initClassID<GrCubicEffect>(); | 669 this->initClassID<GrCubicEffect>(); |
| 670 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVert
exAttribType)); | 670 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); |
| 671 fInCubicCoeffs = &this->addVertexAttrib(GrAttribute("inCubicCoeffs", | 671 fInCubicCoeffs = &this->addVertexAttrib(Attribute("inCubicCoeffs", |
| 672 kVec4f_GrVertexAttribTyp
e)); | 672 kVec4f_GrVertexAttribTyp
e)); |
| 673 } | 673 } |
| 674 | 674 |
| 675 bool GrCubicEffect::onIsEqual(const GrGeometryProcessor& other) const { | 675 bool GrCubicEffect::onIsEqual(const GrGeometryProcessor& other) const { |
| 676 const GrCubicEffect& ce = other.cast<GrCubicEffect>(); | 676 const GrCubicEffect& ce = other.cast<GrCubicEffect>(); |
| 677 return (ce.fEdgeType == fEdgeType); | 677 return (ce.fEdgeType == fEdgeType); |
| 678 } | 678 } |
| 679 | 679 |
| 680 void GrCubicEffect::initBatchTracker(GrBatchTracker* bt, const InitBT& init) con
st { | 680 void GrCubicEffect::initBatchTracker(GrBatchTracker* bt, const InitBT& init) con
st { |
| 681 CubicBatchTracker* local = bt->cast<CubicBatchTracker>(); | 681 CubicBatchTracker* local = bt->cast<CubicBatchTracker>(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 705 GrGeometryProcessor* gp; | 705 GrGeometryProcessor* gp; |
| 706 do { | 706 do { |
| 707 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( | 707 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( |
| 708 random->nextULessThan(kGrPro
cessorEdgeTypeCnt)); | 708 random->nextULessThan(kGrPro
cessorEdgeTypeCnt)); |
| 709 gp = GrCubicEffect::Create(GrRandomColor(random), | 709 gp = GrCubicEffect::Create(GrRandomColor(random), |
| 710 GrProcessorUnitTest::TestMatrix(random), edge
Type, caps); | 710 GrProcessorUnitTest::TestMatrix(random), edge
Type, caps); |
| 711 } while (NULL == gp); | 711 } while (NULL == gp); |
| 712 return gp; | 712 return gp; |
| 713 } | 713 } |
| 714 | 714 |
| OLD | NEW |