OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkRadialGradient.h" | 9 #include "SkRadialGradient.h" |
10 #include "SkRadialGradient_Table.h" | 10 #include "SkRadialGradient_Table.h" |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 | 433 |
434 #include "SkGr.h" | 434 #include "SkGr.h" |
435 #include "gl/builders/GrGLProgramBuilder.h" | 435 #include "gl/builders/GrGLProgramBuilder.h" |
436 | 436 |
437 class GrGLRadialGradient : public GrGLGradientEffect { | 437 class GrGLRadialGradient : public GrGLGradientEffect { |
438 public: | 438 public: |
439 | 439 |
440 GrGLRadialGradient(const GrProcessor&) {} | 440 GrGLRadialGradient(const GrProcessor&) {} |
441 virtual ~GrGLRadialGradient() { } | 441 virtual ~GrGLRadialGradient() { } |
442 | 442 |
443 virtual void emitCode(GrGLFPBuilder*, | 443 virtual void emitCode(EmitArgs&) override; |
444 const GrFragmentProcessor&, | |
445 const char* outputColor, | |
446 const char* inputColor, | |
447 const TransformedCoordsArray&, | |
448 const TextureSamplerArray&) override; | |
449 | 444 |
450 static void GenKey(const GrProcessor& processor, const GrGLSLCaps&, GrProces
sorKeyBuilder* b) { | 445 static void GenKey(const GrProcessor& processor, const GrGLSLCaps&, GrProces
sorKeyBuilder* b) { |
451 b->add32(GenBaseGradientKey(processor)); | 446 b->add32(GenBaseGradientKey(processor)); |
452 } | 447 } |
453 | 448 |
454 private: | 449 private: |
455 | 450 |
456 typedef GrGLGradientEffect INHERITED; | 451 typedef GrGLGradientEffect INHERITED; |
457 | 452 |
458 }; | 453 }; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 GrColor paintColor; | 512 GrColor paintColor; |
518 GrFragmentProcessor* fp; | 513 GrFragmentProcessor* fp; |
519 SkAssertResult(shader->asFragmentProcessor(d->fContext, paint, | 514 SkAssertResult(shader->asFragmentProcessor(d->fContext, paint, |
520 GrTest::TestMatrix(d->fRandom), N
ULL, | 515 GrTest::TestMatrix(d->fRandom), N
ULL, |
521 &paintColor, d->fProcDataManager,
&fp)); | 516 &paintColor, d->fProcDataManager,
&fp)); |
522 return fp; | 517 return fp; |
523 } | 518 } |
524 | 519 |
525 ///////////////////////////////////////////////////////////////////// | 520 ///////////////////////////////////////////////////////////////////// |
526 | 521 |
527 void GrGLRadialGradient::emitCode(GrGLFPBuilder* builder, | 522 void GrGLRadialGradient::emitCode(EmitArgs& args) { |
528 const GrFragmentProcessor& fp, | 523 const GrRadialGradient& ge = args.fFp.cast<GrRadialGradient>(); |
529 const char* outputColor, | 524 this->emitUniforms(args.fBuilder, ge); |
530 const char* inputColor, | |
531 const TransformedCoordsArray& coords, | |
532 const TextureSamplerArray& samplers) { | |
533 const GrRadialGradient& ge = fp.cast<GrRadialGradient>(); | |
534 this->emitUniforms(builder, ge); | |
535 SkString t("length("); | 525 SkString t("length("); |
536 t.append(builder->getFragmentShaderBuilder()->ensureFSCoords2D(coords, 0)); | 526 t.append(args.fBuilder->getFragmentShaderBuilder()->ensureFSCoords2D(args.fC
oords, 0)); |
537 t.append(")"); | 527 t.append(")"); |
538 this->emitColor(builder, ge, t.c_str(), outputColor, inputColor, samplers); | 528 this->emitColor(args.fBuilder, ge, t.c_str(), args.fOutputColor, args.fInput
Color, |
| 529 args.fSamplers); |
539 } | 530 } |
540 | 531 |
541 ///////////////////////////////////////////////////////////////////// | 532 ///////////////////////////////////////////////////////////////////// |
542 | 533 |
543 bool SkRadialGradient::asFragmentProcessor(GrContext* context, const SkPaint& pa
int, | 534 bool SkRadialGradient::asFragmentProcessor(GrContext* context, const SkPaint& pa
int, |
544 const SkMatrix& viewM, | 535 const SkMatrix& viewM, |
545 const SkMatrix* localMatrix, GrColor*
paintColor, | 536 const SkMatrix* localMatrix, GrColor*
paintColor, |
546 GrProcessorDataManager* procDataManag
er, | 537 GrProcessorDataManager* procDataManag
er, |
547 GrFragmentProcessor** fp) const { | 538 GrFragmentProcessor** fp) const { |
548 SkASSERT(context); | 539 SkASSERT(context); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 str->appendScalar(fCenter.fY); | 578 str->appendScalar(fCenter.fY); |
588 str->append(") radius: "); | 579 str->append(") radius: "); |
589 str->appendScalar(fRadius); | 580 str->appendScalar(fRadius); |
590 str->append(" "); | 581 str->append(" "); |
591 | 582 |
592 this->INHERITED::toString(str); | 583 this->INHERITED::toString(str); |
593 | 584 |
594 str->append(")"); | 585 str->append(")"); |
595 } | 586 } |
596 #endif | 587 #endif |
OLD | NEW |