OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 #include "SkColorMatrixFilter.h" | 8 #include "SkColorMatrixFilter.h" |
9 #include "SkColorMatrix.h" | 9 #include "SkColorMatrix.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 GrGLfloat vec[] = { | 443 GrGLfloat vec[] = { |
444 m[4] * kScale, m[9] * kScale, m[14] * kScale, m[19] * kScale, | 444 m[4] * kScale, m[9] * kScale, m[14] * kScale, m[19] * kScale, |
445 }; | 445 }; |
446 uniManager.setMatrix4fv(fMatrixHandle, 1, mt); | 446 uniManager.setMatrix4fv(fMatrixHandle, 1, mt); |
447 uniManager.set4fv(fVectorHandle, 1, vec); | 447 uniManager.set4fv(fVectorHandle, 1, vec); |
448 } | 448 } |
449 | 449 |
450 private: | 450 private: |
451 GrGLUniformManager::UniformHandle fMatrixHandle; | 451 GrGLUniformManager::UniformHandle fMatrixHandle; |
452 GrGLUniformManager::UniformHandle fVectorHandle; | 452 GrGLUniformManager::UniformHandle fVectorHandle; |
| 453 |
| 454 typedef GrGLEffect INHERITED; |
453 }; | 455 }; |
454 | 456 |
455 private: | 457 private: |
456 ColorMatrixEffect(const SkColorMatrix& matrix) : fMatrix(matrix) {} | 458 ColorMatrixEffect(const SkColorMatrix& matrix) : fMatrix(matrix) {} |
457 | 459 |
458 virtual bool onIsEqual(const GrEffect& s) const { | 460 virtual bool onIsEqual(const GrEffect& s) const { |
459 const ColorMatrixEffect& cme = CastEffect<ColorMatrixEffect>(s); | 461 const ColorMatrixEffect& cme = CastEffect<ColorMatrixEffect>(s); |
460 return cme.fMatrix == fMatrix; | 462 return cme.fMatrix == fMatrix; |
461 } | 463 } |
462 | 464 |
463 SkColorMatrix fMatrix; | 465 SkColorMatrix fMatrix; |
464 | 466 |
465 typedef GrGLEffect INHERITED; | 467 typedef GrEffect INHERITED; |
466 }; | 468 }; |
467 | 469 |
468 GR_DEFINE_EFFECT_TEST(ColorMatrixEffect); | 470 GR_DEFINE_EFFECT_TEST(ColorMatrixEffect); |
469 | 471 |
470 GrEffectRef* ColorMatrixEffect::TestCreate(SkRandom* random, | 472 GrEffectRef* ColorMatrixEffect::TestCreate(SkRandom* random, |
471 GrContext*, | 473 GrContext*, |
472 const GrDrawTargetCaps&, | 474 const GrDrawTargetCaps&, |
473 GrTexture* dummyTextures[2]) { | 475 GrTexture* dummyTextures[2]) { |
474 SkColorMatrix colorMatrix; | 476 SkColorMatrix colorMatrix; |
475 for (size_t i = 0; i < SK_ARRAY_COUNT(colorMatrix.fMat); ++i) { | 477 for (size_t i = 0; i < SK_ARRAY_COUNT(colorMatrix.fMat); ++i) { |
(...skipping 15 matching lines...) Expand all Loading... |
491 str->append("matrix: ("); | 493 str->append("matrix: ("); |
492 for (int i = 0; i < 20; ++i) { | 494 for (int i = 0; i < 20; ++i) { |
493 str->appendScalar(fMatrix.fMat[i]); | 495 str->appendScalar(fMatrix.fMat[i]); |
494 if (i < 19) { | 496 if (i < 19) { |
495 str->append(", "); | 497 str->append(", "); |
496 } | 498 } |
497 } | 499 } |
498 str->append(")"); | 500 str->append(")"); |
499 } | 501 } |
500 #endif | 502 #endif |
OLD | NEW |