| 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/GrGLFragmentProcessor.h" | 10 #include "gl/GrGLFragmentProcessor.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 typedef GrGLGeometryProcessor INHERITED; | 66 typedef GrGLGeometryProcessor INHERITED; |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 GrGLConicEffect::GrGLConicEffect(const GrGeometryProcessor& processor) | 69 GrGLConicEffect::GrGLConicEffect(const GrGeometryProcessor& processor) |
| 70 : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL), fCoverage
Scale(0xff) { | 70 : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL), fCoverage
Scale(0xff) { |
| 71 const GrConicEffect& ce = processor.cast<GrConicEffect>(); | 71 const GrConicEffect& ce = processor.cast<GrConicEffect>(); |
| 72 fEdgeType = ce.getEdgeType(); | 72 fEdgeType = ce.getEdgeType(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void GrGLConicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { | 75 void GrGLConicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { |
| 76 GrGLGPBuilder* pb = args.fPB; | 76 GrGLSLGPBuilder* pb = args.fPB; |
| 77 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); | 77 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); |
| 78 const GrConicEffect& gp = args.fGP.cast<GrConicEffect>(); | 78 const GrConicEffect& gp = args.fGP.cast<GrConicEffect>(); |
| 79 | 79 |
| 80 // emit attributes | 80 // emit attributes |
| 81 vsBuilder->emitAttributes(gp); | 81 vsBuilder->emitAttributes(gp); |
| 82 | 82 |
| 83 GrGLVertToFrag v(kVec4f_GrSLType); | 83 GrGLSLVertToFrag v(kVec4f_GrSLType); |
| 84 args.fPB->addVarying("ConicCoeffs", &v); | 84 args.fPB->addVarying("ConicCoeffs", &v); |
| 85 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), gp.inConicCoeffs()->fName); | 85 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), gp.inConicCoeffs()->fName); |
| 86 | 86 |
| 87 // Setup pass through color | 87 // Setup pass through color |
| 88 if (!gp.colorIgnored()) { | 88 if (!gp.colorIgnored()) { |
| 89 this->setupUniformColor(args.fPB, args.fOutputColor, &fColorUniform); | 89 this->setupUniformColor(args.fPB, args.fOutputColor, &fColorUniform); |
| 90 } | 90 } |
| 91 | 91 |
| 92 // Setup position | 92 // Setup position |
| 93 this->setupPosition(pb, gpArgs, gp.inPosition()->fName, gp.viewMatrix(), &fV
iewMatrixUniform); | 93 this->setupPosition(pb, gpArgs, gp.inPosition()->fName, gp.viewMatrix(), &fV
iewMatrixUniform); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 typedef GrGLGeometryProcessor INHERITED; | 282 typedef GrGLGeometryProcessor INHERITED; |
| 283 }; | 283 }; |
| 284 | 284 |
| 285 GrGLQuadEffect::GrGLQuadEffect(const GrGeometryProcessor& processor) | 285 GrGLQuadEffect::GrGLQuadEffect(const GrGeometryProcessor& processor) |
| 286 : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL), fCoverage
Scale(0xff) { | 286 : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL), fCoverage
Scale(0xff) { |
| 287 const GrQuadEffect& ce = processor.cast<GrQuadEffect>(); | 287 const GrQuadEffect& ce = processor.cast<GrQuadEffect>(); |
| 288 fEdgeType = ce.getEdgeType(); | 288 fEdgeType = ce.getEdgeType(); |
| 289 } | 289 } |
| 290 | 290 |
| 291 void GrGLQuadEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { | 291 void GrGLQuadEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { |
| 292 GrGLGPBuilder* pb = args.fPB; | 292 GrGLSLGPBuilder* pb = args.fPB; |
| 293 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); | 293 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); |
| 294 const GrQuadEffect& gp = args.fGP.cast<GrQuadEffect>(); | 294 const GrQuadEffect& gp = args.fGP.cast<GrQuadEffect>(); |
| 295 | 295 |
| 296 // emit attributes | 296 // emit attributes |
| 297 vsBuilder->emitAttributes(gp); | 297 vsBuilder->emitAttributes(gp); |
| 298 | 298 |
| 299 GrGLVertToFrag v(kVec4f_GrSLType); | 299 GrGLSLVertToFrag v(kVec4f_GrSLType); |
| 300 args.fPB->addVarying("HairQuadEdge", &v); | 300 args.fPB->addVarying("HairQuadEdge", &v); |
| 301 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), gp.inHairQuadEdge()->fName); | 301 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), gp.inHairQuadEdge()->fName); |
| 302 | 302 |
| 303 // Setup pass through color | 303 // Setup pass through color |
| 304 if (!gp.colorIgnored()) { | 304 if (!gp.colorIgnored()) { |
| 305 this->setupUniformColor(args.fPB, args.fOutputColor, &fColorUniform); | 305 this->setupUniformColor(args.fPB, args.fOutputColor, &fColorUniform); |
| 306 } | 306 } |
| 307 | 307 |
| 308 // Setup position | 308 // Setup position |
| 309 this->setupPosition(pb, gpArgs, gp.inPosition()->fName, gp.viewMatrix(), &fV
iewMatrixUniform); | 309 this->setupPosition(pb, gpArgs, gp.inPosition()->fName, gp.viewMatrix(), &fV
iewMatrixUniform); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 fEdgeType = ce.getEdgeType(); | 476 fEdgeType = ce.getEdgeType(); |
| 477 } | 477 } |
| 478 | 478 |
| 479 void GrGLCubicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { | 479 void GrGLCubicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { |
| 480 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); | 480 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); |
| 481 const GrCubicEffect& gp = args.fGP.cast<GrCubicEffect>(); | 481 const GrCubicEffect& gp = args.fGP.cast<GrCubicEffect>(); |
| 482 | 482 |
| 483 // emit attributes | 483 // emit attributes |
| 484 vsBuilder->emitAttributes(gp); | 484 vsBuilder->emitAttributes(gp); |
| 485 | 485 |
| 486 GrGLVertToFrag v(kVec4f_GrSLType); | 486 GrGLSLVertToFrag v(kVec4f_GrSLType); |
| 487 args.fPB->addVarying("CubicCoeffs", &v, kHigh_GrSLPrecision); | 487 args.fPB->addVarying("CubicCoeffs", &v, kHigh_GrSLPrecision); |
| 488 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), gp.inCubicCoeffs()->fName); | 488 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), gp.inCubicCoeffs()->fName); |
| 489 | 489 |
| 490 // Setup pass through color | 490 // Setup pass through color |
| 491 if (!gp.colorIgnored()) { | 491 if (!gp.colorIgnored()) { |
| 492 this->setupUniformColor(args.fPB, args.fOutputColor, &fColorUniform); | 492 this->setupUniformColor(args.fPB, args.fOutputColor, &fColorUniform); |
| 493 } | 493 } |
| 494 | 494 |
| 495 // Setup position | 495 // Setup position |
| 496 this->setupPosition(args.fPB, gpArgs, gp.inPosition()->fName, gp.viewMatrix(
), | 496 this->setupPosition(args.fPB, gpArgs, gp.inPosition()->fName, gp.viewMatrix(
), |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 do { | 630 do { |
| 631 GrPrimitiveEdgeType edgeType = | 631 GrPrimitiveEdgeType edgeType = |
| 632 static_cast<GrPrimitiveEdgeType>( | 632 static_cast<GrPrimitiveEdgeType>( |
| 633 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); | 633 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); |
| 634 gp = GrCubicEffect::Create(GrRandomColor(d->fRandom), | 634 gp = GrCubicEffect::Create(GrRandomColor(d->fRandom), |
| 635 GrTest::TestMatrix(d->fRandom), edgeType, *d-
>fCaps); | 635 GrTest::TestMatrix(d->fRandom), edgeType, *d-
>fCaps); |
| 636 } while (nullptr == gp); | 636 } while (nullptr == gp); |
| 637 return gp; | 637 return gp; |
| 638 } | 638 } |
| 639 | 639 |
| OLD | NEW |