| OLD | NEW |
| 1 | |
| 2 /* | 1 /* |
| 3 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 4 * | 3 * |
| 5 * 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 |
| 6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 7 */ | 6 */ |
| 8 | 7 |
| 9 #include "SkLinearGradient.h" | 8 #include "SkLinearGradient.h" |
| 10 | 9 |
| 11 static inline int repeat_bits(int x, const int bits) { | 10 static inline int repeat_bits(int x, const int bits) { |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 } | 516 } |
| 518 | 517 |
| 519 ///////////////////////////////////////////////////////////////////// | 518 ///////////////////////////////////////////////////////////////////// |
| 520 | 519 |
| 521 void GrGLLinearGradient::emitCode(GrGLShaderBuilder* builder, | 520 void GrGLLinearGradient::emitCode(GrGLShaderBuilder* builder, |
| 522 const GrDrawEffect&, | 521 const GrDrawEffect&, |
| 523 EffectKey key, | 522 EffectKey key, |
| 524 const char* outputColor, | 523 const char* outputColor, |
| 525 const char* inputColor, | 524 const char* inputColor, |
| 526 const TextureSamplerArray& samplers) { | 525 const TextureSamplerArray& samplers) { |
| 527 this->emitYCoordUniform(builder); | 526 this->emitUniforms(builder, key); |
| 528 const char* coords; | 527 const char* coords; |
| 529 this->setupMatrix(builder, key, &coords); | 528 this->setupMatrix(builder, key, &coords); |
| 530 SkString t; | 529 SkString t; |
| 531 t.append(coords); | 530 t.append(coords); |
| 532 t.append(".x"); | 531 t.append(".x"); |
| 533 this->emitColorLookup(builder, t.c_str(), outputColor, inputColor, samplers[
0]); | 532 this->emitColor(builder, t.c_str(), key, outputColor, inputColor, samplers); |
| 534 } | 533 } |
| 535 | 534 |
| 536 ///////////////////////////////////////////////////////////////////// | 535 ///////////////////////////////////////////////////////////////////// |
| 537 | 536 |
| 538 GrEffectRef* SkLinearGradient::asNewEffect(GrContext* context, const SkPaint&) c
onst { | 537 GrEffectRef* SkLinearGradient::asNewEffect(GrContext* context, const SkPaint&) c
onst { |
| 539 SkASSERT(NULL != context); | 538 SkASSERT(NULL != context); |
| 540 SkMatrix matrix; | 539 SkMatrix matrix; |
| 541 if (!this->getLocalMatrix().invert(&matrix)) { | 540 if (!this->getLocalMatrix().invert(&matrix)) { |
| 542 return NULL; | 541 return NULL; |
| 543 } | 542 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 559 str->append("SkLinearGradient ("); | 558 str->append("SkLinearGradient ("); |
| 560 | 559 |
| 561 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); | 560 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); |
| 562 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); | 561 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); |
| 563 | 562 |
| 564 this->INHERITED::toString(str); | 563 this->INHERITED::toString(str); |
| 565 | 564 |
| 566 str->append(")"); | 565 str->append(")"); |
| 567 } | 566 } |
| 568 #endif | 567 #endif |
| OLD | NEW |