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

Side by Side Diff: src/effects/SkColorMatrixFilter.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/SkColorFilters.cpp ('k') | src/effects/SkDisplacementMapEffect.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 2011 Google Inc. 2 * Copyright 2011 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 "SkColorMatrixFilter.h" 8 #include "SkColorMatrixFilter.h"
9 #include "SkColorMatrix.h" 9 #include "SkColorMatrix.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 #include "gl/builders/GrGLProgramBuilder.h" 401 #include "gl/builders/GrGLProgramBuilder.h"
402 402
403 class ColorMatrixEffect : public GrFragmentProcessor { 403 class ColorMatrixEffect : public GrFragmentProcessor {
404 public: 404 public:
405 static GrFragmentProcessor* Create(const SkColorMatrix& matrix) { 405 static GrFragmentProcessor* Create(const SkColorMatrix& matrix) {
406 return SkNEW_ARGS(ColorMatrixEffect, (matrix)); 406 return SkNEW_ARGS(ColorMatrixEffect, (matrix));
407 } 407 }
408 408
409 const char* name() const override { return "Color Matrix"; } 409 const char* name() const override { return "Color Matrix"; }
410 410
411 virtual void getGLProcessorKey(const GrGLCaps& caps, 411 virtual void getGLProcessorKey(const GrGLSLCaps& caps,
412 GrProcessorKeyBuilder* b) const override { 412 GrProcessorKeyBuilder* b) const override {
413 GLProcessor::GenKey(*this, caps, b); 413 GLProcessor::GenKey(*this, caps, b);
414 } 414 }
415 415
416 GrGLFragmentProcessor* createGLInstance() const override { 416 GrGLFragmentProcessor* createGLInstance() const override {
417 return SkNEW_ARGS(GLProcessor, (*this)); 417 return SkNEW_ARGS(GLProcessor, (*this));
418 } 418 }
419 419
420 420
421 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 421 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
422 422
423 class GLProcessor : public GrGLFragmentProcessor { 423 class GLProcessor : public GrGLFragmentProcessor {
424 public: 424 public:
425 // this class always generates the same code. 425 // this class always generates the same code.
426 static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBu ilder* b) {} 426 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKey Builder* b) {}
427 427
428 GLProcessor(const GrProcessor&) {} 428 GLProcessor(const GrProcessor&) {}
429 429
430 virtual void emitCode(GrGLFPBuilder* builder, 430 virtual void emitCode(GrGLFPBuilder* builder,
431 const GrFragmentProcessor&, 431 const GrFragmentProcessor&,
432 const char* outputColor, 432 const char* outputColor,
433 const char* inputColor, 433 const char* inputColor,
434 const TransformedCoordsArray&, 434 const TransformedCoordsArray&,
435 const TextureSamplerArray&) override { 435 const TextureSamplerArray&) override {
436 fMatrixHandle = builder->addUniform(GrGLProgramBuilder::kFragment_Vi sibility, 436 fMatrixHandle = builder->addUniform(GrGLProgramBuilder::kFragment_Vi sibility,
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 str->append("matrix: ("); 577 str->append("matrix: (");
578 for (int i = 0; i < 20; ++i) { 578 for (int i = 0; i < 20; ++i) {
579 str->appendScalar(fMatrix.fMat[i]); 579 str->appendScalar(fMatrix.fMat[i]);
580 if (i < 19) { 580 if (i < 19) {
581 str->append(", "); 581 str->append(", ");
582 } 582 }
583 } 583 }
584 str->append(")"); 584 str->append(")");
585 } 585 }
586 #endif 586 #endif
OLDNEW
« no previous file with comments | « src/effects/SkColorFilters.cpp ('k') | src/effects/SkDisplacementMapEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698