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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 | 477 |
478 ///////////////////////////////////////////////////////////////////// | 478 ///////////////////////////////////////////////////////////////////// |
479 | 479 |
480 class GrLinearGradient : public GrGradientEffect { | 480 class GrLinearGradient : public GrGradientEffect { |
481 public: | 481 public: |
482 | 482 |
483 static GrEffectRef* Create(GrContext* ctx, | 483 static GrEffectRef* Create(GrContext* ctx, |
484 const SkLinearGradient& shader, | 484 const SkLinearGradient& shader, |
485 const SkMatrix& matrix, | 485 const SkMatrix& matrix, |
486 SkShader::TileMode tm) { | 486 SkShader::TileMode tm) { |
487 AutoEffectUnref effect(SkNEW_ARGS(GrLinearGradient, (ctx, shader, matrix
, tm))); | 487 return SkNEW_ARGS(GrLinearGradient, (ctx, shader, matrix, tm)); |
488 return CreateEffectRef(effect); | |
489 } | 488 } |
490 | 489 |
491 virtual ~GrLinearGradient() { } | 490 virtual ~GrLinearGradient() { } |
492 | 491 |
493 static const char* Name() { return "Linear Gradient"; } | 492 static const char* Name() { return "Linear Gradient"; } |
494 const GrBackendEffectFactory& getFactory() const SK_OVERRIDE { | 493 const GrBackendEffectFactory& getFactory() const SK_OVERRIDE { |
495 return GrTBackendEffectFactory<GrLinearGradient>::getInstance(); | 494 return GrTBackendEffectFactory<GrLinearGradient>::getInstance(); |
496 } | 495 } |
497 | 496 |
498 typedef GrGLLinearGradient GLEffect; | 497 typedef GrGLLinearGradient GLEffect; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 str->append("SkLinearGradient ("); | 590 str->append("SkLinearGradient ("); |
592 | 591 |
593 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); | 592 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); |
594 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); | 593 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); |
595 | 594 |
596 this->INHERITED::toString(str); | 595 this->INHERITED::toString(str); |
597 | 596 |
598 str->append(")"); | 597 str->append(")"); |
599 } | 598 } |
600 #endif | 599 #endif |
OLD | NEW |