| 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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 | 530 |
| 531 const GrFragmentProcessor* ColorMatrixEffect::TestCreate(GrProcessorTestData* d)
{ | 531 const GrFragmentProcessor* ColorMatrixEffect::TestCreate(GrProcessorTestData* d)
{ |
| 532 SkColorMatrix colorMatrix; | 532 SkColorMatrix colorMatrix; |
| 533 for (size_t i = 0; i < SK_ARRAY_COUNT(colorMatrix.fMat); ++i) { | 533 for (size_t i = 0; i < SK_ARRAY_COUNT(colorMatrix.fMat); ++i) { |
| 534 colorMatrix.fMat[i] = d->fRandom->nextSScalar1(); | 534 colorMatrix.fMat[i] = d->fRandom->nextSScalar1(); |
| 535 } | 535 } |
| 536 return ColorMatrixEffect::Create(colorMatrix); | 536 return ColorMatrixEffect::Create(colorMatrix); |
| 537 } | 537 } |
| 538 | 538 |
| 539 bool SkColorMatrixFilter::asFragmentProcessors(GrContext*, GrProcessorDataManage
r*, | 539 bool SkColorMatrixFilter::asFragmentProcessors(GrContext*, GrProcessorDataManage
r*, |
| 540 SkTDArray<GrFragmentProcessor*>*
array) const { | 540 SkTDArray<const GrFragmentProcess
or*>* array) const { |
| 541 GrFragmentProcessor* frag = ColorMatrixEffect::Create(fMatrix); | 541 GrFragmentProcessor* frag = ColorMatrixEffect::Create(fMatrix); |
| 542 if (frag) { | 542 if (frag) { |
| 543 if (array) { | 543 if (array) { |
| 544 *array->append() = frag; | 544 *array->append() = frag; |
| 545 } else { | 545 } else { |
| 546 frag->unref(); | 546 frag->unref(); |
| 547 SkDEBUGCODE(frag = nullptr;) | 547 SkDEBUGCODE(frag = nullptr;) |
| 548 } | 548 } |
| 549 return true; | 549 return true; |
| 550 } | 550 } |
| 551 return false; | 551 return false; |
| 552 } | 552 } |
| 553 | 553 |
| 554 #endif | 554 #endif |
| 555 | 555 |
| 556 #ifndef SK_IGNORE_TO_STRING | 556 #ifndef SK_IGNORE_TO_STRING |
| 557 void SkColorMatrixFilter::toString(SkString* str) const { | 557 void SkColorMatrixFilter::toString(SkString* str) const { |
| 558 str->append("SkColorMatrixFilter: "); | 558 str->append("SkColorMatrixFilter: "); |
| 559 | 559 |
| 560 str->append("matrix: ("); | 560 str->append("matrix: ("); |
| 561 for (int i = 0; i < 20; ++i) { | 561 for (int i = 0; i < 20; ++i) { |
| 562 str->appendScalar(fMatrix.fMat[i]); | 562 str->appendScalar(fMatrix.fMat[i]); |
| 563 if (i < 19) { | 563 if (i < 19) { |
| 564 str->append(", "); | 564 str->append(", "); |
| 565 } | 565 } |
| 566 } | 566 } |
| 567 str->append(")"); | 567 str->append(")"); |
| 568 } | 568 } |
| 569 #endif | 569 #endif |
| OLD | NEW |