| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 GrGLConicEffect::GenKey(*this, bt, caps, b); | 184 GrGLConicEffect::GenKey(*this, bt, caps, b); |
| 185 } | 185 } |
| 186 | 186 |
| 187 GrGLPrimitiveProcessor* GrConicEffect::createGLInstance(const GrBatchTracker& bt
, | 187 GrGLPrimitiveProcessor* GrConicEffect::createGLInstance(const GrBatchTracker& bt
, |
| 188 const GrGLSLCaps&) const
{ | 188 const GrGLSLCaps&) const
{ |
| 189 return SkNEW_ARGS(GrGLConicEffect, (*this, bt)); | 189 return SkNEW_ARGS(GrGLConicEffect, (*this, bt)); |
| 190 } | 190 } |
| 191 | 191 |
| 192 GrConicEffect::GrConicEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t
coverage, | 192 GrConicEffect::GrConicEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t
coverage, |
| 193 GrPrimitiveEdgeType edgeType, const SkMatrix& local
Matrix) | 193 GrPrimitiveEdgeType edgeType, const SkMatrix& local
Matrix) |
| 194 : INHERITED(color, viewMatrix, localMatrix) | 194 : INHERITED(viewMatrix, localMatrix) |
| 195 , fColor(color) |
| 195 , fCoverageScale(coverage) | 196 , fCoverageScale(coverage) |
| 196 , fEdgeType(edgeType) { | 197 , fEdgeType(edgeType) { |
| 197 this->initClassID<GrConicEffect>(); | 198 this->initClassID<GrConicEffect>(); |
| 198 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); | 199 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); |
| 199 fInConicCoeffs = &this->addVertexAttrib(Attribute("inConicCoeffs", | 200 fInConicCoeffs = &this->addVertexAttrib(Attribute("inConicCoeffs", |
| 200 kVec4f_GrVertexAttribTyp
e)); | 201 kVec4f_GrVertexAttribTyp
e)); |
| 201 } | 202 } |
| 202 | 203 |
| 203 void GrConicEffect::initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& i
nit) const { | 204 void GrConicEffect::initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& i
nit) const { |
| 204 ConicBatchTracker* local = bt->cast<ConicBatchTracker>(); | 205 ConicBatchTracker* local = bt->cast<ConicBatchTracker>(); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 GrGLQuadEffect::GenKey(*this, bt, caps, b); | 389 GrGLQuadEffect::GenKey(*this, bt, caps, b); |
| 389 } | 390 } |
| 390 | 391 |
| 391 GrGLPrimitiveProcessor* GrQuadEffect::createGLInstance(const GrBatchTracker& bt, | 392 GrGLPrimitiveProcessor* GrQuadEffect::createGLInstance(const GrBatchTracker& bt, |
| 392 const GrGLSLCaps&) const
{ | 393 const GrGLSLCaps&) const
{ |
| 393 return SkNEW_ARGS(GrGLQuadEffect, (*this, bt)); | 394 return SkNEW_ARGS(GrGLQuadEffect, (*this, bt)); |
| 394 } | 395 } |
| 395 | 396 |
| 396 GrQuadEffect::GrQuadEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t co
verage, | 397 GrQuadEffect::GrQuadEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t co
verage, |
| 397 GrPrimitiveEdgeType edgeType, const SkMatrix& localMa
trix) | 398 GrPrimitiveEdgeType edgeType, const SkMatrix& localMa
trix) |
| 398 : INHERITED(color, viewMatrix, localMatrix) | 399 : INHERITED(viewMatrix, localMatrix) |
| 400 , fColor(color) |
| 399 , fCoverageScale(coverage) | 401 , fCoverageScale(coverage) |
| 400 , fEdgeType(edgeType) { | 402 , fEdgeType(edgeType) { |
| 401 this->initClassID<GrQuadEffect>(); | 403 this->initClassID<GrQuadEffect>(); |
| 402 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); | 404 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); |
| 403 fInHairQuadEdge = &this->addVertexAttrib(Attribute("inHairQuadEdge", | 405 fInHairQuadEdge = &this->addVertexAttrib(Attribute("inHairQuadEdge", |
| 404 kVec4f_GrVertexAttribTyp
e)); | 406 kVec4f_GrVertexAttribTyp
e)); |
| 405 } | 407 } |
| 406 | 408 |
| 407 void GrQuadEffect::initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& in
it) const { | 409 void GrQuadEffect::initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& in
it) const { |
| 408 QuadBatchTracker* local = bt->cast<QuadBatchTracker>(); | 410 QuadBatchTracker* local = bt->cast<QuadBatchTracker>(); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 GrGLCubicEffect::GenKey(*this, bt, caps, b); | 617 GrGLCubicEffect::GenKey(*this, bt, caps, b); |
| 616 } | 618 } |
| 617 | 619 |
| 618 GrGLPrimitiveProcessor* GrCubicEffect::createGLInstance(const GrBatchTracker& bt
, | 620 GrGLPrimitiveProcessor* GrCubicEffect::createGLInstance(const GrBatchTracker& bt
, |
| 619 const GrGLSLCaps&) const
{ | 621 const GrGLSLCaps&) const
{ |
| 620 return SkNEW_ARGS(GrGLCubicEffect, (*this, bt)); | 622 return SkNEW_ARGS(GrGLCubicEffect, (*this, bt)); |
| 621 } | 623 } |
| 622 | 624 |
| 623 GrCubicEffect::GrCubicEffect(GrColor color, const SkMatrix& viewMatrix, | 625 GrCubicEffect::GrCubicEffect(GrColor color, const SkMatrix& viewMatrix, |
| 624 GrPrimitiveEdgeType edgeType) | 626 GrPrimitiveEdgeType edgeType) |
| 625 : INHERITED(color, viewMatrix), fEdgeType(edgeType) { | 627 : INHERITED(viewMatrix) |
| 628 , fColor(color) |
| 629 , fEdgeType(edgeType) { |
| 626 this->initClassID<GrCubicEffect>(); | 630 this->initClassID<GrCubicEffect>(); |
| 627 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); | 631 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); |
| 628 fInCubicCoeffs = &this->addVertexAttrib(Attribute("inCubicCoeffs", | 632 fInCubicCoeffs = &this->addVertexAttrib(Attribute("inCubicCoeffs", |
| 629 kVec4f_GrVertexAttribTyp
e)); | 633 kVec4f_GrVertexAttribTyp
e)); |
| 630 } | 634 } |
| 631 | 635 |
| 632 void GrCubicEffect::initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& i
nit) const { | 636 void GrCubicEffect::initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& i
nit) const { |
| 633 CubicBatchTracker* local = bt->cast<CubicBatchTracker>(); | 637 CubicBatchTracker* local = bt->cast<CubicBatchTracker>(); |
| 634 local->fInputColorType = GetColorInputType(&local->fColor, this->color(), in
it, false); | 638 local->fInputColorType = GetColorInputType(&local->fColor, this->color(), in
it, false); |
| 635 local->fUsesLocalCoords = init.fUsesLocalCoords; | 639 local->fUsesLocalCoords = init.fUsesLocalCoords; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 646 GrGeometryProcessor* gp; | 650 GrGeometryProcessor* gp; |
| 647 do { | 651 do { |
| 648 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( | 652 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( |
| 649 random->nextULessThan(kGrPro
cessorEdgeTypeCnt)); | 653 random->nextULessThan(kGrPro
cessorEdgeTypeCnt)); |
| 650 gp = GrCubicEffect::Create(GrRandomColor(random), | 654 gp = GrCubicEffect::Create(GrRandomColor(random), |
| 651 GrTest::TestMatrix(random), edgeType, caps); | 655 GrTest::TestMatrix(random), edgeType, caps); |
| 652 } while (NULL == gp); | 656 } while (NULL == gp); |
| 653 return gp; | 657 return gp; |
| 654 } | 658 } |
| 655 | 659 |
| OLD | NEW |