| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "SkSweepGradient.h" | 9 #include "SkSweepGradient.h" |
| 10 | 10 |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 | 466 |
| 467 ///////////////////////////////////////////////////////////////////// | 467 ///////////////////////////////////////////////////////////////////// |
| 468 | 468 |
| 469 void GrGLSweepGradient::emitCode(GrGLShaderBuilder* builder, | 469 void GrGLSweepGradient::emitCode(GrGLShaderBuilder* builder, |
| 470 const GrDrawEffect&, | 470 const GrDrawEffect&, |
| 471 EffectKey key, | 471 EffectKey key, |
| 472 const char* outputColor, | 472 const char* outputColor, |
| 473 const char* inputColor, | 473 const char* inputColor, |
| 474 const TextureSamplerArray& samplers) { | 474 const TextureSamplerArray& samplers) { |
| 475 this->emitYCoordUniform(builder); | 475 this->emitYCoordUniform(builder); |
| 476 const char* coords; | 476 SkString coords; |
| 477 this->setupMatrix(builder, key, &coords); | 477 this->setupMatrix(builder, key, &coords); |
| 478 SkString t; | 478 SkString t; |
| 479 t.printf("atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5", coords, coords); | 479 t.printf("atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5", coords.c_str(), coo
rds.c_str()); |
| 480 this->emitColorLookup(builder, t.c_str(), outputColor, inputColor, samplers[
0]); | 480 this->emitColorLookup(builder, t.c_str(), outputColor, inputColor, samplers[
0]); |
| 481 } | 481 } |
| 482 | 482 |
| 483 ///////////////////////////////////////////////////////////////////// | 483 ///////////////////////////////////////////////////////////////////// |
| 484 | 484 |
| 485 GrEffectRef* SkSweepGradient::asNewEffect(GrContext* context, const SkPaint&) co
nst { | 485 GrEffectRef* SkSweepGradient::asNewEffect(GrContext* context, const SkPaint&) co
nst { |
| 486 SkMatrix matrix; | 486 SkMatrix matrix; |
| 487 if (!this->getLocalMatrix().invert(&matrix)) { | 487 if (!this->getLocalMatrix().invert(&matrix)) { |
| 488 return NULL; | 488 return NULL; |
| 489 } | 489 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 508 str->appendScalar(fCenter.fX); | 508 str->appendScalar(fCenter.fX); |
| 509 str->append(", "); | 509 str->append(", "); |
| 510 str->appendScalar(fCenter.fY); | 510 str->appendScalar(fCenter.fY); |
| 511 str->append(") "); | 511 str->append(") "); |
| 512 | 512 |
| 513 this->INHERITED::toString(str); | 513 this->INHERITED::toString(str); |
| 514 | 514 |
| 515 str->append(")"); | 515 str->append(")"); |
| 516 } | 516 } |
| 517 #endif | 517 #endif |
| OLD | NEW |