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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 public: | 394 public: |
395 | 395 |
396 GrGLSweepGradient(const GrBackendEffectFactory& factory, | 396 GrGLSweepGradient(const GrBackendEffectFactory& factory, |
397 const GrDrawEffect&) : INHERITED (factory) { } | 397 const GrDrawEffect&) : INHERITED (factory) { } |
398 virtual ~GrGLSweepGradient() { } | 398 virtual ~GrGLSweepGradient() { } |
399 | 399 |
400 virtual void emitCode(GrGLShaderBuilder*, | 400 virtual void emitCode(GrGLShaderBuilder*, |
401 const GrDrawEffect&, | 401 const GrDrawEffect&, |
402 EffectKey, | 402 EffectKey, |
403 const char* outputColor, | 403 const char* outputColor, |
404 const char* inputColor, | 404 const GrGLSLExpr4& inputColor, |
405 const TransformedCoordsArray&, | 405 const TransformedCoordsArray&, |
406 const TextureSamplerArray&) SK_OVERRIDE; | 406 const TextureSamplerArray&) SK_OVERRIDE; |
407 | 407 |
408 static EffectKey GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&) { | 408 static EffectKey GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&) { |
409 return GenBaseGradientKey(drawEffect); | 409 return GenBaseGradientKey(drawEffect); |
410 } | 410 } |
411 | 411 |
412 private: | 412 private: |
413 | 413 |
414 typedef GrGLGradientEffect INHERITED; | 414 typedef GrGLGradientEffect INHERITED; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 SkPaint paint; | 464 SkPaint paint; |
465 return shader->asNewEffect(context, paint); | 465 return shader->asNewEffect(context, paint); |
466 } | 466 } |
467 | 467 |
468 ///////////////////////////////////////////////////////////////////// | 468 ///////////////////////////////////////////////////////////////////// |
469 | 469 |
470 void GrGLSweepGradient::emitCode(GrGLShaderBuilder* builder, | 470 void GrGLSweepGradient::emitCode(GrGLShaderBuilder* builder, |
471 const GrDrawEffect&, | 471 const GrDrawEffect&, |
472 EffectKey key, | 472 EffectKey key, |
473 const char* outputColor, | 473 const char* outputColor, |
474 const char* inputColor, | 474 const GrGLSLExpr4& inputColor, |
475 const TransformedCoordsArray& coords, | 475 const TransformedCoordsArray& coords, |
476 const TextureSamplerArray& samplers) { | 476 const TextureSamplerArray& samplers) { |
477 this->emitUniforms(builder, key); | 477 this->emitUniforms(builder, key); |
478 SkString coords2D = builder->ensureFSCoords2D(coords, 0); | 478 SkString coords2D = builder->ensureFSCoords2D(coords, 0); |
479 SkString t; | 479 SkString t; |
480 t.printf("atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5", coords2D.c_str(), c
oords2D.c_str()); | 480 t.printf("atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5", coords2D.c_str(), c
oords2D.c_str()); |
481 this->emitColor(builder, t.c_str(), key, | 481 this->emitColor(builder, t.c_str(), key, |
482 outputColor, inputColor, samplers); | 482 outputColor, inputColor, samplers); |
483 } | 483 } |
484 | 484 |
(...skipping 25 matching lines...) Expand all Loading... |
510 str->appendScalar(fCenter.fX); | 510 str->appendScalar(fCenter.fX); |
511 str->append(", "); | 511 str->append(", "); |
512 str->appendScalar(fCenter.fY); | 512 str->appendScalar(fCenter.fY); |
513 str->append(") "); | 513 str->append(") "); |
514 | 514 |
515 this->INHERITED::toString(str); | 515 this->INHERITED::toString(str); |
516 | 516 |
517 str->append(")"); | 517 str->append(")"); |
518 } | 518 } |
519 #endif | 519 #endif |
OLD | NEW |