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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 | 440 |
441 GrGLLinearGradient(const GrBackendEffectFactory& factory, const GrDrawEffect
&) | 441 GrGLLinearGradient(const GrBackendEffectFactory& factory, const GrDrawEffect
&) |
442 : INHERITED (factory) { } | 442 : INHERITED (factory) { } |
443 | 443 |
444 virtual ~GrGLLinearGradient() { } | 444 virtual ~GrGLLinearGradient() { } |
445 | 445 |
446 virtual void emitCode(GrGLShaderBuilder*, | 446 virtual void emitCode(GrGLShaderBuilder*, |
447 const GrDrawEffect&, | 447 const GrDrawEffect&, |
448 EffectKey, | 448 EffectKey, |
449 const char* outputColor, | 449 const char* outputColor, |
450 const char* inputColor, | 450 const GrGLSLExpr4& inputColor, |
451 const TransformedCoordsArray&, | 451 const TransformedCoordsArray&, |
452 const TextureSamplerArray&) SK_OVERRIDE; | 452 const TextureSamplerArray&) SK_OVERRIDE; |
453 | 453 |
454 static EffectKey GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&) { | 454 static EffectKey GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&) { |
455 return GenBaseGradientKey(drawEffect); | 455 return GenBaseGradientKey(drawEffect); |
456 } | 456 } |
457 | 457 |
458 private: | 458 private: |
459 | 459 |
460 typedef GrGLGradientEffect INHERITED; | 460 typedef GrGLGradientEffect INHERITED; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 SkPaint paint; | 515 SkPaint paint; |
516 return shader->asNewEffect(context, paint); | 516 return shader->asNewEffect(context, paint); |
517 } | 517 } |
518 | 518 |
519 ///////////////////////////////////////////////////////////////////// | 519 ///////////////////////////////////////////////////////////////////// |
520 | 520 |
521 void GrGLLinearGradient::emitCode(GrGLShaderBuilder* builder, | 521 void GrGLLinearGradient::emitCode(GrGLShaderBuilder* builder, |
522 const GrDrawEffect&, | 522 const GrDrawEffect&, |
523 EffectKey key, | 523 EffectKey key, |
524 const char* outputColor, | 524 const char* outputColor, |
525 const char* inputColor, | 525 const GrGLSLExpr4& inputColor, |
526 const TransformedCoordsArray& coords, | 526 const TransformedCoordsArray& coords, |
527 const TextureSamplerArray& samplers) { | 527 const TextureSamplerArray& samplers) { |
528 this->emitUniforms(builder, key); | 528 this->emitUniforms(builder, key); |
529 SkString t = builder->ensureFSCoords2D(coords, 0); | 529 SkString t = builder->ensureFSCoords2D(coords, 0); |
530 t.append(".x"); | 530 t.append(".x"); |
531 this->emitColor(builder, t.c_str(), key, outputColor, inputColor, samplers); | 531 this->emitColor(builder, t.c_str(), key, outputColor, inputColor, samplers); |
532 } | 532 } |
533 | 533 |
534 ///////////////////////////////////////////////////////////////////// | 534 ///////////////////////////////////////////////////////////////////// |
535 | 535 |
(...skipping 21 matching lines...) Expand all Loading... |
557 str->append("SkLinearGradient ("); | 557 str->append("SkLinearGradient ("); |
558 | 558 |
559 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); | 559 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); |
560 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); | 560 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); |
561 | 561 |
562 this->INHERITED::toString(str); | 562 this->INHERITED::toString(str); |
563 | 563 |
564 str->append(")"); | 564 str->append(")"); |
565 } | 565 } |
566 #endif | 566 #endif |
OLD | NEW |