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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 | 465 |
466 GrGLLinearGradient(const GrProcessor&) {} | 466 GrGLLinearGradient(const GrProcessor&) {} |
467 | 467 |
468 virtual ~GrGLLinearGradient() { } | 468 virtual ~GrGLLinearGradient() { } |
469 | 469 |
470 virtual void emitCode(GrGLFPBuilder*, | 470 virtual void emitCode(GrGLFPBuilder*, |
471 const GrFragmentProcessor&, | 471 const GrFragmentProcessor&, |
472 const char* outputColor, | 472 const char* outputColor, |
473 const char* inputColor, | 473 const char* inputColor, |
474 const TransformedCoordsArray&, | 474 const TransformedCoordsArray&, |
475 const TextureSamplerArray&) SK_OVERRIDE; | 475 const TextureSamplerArray&) override; |
476 | 476 |
477 static void GenKey(const GrProcessor& processor, const GrGLCaps&, GrProcesso
rKeyBuilder* b) { | 477 static void GenKey(const GrProcessor& processor, const GrGLCaps&, GrProcesso
rKeyBuilder* b) { |
478 b->add32(GenBaseGradientKey(processor)); | 478 b->add32(GenBaseGradientKey(processor)); |
479 } | 479 } |
480 | 480 |
481 private: | 481 private: |
482 | 482 |
483 typedef GrGLGradientEffect INHERITED; | 483 typedef GrGLGradientEffect INHERITED; |
484 }; | 484 }; |
485 | 485 |
486 ///////////////////////////////////////////////////////////////////// | 486 ///////////////////////////////////////////////////////////////////// |
487 | 487 |
488 class GrLinearGradient : public GrGradientEffect { | 488 class GrLinearGradient : public GrGradientEffect { |
489 public: | 489 public: |
490 | 490 |
491 static GrFragmentProcessor* Create(GrContext* ctx, | 491 static GrFragmentProcessor* Create(GrContext* ctx, |
492 const SkLinearGradient& shader, | 492 const SkLinearGradient& shader, |
493 const SkMatrix& matrix, | 493 const SkMatrix& matrix, |
494 SkShader::TileMode tm) { | 494 SkShader::TileMode tm) { |
495 return SkNEW_ARGS(GrLinearGradient, (ctx, shader, matrix, tm)); | 495 return SkNEW_ARGS(GrLinearGradient, (ctx, shader, matrix, tm)); |
496 } | 496 } |
497 | 497 |
498 virtual ~GrLinearGradient() { } | 498 virtual ~GrLinearGradient() { } |
499 | 499 |
500 const char* name() const SK_OVERRIDE { return "Linear Gradient"; } | 500 const char* name() const override { return "Linear Gradient"; } |
501 | 501 |
502 virtual void getGLProcessorKey(const GrGLCaps& caps, | 502 virtual void getGLProcessorKey(const GrGLCaps& caps, |
503 GrProcessorKeyBuilder* b) const SK_OVERRIDE { | 503 GrProcessorKeyBuilder* b) const override { |
504 GrGLLinearGradient::GenKey(*this, caps, b); | 504 GrGLLinearGradient::GenKey(*this, caps, b); |
505 } | 505 } |
506 | 506 |
507 GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE { | 507 GrGLFragmentProcessor* createGLInstance() const override { |
508 return SkNEW_ARGS(GrGLLinearGradient, (*this)); | 508 return SkNEW_ARGS(GrGLLinearGradient, (*this)); |
509 } | 509 } |
510 | 510 |
511 private: | 511 private: |
512 GrLinearGradient(GrContext* ctx, | 512 GrLinearGradient(GrContext* ctx, |
513 const SkLinearGradient& shader, | 513 const SkLinearGradient& shader, |
514 const SkMatrix& matrix, | 514 const SkMatrix& matrix, |
515 SkShader::TileMode tm) | 515 SkShader::TileMode tm) |
516 : INHERITED(ctx, shader, matrix, tm) { | 516 : INHERITED(ctx, shader, matrix, tm) { |
517 this->initClassID<GrLinearGradient>(); | 517 this->initClassID<GrLinearGradient>(); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 str->append("SkLinearGradient ("); | 606 str->append("SkLinearGradient ("); |
607 | 607 |
608 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); | 608 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); |
609 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); | 609 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); |
610 | 610 |
611 this->INHERITED::toString(str); | 611 this->INHERITED::toString(str); |
612 | 612 |
613 str->append(")"); | 613 str->append(")"); |
614 } | 614 } |
615 #endif | 615 #endif |
OLD | NEW |