Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(722)

Side by Side Diff: src/effects/gradients/SkRadialGradient.cpp

Issue 26190003: Potentially optimize some GrGLEffects for known input color values (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/effects/gradients/SkLinearGradient.cpp ('k') | src/effects/gradients/SkSweepGradient.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 public: 473 public:
474 474
475 GrGLRadialGradient(const GrBackendEffectFactory& factory, 475 GrGLRadialGradient(const GrBackendEffectFactory& factory,
476 const GrDrawEffect&) : INHERITED (factory) { } 476 const GrDrawEffect&) : INHERITED (factory) { }
477 virtual ~GrGLRadialGradient() { } 477 virtual ~GrGLRadialGradient() { }
478 478
479 virtual void emitCode(GrGLShaderBuilder*, 479 virtual void emitCode(GrGLShaderBuilder*,
480 const GrDrawEffect&, 480 const GrDrawEffect&,
481 EffectKey, 481 EffectKey,
482 const char* outputColor, 482 const char* outputColor,
483 const char* inputColor, 483 const GrGLSLExpr4& inputColor,
484 const TransformedCoordsArray&, 484 const TransformedCoordsArray&,
485 const TextureSamplerArray&) SK_OVERRIDE; 485 const TextureSamplerArray&) SK_OVERRIDE;
486 486
487 static EffectKey GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&) { 487 static EffectKey GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&) {
488 return GenBaseGradientKey(drawEffect); 488 return GenBaseGradientKey(drawEffect);
489 } 489 }
490 490
491 private: 491 private:
492 492
493 typedef GrGLGradientEffect INHERITED; 493 typedef GrGLGradientEffect INHERITED;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 SkPaint paint; 550 SkPaint paint;
551 return shader->asNewEffect(context, paint); 551 return shader->asNewEffect(context, paint);
552 } 552 }
553 553
554 ///////////////////////////////////////////////////////////////////// 554 /////////////////////////////////////////////////////////////////////
555 555
556 void GrGLRadialGradient::emitCode(GrGLShaderBuilder* builder, 556 void GrGLRadialGradient::emitCode(GrGLShaderBuilder* builder,
557 const GrDrawEffect&, 557 const GrDrawEffect&,
558 EffectKey key, 558 EffectKey key,
559 const char* outputColor, 559 const char* outputColor,
560 const char* inputColor, 560 const GrGLSLExpr4& inputColor,
561 const TransformedCoordsArray& coords, 561 const TransformedCoordsArray& coords,
562 const TextureSamplerArray& samplers) { 562 const TextureSamplerArray& samplers) {
563 this->emitUniforms(builder, key); 563 this->emitUniforms(builder, key);
564 SkString t("length("); 564 SkString t("length(");
565 t.append(builder->ensureFSCoords2D(coords, 0)); 565 t.append(builder->ensureFSCoords2D(coords, 0));
566 t.append(")"); 566 t.append(")");
567 this->emitColor(builder, t.c_str(), key, outputColor, inputColor, samplers); 567 this->emitColor(builder, t.c_str(), key, outputColor, inputColor, samplers);
568 } 568 }
569 569
570 ///////////////////////////////////////////////////////////////////// 570 /////////////////////////////////////////////////////////////////////
(...skipping 28 matching lines...) Expand all
599 str->appendScalar(fCenter.fY); 599 str->appendScalar(fCenter.fY);
600 str->append(") radius: "); 600 str->append(") radius: ");
601 str->appendScalar(fRadius); 601 str->appendScalar(fRadius);
602 str->append(" "); 602 str->append(" ");
603 603
604 this->INHERITED::toString(str); 604 this->INHERITED::toString(str);
605 605
606 str->append(")"); 606 str->append(")");
607 } 607 }
608 #endif 608 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkLinearGradient.cpp ('k') | src/effects/gradients/SkSweepGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698