OLD | NEW |
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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 | 382 |
383 #if SK_SUPPORT_GPU | 383 #if SK_SUPPORT_GPU |
384 #include "GrFragmentProcessor.h" | 384 #include "GrFragmentProcessor.h" |
385 #include "GrInvariantOutput.h" | 385 #include "GrInvariantOutput.h" |
386 #include "gl/GrGLFragmentProcessor.h" | 386 #include "gl/GrGLFragmentProcessor.h" |
387 #include "gl/builders/GrGLProgramBuilder.h" | 387 #include "gl/builders/GrGLProgramBuilder.h" |
388 | 388 |
389 class ColorMatrixEffect : public GrFragmentProcessor { | 389 class ColorMatrixEffect : public GrFragmentProcessor { |
390 public: | 390 public: |
391 static GrFragmentProcessor* Create(const SkColorMatrix& matrix) { | 391 static GrFragmentProcessor* Create(const SkColorMatrix& matrix) { |
392 return SkNEW_ARGS(ColorMatrixEffect, (matrix)); | 392 return new ColorMatrixEffect(matrix); |
393 } | 393 } |
394 | 394 |
395 const char* name() const override { return "Color Matrix"; } | 395 const char* name() const override { return "Color Matrix"; } |
396 | 396 |
397 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 397 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
398 | 398 |
399 class GLProcessor : public GrGLFragmentProcessor { | 399 class GLProcessor : public GrGLFragmentProcessor { |
400 public: | 400 public: |
401 // this class always generates the same code. | 401 // this class always generates the same code. |
402 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKey
Builder* b) {} | 402 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKey
Builder* b) {} |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 GrGLProgramDataManager::UniformHandle fVectorHandle; | 455 GrGLProgramDataManager::UniformHandle fVectorHandle; |
456 | 456 |
457 typedef GrGLFragmentProcessor INHERITED; | 457 typedef GrGLFragmentProcessor INHERITED; |
458 }; | 458 }; |
459 | 459 |
460 private: | 460 private: |
461 ColorMatrixEffect(const SkColorMatrix& matrix) : fMatrix(matrix) { | 461 ColorMatrixEffect(const SkColorMatrix& matrix) : fMatrix(matrix) { |
462 this->initClassID<ColorMatrixEffect>(); | 462 this->initClassID<ColorMatrixEffect>(); |
463 } | 463 } |
464 | 464 |
465 GrGLFragmentProcessor* onCreateGLInstance() const override { | 465 GrGLFragmentProcessor* onCreateGLInstance() const override { return new GLPr
ocessor(*this); } |
466 return SkNEW_ARGS(GLProcessor, (*this)); | |
467 } | |
468 | 466 |
469 virtual void onGetGLProcessorKey(const GrGLSLCaps& caps, | 467 virtual void onGetGLProcessorKey(const GrGLSLCaps& caps, |
470 GrProcessorKeyBuilder* b) const override { | 468 GrProcessorKeyBuilder* b) const override { |
471 GLProcessor::GenKey(*this, caps, b); | 469 GLProcessor::GenKey(*this, caps, b); |
472 } | 470 } |
473 | 471 |
474 bool onIsEqual(const GrFragmentProcessor& s) const override { | 472 bool onIsEqual(const GrFragmentProcessor& s) const override { |
475 const ColorMatrixEffect& cme = s.cast<ColorMatrixEffect>(); | 473 const ColorMatrixEffect& cme = s.cast<ColorMatrixEffect>(); |
476 return cme.fMatrix == fMatrix; | 474 return cme.fMatrix == fMatrix; |
477 } | 475 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 str->append("matrix: ("); | 558 str->append("matrix: ("); |
561 for (int i = 0; i < 20; ++i) { | 559 for (int i = 0; i < 20; ++i) { |
562 str->appendScalar(fMatrix.fMat[i]); | 560 str->appendScalar(fMatrix.fMat[i]); |
563 if (i < 19) { | 561 if (i < 19) { |
564 str->append(", "); | 562 str->append(", "); |
565 } | 563 } |
566 } | 564 } |
567 str->append(")"); | 565 str->append(")"); |
568 } | 566 } |
569 #endif | 567 #endif |
OLD | NEW |