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

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

Issue 22854005: GPU Gradients (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: remove dead line of code Created 7 years, 3 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
OLDNEW
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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 virtual ~GrGLLinearGradient() { } 444 virtual ~GrGLLinearGradient() { }
446 445
447 virtual void emitCode(GrGLShaderBuilder*, 446 virtual void emitCode(GrGLShaderBuilder*,
448 const GrDrawEffect&, 447 const GrDrawEffect&,
449 EffectKey, 448 EffectKey,
450 const char* outputColor, 449 const char* outputColor,
451 const char* inputColor, 450 const char* inputColor,
452 const TextureSamplerArray&) SK_OVERRIDE; 451 const TextureSamplerArray&) SK_OVERRIDE;
453 452
454 static EffectKey GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&) { 453 static EffectKey GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&) {
455 return GenMatrixKey(drawEffect); 454 return GenBaseGradientKey(drawEffect);
456 } 455 }
457 456
458 private: 457 private:
459 458
460 typedef GrGLGradientEffect INHERITED; 459 typedef GrGLGradientEffect INHERITED;
461 }; 460 };
462 461
463 ///////////////////////////////////////////////////////////////////// 462 /////////////////////////////////////////////////////////////////////
464 463
465 class GrLinearGradient : public GrGradientEffect { 464 class GrLinearGradient : public GrGradientEffect {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 SkString coords; 527 SkString 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
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
OLDNEW
« no previous file with comments | « src/effects/gradients/SkGradientShaderPriv.h ('k') | src/effects/gradients/SkRadialGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698