| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 void GrConicEffect::getGLProcessorKey(const GrBatchTracker& bt, | 176 void GrConicEffect::getGLProcessorKey(const GrBatchTracker& bt, |
| 177 const GrGLCaps& caps, | 177 const GrGLCaps& caps, |
| 178 GrProcessorKeyBuilder* b) const { | 178 GrProcessorKeyBuilder* b) const { |
| 179 GrGLConicEffect::GenKey(*this, bt, caps, b); | 179 GrGLConicEffect::GenKey(*this, bt, caps, b); |
| 180 } | 180 } |
| 181 | 181 |
| 182 GrGLGeometryProcessor* GrConicEffect::createGLInstance(const GrBatchTracker& bt)
const { | 182 GrGLGeometryProcessor* GrConicEffect::createGLInstance(const GrBatchTracker& bt)
const { |
| 183 return SkNEW_ARGS(GrGLConicEffect, (*this, bt)); | 183 return SkNEW_ARGS(GrGLConicEffect, (*this, bt)); |
| 184 } | 184 } |
| 185 | 185 |
| 186 GrConicEffect::GrConicEffect(GrColor color, uint8_t coverage, GrPrimitiveEdgeTyp
e edgeType) | 186 GrConicEffect::GrConicEffect(GrColor color, uint8_t coverage, GrPrimitiveEdgeTyp
e edgeType, |
| 187 : INHERITED(color, false), fCoverageScale(coverage), fEdgeType(edgeType) { | 187 const SkMatrix& localMatrix) |
| 188 : INHERITED(color, false, localMatrix), fCoverageScale(coverage), fEdgeType(
edgeType) { |
| 188 this->initClassID<GrConicEffect>(); | 189 this->initClassID<GrConicEffect>(); |
| 189 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVert
exAttribType)); | 190 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVert
exAttribType)); |
| 190 fInConicCoeffs = &this->addVertexAttrib(GrAttribute("inConicCoeffs", | 191 fInConicCoeffs = &this->addVertexAttrib(GrAttribute("inConicCoeffs", |
| 191 kVec4f_GrVertexAttribTyp
e)); | 192 kVec4f_GrVertexAttribTyp
e)); |
| 192 } | 193 } |
| 193 | 194 |
| 194 bool GrConicEffect::onIsEqual(const GrGeometryProcessor& other) const { | 195 bool GrConicEffect::onIsEqual(const GrGeometryProcessor& other) const { |
| 195 const GrConicEffect& ce = other.cast<GrConicEffect>(); | 196 const GrConicEffect& ce = other.cast<GrConicEffect>(); |
| 196 return (ce.fEdgeType == fEdgeType); | 197 return (ce.fEdgeType == fEdgeType); |
| 197 } | 198 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 220 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrConicEffect); | 221 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrConicEffect); |
| 221 | 222 |
| 222 GrGeometryProcessor* GrConicEffect::TestCreate(SkRandom* random, | 223 GrGeometryProcessor* GrConicEffect::TestCreate(SkRandom* random, |
| 223 GrContext*, | 224 GrContext*, |
| 224 const GrDrawTargetCaps& caps, | 225 const GrDrawTargetCaps& caps, |
| 225 GrTexture*[]) { | 226 GrTexture*[]) { |
| 226 GrGeometryProcessor* gp; | 227 GrGeometryProcessor* gp; |
| 227 do { | 228 do { |
| 228 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( | 229 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( |
| 229 random->nextULessThan(kGrPro
cessorEdgeTypeCnt)); | 230 random->nextULessThan(kGrPro
cessorEdgeTypeCnt)); |
| 230 gp = GrConicEffect::Create(GrRandomColor(random), edgeType, caps); | 231 gp = GrConicEffect::Create(GrRandomColor(random), edgeType, caps, |
| 232 GrProcessorUnitTest::TestMatrix(random)); |
| 231 } while (NULL == gp); | 233 } while (NULL == gp); |
| 232 return gp; | 234 return gp; |
| 233 } | 235 } |
| 234 | 236 |
| 235 ////////////////////////////////////////////////////////////////////////////// | 237 ////////////////////////////////////////////////////////////////////////////// |
| 236 // Quad | 238 // Quad |
| 237 ////////////////////////////////////////////////////////////////////////////// | 239 ////////////////////////////////////////////////////////////////////////////// |
| 238 | 240 |
| 239 struct QuadBatchTracker { | 241 struct QuadBatchTracker { |
| 240 GrGPInput fInputColorType; | 242 GrGPInput fInputColorType; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 void GrQuadEffect::getGLProcessorKey(const GrBatchTracker& bt, | 388 void GrQuadEffect::getGLProcessorKey(const GrBatchTracker& bt, |
| 387 const GrGLCaps& caps, | 389 const GrGLCaps& caps, |
| 388 GrProcessorKeyBuilder* b) const { | 390 GrProcessorKeyBuilder* b) const { |
| 389 GrGLQuadEffect::GenKey(*this, bt, caps, b); | 391 GrGLQuadEffect::GenKey(*this, bt, caps, b); |
| 390 } | 392 } |
| 391 | 393 |
| 392 GrGLGeometryProcessor* GrQuadEffect::createGLInstance(const GrBatchTracker& bt)
const { | 394 GrGLGeometryProcessor* GrQuadEffect::createGLInstance(const GrBatchTracker& bt)
const { |
| 393 return SkNEW_ARGS(GrGLQuadEffect, (*this, bt)); | 395 return SkNEW_ARGS(GrGLQuadEffect, (*this, bt)); |
| 394 } | 396 } |
| 395 | 397 |
| 396 GrQuadEffect::GrQuadEffect(GrColor color, uint8_t coverage, GrPrimitiveEdgeType
edgeType) | 398 GrQuadEffect::GrQuadEffect(GrColor color, uint8_t coverage, GrPrimitiveEdgeType
edgeType, |
| 397 : INHERITED(color, false), fCoverageScale(coverage), fEdgeType(edgeType) { | 399 const SkMatrix& localMatrix) |
| 400 : INHERITED(color, false, localMatrix), fCoverageScale(coverage), fEdgeType(
edgeType) { |
| 398 this->initClassID<GrQuadEffect>(); | 401 this->initClassID<GrQuadEffect>(); |
| 399 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVert
exAttribType)); | 402 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVert
exAttribType)); |
| 400 fInHairQuadEdge = &this->addVertexAttrib(GrAttribute("inHairQuadEdge", | 403 fInHairQuadEdge = &this->addVertexAttrib(GrAttribute("inHairQuadEdge", |
| 401 kVec4f_GrVertexAttribTyp
e)); | 404 kVec4f_GrVertexAttribTyp
e)); |
| 402 } | 405 } |
| 403 | 406 |
| 404 bool GrQuadEffect::onIsEqual(const GrGeometryProcessor& other) const { | 407 bool GrQuadEffect::onIsEqual(const GrGeometryProcessor& other) const { |
| 405 const GrQuadEffect& ce = other.cast<GrQuadEffect>(); | 408 const GrQuadEffect& ce = other.cast<GrQuadEffect>(); |
| 406 return (ce.fEdgeType == fEdgeType); | 409 return (ce.fEdgeType == fEdgeType); |
| 407 } | 410 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 430 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrQuadEffect); | 433 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrQuadEffect); |
| 431 | 434 |
| 432 GrGeometryProcessor* GrQuadEffect::TestCreate(SkRandom* random, | 435 GrGeometryProcessor* GrQuadEffect::TestCreate(SkRandom* random, |
| 433 GrContext*, | 436 GrContext*, |
| 434 const GrDrawTargetCaps& caps, | 437 const GrDrawTargetCaps& caps, |
| 435 GrTexture*[]) { | 438 GrTexture*[]) { |
| 436 GrGeometryProcessor* gp; | 439 GrGeometryProcessor* gp; |
| 437 do { | 440 do { |
| 438 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( | 441 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( |
| 439 random->nextULessThan(kGrProcessorEdgeTypeCnt)); | 442 random->nextULessThan(kGrProcessorEdgeTypeCnt)); |
| 440 gp = GrQuadEffect::Create(GrRandomColor(random), edgeType, caps); | 443 gp = GrQuadEffect::Create(GrRandomColor(random), edgeType, caps, |
| 444 GrProcessorUnitTest::TestMatrix(random)); |
| 441 } while (NULL == gp); | 445 } while (NULL == gp); |
| 442 return gp; | 446 return gp; |
| 443 } | 447 } |
| 444 | 448 |
| 445 ////////////////////////////////////////////////////////////////////////////// | 449 ////////////////////////////////////////////////////////////////////////////// |
| 446 // Cubic | 450 // Cubic |
| 447 ////////////////////////////////////////////////////////////////////////////// | 451 ////////////////////////////////////////////////////////////////////////////// |
| 448 | 452 |
| 449 struct CubicBatchTracker { | 453 struct CubicBatchTracker { |
| 450 GrGPInput fInputColorType; | 454 GrGPInput fInputColorType; |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 GrTexture*[]) { | 669 GrTexture*[]) { |
| 666 GrGeometryProcessor* gp; | 670 GrGeometryProcessor* gp; |
| 667 do { | 671 do { |
| 668 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( | 672 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( |
| 669 random->nextULessThan(kGrPro
cessorEdgeTypeCnt)); | 673 random->nextULessThan(kGrPro
cessorEdgeTypeCnt)); |
| 670 gp = GrCubicEffect::Create(GrRandomColor(random), edgeType, caps); | 674 gp = GrCubicEffect::Create(GrRandomColor(random), edgeType, caps); |
| 671 } while (NULL == gp); | 675 } while (NULL == gp); |
| 672 return gp; | 676 return gp; |
| 673 } | 677 } |
| 674 | 678 |
| OLD | NEW |