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

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

Issue 1109863004: Use GLSLCaps for creating processor keys and GLSL-specific programs (Closed) Base URL: https://chromium.googlesource.com/skia@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « src/effects/SkTableColorFilter.cpp ('k') | src/effects/gradients/SkRadialGradient.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 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * 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
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkLinearGradient.h" 8 #include "SkLinearGradient.h"
9 9
10 static inline int repeat_bits(int x, const int bits) { 10 static inline int repeat_bits(int x, const int bits) {
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 467
468 virtual ~GrGLLinearGradient() { } 468 virtual ~GrGLLinearGradient() { }
469 469
470 virtual void emitCode(GrGLFPBuilder*, 470 virtual void emitCode(GrGLFPBuilder*,
471 const GrFragmentProcessor&, 471 const GrFragmentProcessor&,
472 const char* outputColor, 472 const char* outputColor,
473 const char* inputColor, 473 const char* inputColor,
474 const TransformedCoordsArray&, 474 const TransformedCoordsArray&,
475 const TextureSamplerArray&) override; 475 const TextureSamplerArray&) override;
476 476
477 static void GenKey(const GrProcessor& processor, const GrGLCaps&, GrProcesso rKeyBuilder* b) { 477 static void GenKey(const GrProcessor& processor, const GrGLSLCaps&, GrProces sorKeyBuilder* b) {
478 b->add32(GenBaseGradientKey(processor)); 478 b->add32(GenBaseGradientKey(processor));
479 } 479 }
480 480
481 private: 481 private:
482 482
483 typedef GrGLGradientEffect INHERITED; 483 typedef GrGLGradientEffect INHERITED;
484 }; 484 };
485 485
486 ///////////////////////////////////////////////////////////////////// 486 /////////////////////////////////////////////////////////////////////
487 487
488 class GrLinearGradient : public GrGradientEffect { 488 class GrLinearGradient : public GrGradientEffect {
489 public: 489 public:
490 490
491 static GrFragmentProcessor* Create(GrContext* ctx, 491 static GrFragmentProcessor* Create(GrContext* ctx,
492 const SkLinearGradient& shader, 492 const SkLinearGradient& shader,
493 const SkMatrix& matrix, 493 const SkMatrix& matrix,
494 SkShader::TileMode tm) { 494 SkShader::TileMode tm) {
495 return SkNEW_ARGS(GrLinearGradient, (ctx, shader, matrix, tm)); 495 return SkNEW_ARGS(GrLinearGradient, (ctx, shader, matrix, tm));
496 } 496 }
497 497
498 virtual ~GrLinearGradient() { } 498 virtual ~GrLinearGradient() { }
499 499
500 const char* name() const override { return "Linear Gradient"; } 500 const char* name() const override { return "Linear Gradient"; }
501 501
502 virtual void getGLProcessorKey(const GrGLCaps& caps, 502 virtual void getGLProcessorKey(const GrGLSLCaps& caps,
503 GrProcessorKeyBuilder* b) const override { 503 GrProcessorKeyBuilder* b) const override {
504 GrGLLinearGradient::GenKey(*this, caps, b); 504 GrGLLinearGradient::GenKey(*this, caps, b);
505 } 505 }
506 506
507 GrGLFragmentProcessor* createGLInstance() const override { 507 GrGLFragmentProcessor* createGLInstance() const override {
508 return SkNEW_ARGS(GrGLLinearGradient, (*this)); 508 return SkNEW_ARGS(GrGLLinearGradient, (*this));
509 } 509 }
510 510
511 private: 511 private:
512 GrLinearGradient(GrContext* ctx, 512 GrLinearGradient(GrContext* ctx,
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 str->append("SkLinearGradient ("); 606 str->append("SkLinearGradient (");
607 607
608 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); 608 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY);
609 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); 609 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY);
610 610
611 this->INHERITED::toString(str); 611 this->INHERITED::toString(str);
612 612
613 str->append(")"); 613 str->append(")");
614 } 614 }
615 #endif 615 #endif
OLDNEW
« no previous file with comments | « src/effects/SkTableColorFilter.cpp ('k') | src/effects/gradients/SkRadialGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698