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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 GrInvariantOutput::kWill_ReadInput); | 524 GrInvariantOutput::kWill_ReadInput); |
525 } | 525 } |
526 | 526 |
527 SkColorMatrix fMatrix; | 527 SkColorMatrix fMatrix; |
528 | 528 |
529 typedef GrFragmentProcessor INHERITED; | 529 typedef GrFragmentProcessor INHERITED; |
530 }; | 530 }; |
531 | 531 |
532 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ColorMatrixEffect); | 532 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ColorMatrixEffect); |
533 | 533 |
534 GrFragmentProcessor* ColorMatrixEffect::TestCreate(SkRandom* random, | 534 GrFragmentProcessor* ColorMatrixEffect::TestCreate(GrProcessorTestData* d) { |
535 GrContext*, | |
536 const GrCaps&, | |
537 GrTexture* dummyTextures[2])
{ | |
538 SkColorMatrix colorMatrix; | 535 SkColorMatrix colorMatrix; |
539 for (size_t i = 0; i < SK_ARRAY_COUNT(colorMatrix.fMat); ++i) { | 536 for (size_t i = 0; i < SK_ARRAY_COUNT(colorMatrix.fMat); ++i) { |
540 colorMatrix.fMat[i] = random->nextSScalar1(); | 537 colorMatrix.fMat[i] = d->fRandom->nextSScalar1(); |
541 } | 538 } |
542 return ColorMatrixEffect::Create(colorMatrix); | 539 return ColorMatrixEffect::Create(colorMatrix); |
543 } | 540 } |
544 | 541 |
545 bool SkColorMatrixFilter::asFragmentProcessors(GrContext*, GrShaderDataManager*, | 542 bool SkColorMatrixFilter::asFragmentProcessors(GrContext*, GrShaderDataManager*, |
546 SkTDArray<GrFragmentProcessor*>*
array) const { | 543 SkTDArray<GrFragmentProcessor*>*
array) const { |
547 GrFragmentProcessor* frag = ColorMatrixEffect::Create(fMatrix); | 544 GrFragmentProcessor* frag = ColorMatrixEffect::Create(fMatrix); |
548 if (frag) { | 545 if (frag) { |
549 if (array) { | 546 if (array) { |
550 *array->append() = frag; | 547 *array->append() = frag; |
(...skipping 15 matching lines...) Expand all Loading... |
566 str->append("matrix: ("); | 563 str->append("matrix: ("); |
567 for (int i = 0; i < 20; ++i) { | 564 for (int i = 0; i < 20; ++i) { |
568 str->appendScalar(fMatrix.fMat[i]); | 565 str->appendScalar(fMatrix.fMat[i]); |
569 if (i < 19) { | 566 if (i < 19) { |
570 str->append(", "); | 567 str->append(", "); |
571 } | 568 } |
572 } | 569 } |
573 str->append(")"); | 570 str->append(")"); |
574 } | 571 } |
575 #endif | 572 #endif |
OLD | NEW |