OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkLinearGradient.h" | 8 #include "SkLinearGradient.h" |
9 | 9 |
10 static inline int repeat_bits(int x, const int bits) { | 10 static inline int repeat_bits(int x, const int bits) { |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality); | 521 GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality); |
522 GrAlwaysAssert(fp); | 522 GrAlwaysAssert(fp); |
523 return fp; | 523 return fp; |
524 } | 524 } |
525 | 525 |
526 ///////////////////////////////////////////////////////////////////// | 526 ///////////////////////////////////////////////////////////////////// |
527 | 527 |
528 void GrGLLinearGradient::emitCode(EmitArgs& args) { | 528 void GrGLLinearGradient::emitCode(EmitArgs& args) { |
529 const GrLinearGradient& ge = args.fFp.cast<GrLinearGradient>(); | 529 const GrLinearGradient& ge = args.fFp.cast<GrLinearGradient>(); |
530 this->emitUniforms(args.fBuilder, ge); | 530 this->emitUniforms(args.fBuilder, ge); |
531 SkString t = args.fBuilder->getFragmentShaderBuilder()->ensureFSCoords2D(arg
s.fCoords, 0); | 531 SkString t = args.fFragBuilder->ensureFSCoords2D(args.fCoords, 0); |
532 t.append(".x"); | 532 t.append(".x"); |
533 this->emitColor(args.fBuilder, ge, t.c_str(), args.fOutputColor, args.fInput
Color, | 533 this->emitColor(args.fBuilder, |
| 534 args.fFragBuilder, |
| 535 ge, t.c_str(), |
| 536 args.fOutputColor, |
| 537 args.fInputColor, |
534 args.fSamplers); | 538 args.fSamplers); |
535 } | 539 } |
536 | 540 |
537 ///////////////////////////////////////////////////////////////////// | 541 ///////////////////////////////////////////////////////////////////// |
538 | 542 |
539 const GrFragmentProcessor* SkLinearGradient::asFragmentProcessor( | 543 const GrFragmentProcessor* SkLinearGradient::asFragmentProcessor( |
540 GrContext* context, | 544 GrContext* context, |
541 const SkMatrix& viewm, | 545 const SkMatrix& viewm, |
542 const SkMatrix* localMatrix, | 546 const SkMatrix* localMatrix, |
543 SkFilterQuality) const { | 547 SkFilterQuality) const { |
(...skipping 25 matching lines...) Expand all Loading... |
569 str->append("SkLinearGradient ("); | 573 str->append("SkLinearGradient ("); |
570 | 574 |
571 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); | 575 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); |
572 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); | 576 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); |
573 | 577 |
574 this->INHERITED::toString(str); | 578 this->INHERITED::toString(str); |
575 | 579 |
576 str->append(")"); | 580 str->append(")"); |
577 } | 581 } |
578 #endif | 582 #endif |
OLD | NEW |