| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 const GrGLCaps&) const { | 194 const GrGLCaps&) const { |
| 195 return SkNEW_ARGS(GrGLConicEffect, (*this, bt)); | 195 return SkNEW_ARGS(GrGLConicEffect, (*this, bt)); |
| 196 } | 196 } |
| 197 | 197 |
| 198 GrConicEffect::GrConicEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t
coverage, | 198 GrConicEffect::GrConicEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t
coverage, |
| 199 GrPrimitiveEdgeType edgeType, const SkMatrix& local
Matrix) | 199 GrPrimitiveEdgeType edgeType, const SkMatrix& local
Matrix) |
| 200 : INHERITED(color, viewMatrix, localMatrix) | 200 : INHERITED(color, viewMatrix, localMatrix) |
| 201 , fCoverageScale(coverage) | 201 , fCoverageScale(coverage) |
| 202 , fEdgeType(edgeType) { | 202 , fEdgeType(edgeType) { |
| 203 this->initClassID<GrConicEffect>(); | 203 this->initClassID<GrConicEffect>(); |
| 204 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVert
exAttribType)); | 204 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); |
| 205 fInConicCoeffs = &this->addVertexAttrib(GrAttribute("inConicCoeffs", | 205 fInConicCoeffs = &this->addVertexAttrib(Attribute("inConicCoeffs", |
| 206 kVec4f_GrVertexAttribTyp
e)); | 206 kVec4f_GrVertexAttribTyp
e)); |
| 207 } | 207 } |
| 208 | 208 |
| 209 bool GrConicEffect::onIsEqual(const GrGeometryProcessor& other) const { | 209 bool GrConicEffect::onIsEqual(const GrGeometryProcessor& other) const { |
| 210 const GrConicEffect& ce = other.cast<GrConicEffect>(); | 210 const GrConicEffect& ce = other.cast<GrConicEffect>(); |
| 211 return (ce.fEdgeType == fEdgeType); | 211 return (ce.fEdgeType == fEdgeType); |
| 212 } | 212 } |
| 213 | 213 |
| 214 void GrConicEffect::initBatchTracker(GrBatchTracker* bt, const InitBT& init) con
st { | 214 void GrConicEffect::initBatchTracker(GrBatchTracker* bt, const InitBT& init) con
st { |
| 215 ConicBatchTracker* local = bt->cast<ConicBatchTracker>(); | 215 ConicBatchTracker* local = bt->cast<ConicBatchTracker>(); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 const GrGLCaps&) const { | 421 const GrGLCaps&) const { |
| 422 return SkNEW_ARGS(GrGLQuadEffect, (*this, bt)); | 422 return SkNEW_ARGS(GrGLQuadEffect, (*this, bt)); |
| 423 } | 423 } |
| 424 | 424 |
| 425 GrQuadEffect::GrQuadEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t co
verage, | 425 GrQuadEffect::GrQuadEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t co
verage, |
| 426 GrPrimitiveEdgeType edgeType, const SkMatrix& localMa
trix) | 426 GrPrimitiveEdgeType edgeType, const SkMatrix& localMa
trix) |
| 427 : INHERITED(color, viewMatrix, localMatrix) | 427 : INHERITED(color, viewMatrix, localMatrix) |
| 428 , fCoverageScale(coverage) | 428 , fCoverageScale(coverage) |
| 429 , fEdgeType(edgeType) { | 429 , fEdgeType(edgeType) { |
| 430 this->initClassID<GrQuadEffect>(); | 430 this->initClassID<GrQuadEffect>(); |
| 431 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVert
exAttribType)); | 431 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); |
| 432 fInHairQuadEdge = &this->addVertexAttrib(GrAttribute("inHairQuadEdge", | 432 fInHairQuadEdge = &this->addVertexAttrib(Attribute("inHairQuadEdge", |
| 433 kVec4f_GrVertexAttribTyp
e)); | 433 kVec4f_GrVertexAttribTyp
e)); |
| 434 } | 434 } |
| 435 | 435 |
| 436 bool GrQuadEffect::onIsEqual(const GrGeometryProcessor& other) const { | 436 bool GrQuadEffect::onIsEqual(const GrGeometryProcessor& other) const { |
| 437 const GrQuadEffect& ce = other.cast<GrQuadEffect>(); | 437 const GrQuadEffect& ce = other.cast<GrQuadEffect>(); |
| 438 return (ce.fEdgeType == fEdgeType); | 438 return (ce.fEdgeType == fEdgeType); |
| 439 } | 439 } |
| 440 | 440 |
| 441 void GrQuadEffect::initBatchTracker(GrBatchTracker* bt, const InitBT& init) cons
t { | 441 void GrQuadEffect::initBatchTracker(GrBatchTracker* bt, const InitBT& init) cons
t { |
| 442 QuadBatchTracker* local = bt->cast<QuadBatchTracker>(); | 442 QuadBatchTracker* local = bt->cast<QuadBatchTracker>(); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 | 669 |
| 670 GrGLPrimitiveProcessor* GrCubicEffect::createGLInstance(const GrBatchTracker& bt
, | 670 GrGLPrimitiveProcessor* GrCubicEffect::createGLInstance(const GrBatchTracker& bt
, |
| 671 const GrGLCaps&) const { | 671 const GrGLCaps&) const { |
| 672 return SkNEW_ARGS(GrGLCubicEffect, (*this, bt)); | 672 return SkNEW_ARGS(GrGLCubicEffect, (*this, bt)); |
| 673 } | 673 } |
| 674 | 674 |
| 675 GrCubicEffect::GrCubicEffect(GrColor color, const SkMatrix& viewMatrix, | 675 GrCubicEffect::GrCubicEffect(GrColor color, const SkMatrix& viewMatrix, |
| 676 GrPrimitiveEdgeType edgeType) | 676 GrPrimitiveEdgeType edgeType) |
| 677 : INHERITED(color, viewMatrix), fEdgeType(edgeType) { | 677 : INHERITED(color, viewMatrix), fEdgeType(edgeType) { |
| 678 this->initClassID<GrCubicEffect>(); | 678 this->initClassID<GrCubicEffect>(); |
| 679 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVert
exAttribType)); | 679 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); |
| 680 fInCubicCoeffs = &this->addVertexAttrib(GrAttribute("inCubicCoeffs", | 680 fInCubicCoeffs = &this->addVertexAttrib(Attribute("inCubicCoeffs", |
| 681 kVec4f_GrVertexAttribTyp
e)); | 681 kVec4f_GrVertexAttribTyp
e)); |
| 682 } | 682 } |
| 683 | 683 |
| 684 bool GrCubicEffect::onIsEqual(const GrGeometryProcessor& other) const { | 684 bool GrCubicEffect::onIsEqual(const GrGeometryProcessor& other) const { |
| 685 const GrCubicEffect& ce = other.cast<GrCubicEffect>(); | 685 const GrCubicEffect& ce = other.cast<GrCubicEffect>(); |
| 686 return (ce.fEdgeType == fEdgeType); | 686 return (ce.fEdgeType == fEdgeType); |
| 687 } | 687 } |
| 688 | 688 |
| 689 void GrCubicEffect::initBatchTracker(GrBatchTracker* bt, const InitBT& init) con
st { | 689 void GrCubicEffect::initBatchTracker(GrBatchTracker* bt, const InitBT& init) con
st { |
| 690 CubicBatchTracker* local = bt->cast<CubicBatchTracker>(); | 690 CubicBatchTracker* local = bt->cast<CubicBatchTracker>(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 714 GrGeometryProcessor* gp; | 714 GrGeometryProcessor* gp; |
| 715 do { | 715 do { |
| 716 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( | 716 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( |
| 717 random->nextULessThan(kGrPro
cessorEdgeTypeCnt)); | 717 random->nextULessThan(kGrPro
cessorEdgeTypeCnt)); |
| 718 gp = GrCubicEffect::Create(GrRandomColor(random), | 718 gp = GrCubicEffect::Create(GrRandomColor(random), |
| 719 GrProcessorUnitTest::TestMatrix(random), edge
Type, caps); | 719 GrProcessorUnitTest::TestMatrix(random), edge
Type, caps); |
| 720 } while (NULL == gp); | 720 } while (NULL == gp); |
| 721 return gp; | 721 return gp; |
| 722 } | 722 } |
| 723 | 723 |
| OLD | NEW |