| 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 "SkRadialGradient.h" | 9 #include "SkRadialGradient.h" |
| 10 #include "SkRadialGradient_Table.h" | 10 #include "SkRadialGradient_Table.h" |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 SkPaint paint; | 553 SkPaint paint; |
| 554 GrColor paintColor; | 554 GrColor paintColor; |
| 555 GrFragmentProcessor* fp; | 555 GrFragmentProcessor* fp; |
| 556 SkAssertResult(shader->asFragmentProcessor(context, paint, NULL, &paintColor
, &fp)); | 556 SkAssertResult(shader->asFragmentProcessor(context, paint, NULL, &paintColor
, &fp)); |
| 557 return fp; | 557 return fp; |
| 558 } | 558 } |
| 559 | 559 |
| 560 ///////////////////////////////////////////////////////////////////// | 560 ///////////////////////////////////////////////////////////////////// |
| 561 | 561 |
| 562 void GrGLRadialGradient::emitCode(GrGLFPBuilder* builder, | 562 void GrGLRadialGradient::emitCode(GrGLFPBuilder* builder, |
| 563 const GrFragmentProcessor&, | 563 const GrFragmentProcessor& fp, |
| 564 const GrProcessorKey& key, | 564 const GrProcessorKey& key, |
| 565 const char* outputColor, | 565 const char* outputColor, |
| 566 const char* inputColor, | 566 const char* inputColor, |
| 567 const TransformedCoordsArray& coords, | 567 const TransformedCoordsArray& coords, |
| 568 const TextureSamplerArray& samplers) { | 568 const TextureSamplerArray& samplers) { |
| 569 uint32_t baseKey = key.get32(0); | 569 const GrGradientEffect& ge = fp.cast<GrGradientEffect>(); |
| 570 this->emitUniforms(builder, baseKey); | 570 this->emitUniforms(builder, ge); |
| 571 SkString t("length("); | 571 SkString t("length("); |
| 572 t.append(builder->getFragmentShaderBuilder()->ensureFSCoords2D(coords, 0)); | 572 t.append(builder->getFragmentShaderBuilder()->ensureFSCoords2D(coords, 0)); |
| 573 t.append(")"); | 573 t.append(")"); |
| 574 this->emitColor(builder, t.c_str(), baseKey, outputColor, inputColor, sample
rs); | 574 this->emitColor(builder, ge, t.c_str(), outputColor, inputColor, samplers); |
| 575 } | 575 } |
| 576 | 576 |
| 577 ///////////////////////////////////////////////////////////////////// | 577 ///////////////////////////////////////////////////////////////////// |
| 578 | 578 |
| 579 bool SkRadialGradient::asFragmentProcessor(GrContext* context, const SkPaint& pa
int, | 579 bool SkRadialGradient::asFragmentProcessor(GrContext* context, const SkPaint& pa
int, |
| 580 const SkMatrix* localMatrix, GrColor*
paintColor, | 580 const SkMatrix* localMatrix, GrColor*
paintColor, |
| 581 GrFragmentProcessor** fp) const { | 581 GrFragmentProcessor** fp) const { |
| 582 SkASSERT(context); | 582 SkASSERT(context); |
| 583 | 583 |
| 584 SkMatrix matrix; | 584 SkMatrix matrix; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 str->appendScalar(fCenter.fY); | 620 str->appendScalar(fCenter.fY); |
| 621 str->append(") radius: "); | 621 str->append(") radius: "); |
| 622 str->appendScalar(fRadius); | 622 str->appendScalar(fRadius); |
| 623 str->append(" "); | 623 str->append(" "); |
| 624 | 624 |
| 625 this->INHERITED::toString(str); | 625 this->INHERITED::toString(str); |
| 626 | 626 |
| 627 str->append(")"); | 627 str->append(")"); |
| 628 } | 628 } |
| 629 #endif | 629 #endif |
| OLD | NEW |