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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 class GrGLLinearGradient : public GrGLGradientEffect { | 468 class GrGLLinearGradient : public GrGLGradientEffect { |
469 public: | 469 public: |
470 | 470 |
471 GrGLLinearGradient(const GrBackendProcessorFactory& factory, const GrProcess
or&) | 471 GrGLLinearGradient(const GrBackendProcessorFactory& factory, const GrProcess
or&) |
472 : INHERITED (factory) { } | 472 : INHERITED (factory) { } |
473 | 473 |
474 virtual ~GrGLLinearGradient() { } | 474 virtual ~GrGLLinearGradient() { } |
475 | 475 |
476 virtual void emitCode(GrGLFPBuilder*, | 476 virtual void emitCode(GrGLFPBuilder*, |
477 const GrFragmentProcessor&, | 477 const GrFragmentProcessor&, |
478 const GrProcessorKey&, | |
479 const char* outputColor, | 478 const char* outputColor, |
480 const char* inputColor, | 479 const char* inputColor, |
481 const TransformedCoordsArray&, | 480 const TransformedCoordsArray&, |
482 const TextureSamplerArray&) SK_OVERRIDE; | 481 const TextureSamplerArray&) SK_OVERRIDE; |
483 | 482 |
484 static void GenKey(const GrProcessor& processor, const GrGLCaps&, GrProcesso
rKeyBuilder* b) { | 483 static void GenKey(const GrProcessor& processor, const GrGLCaps&, GrProcesso
rKeyBuilder* b) { |
485 b->add32(GenBaseGradientKey(processor)); | 484 b->add32(GenBaseGradientKey(processor)); |
486 } | 485 } |
487 | 486 |
488 private: | 487 private: |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 GrColor paintColor; | 544 GrColor paintColor; |
546 GrFragmentProcessor* fp; | 545 GrFragmentProcessor* fp; |
547 SkAssertResult(shader->asFragmentProcessor(context, paint, NULL, &paintColor
, &fp)); | 546 SkAssertResult(shader->asFragmentProcessor(context, paint, NULL, &paintColor
, &fp)); |
548 return fp; | 547 return fp; |
549 } | 548 } |
550 | 549 |
551 ///////////////////////////////////////////////////////////////////// | 550 ///////////////////////////////////////////////////////////////////// |
552 | 551 |
553 void GrGLLinearGradient::emitCode(GrGLFPBuilder* builder, | 552 void GrGLLinearGradient::emitCode(GrGLFPBuilder* builder, |
554 const GrFragmentProcessor& fp, | 553 const GrFragmentProcessor& fp, |
555 const GrProcessorKey& key, | |
556 const char* outputColor, | 554 const char* outputColor, |
557 const char* inputColor, | 555 const char* inputColor, |
558 const TransformedCoordsArray& coords, | 556 const TransformedCoordsArray& coords, |
559 const TextureSamplerArray& samplers) { | 557 const TextureSamplerArray& samplers) { |
560 const GrGradientEffect& ge = fp.cast<GrGradientEffect>(); | 558 const GrGradientEffect& ge = fp.cast<GrGradientEffect>(); |
561 this->emitUniforms(builder, ge); | 559 this->emitUniforms(builder, ge); |
562 SkString t = builder->getFragmentShaderBuilder()->ensureFSCoords2D(coords, 0
); | 560 SkString t = builder->getFragmentShaderBuilder()->ensureFSCoords2D(coords, 0
); |
563 t.append(".x"); | 561 t.append(".x"); |
564 this->emitColor(builder, ge, t.c_str(), outputColor, inputColor, samplers); | 562 this->emitColor(builder, ge, t.c_str(), outputColor, inputColor, samplers); |
565 } | 563 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 str->append("SkLinearGradient ("); | 603 str->append("SkLinearGradient ("); |
606 | 604 |
607 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); | 605 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); |
608 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); | 606 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); |
609 | 607 |
610 this->INHERITED::toString(str); | 608 this->INHERITED::toString(str); |
611 | 609 |
612 str->append(")"); | 610 str->append(")"); |
613 } | 611 } |
614 #endif | 612 #endif |
OLD | NEW |