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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 } | 555 } |
556 return ColorMatrixEffect::Create(colorMatrix); | 556 return ColorMatrixEffect::Create(colorMatrix); |
557 } | 557 } |
558 | 558 |
559 bool SkColorMatrixFilter::asFragmentProcessors(GrContext*, | 559 bool SkColorMatrixFilter::asFragmentProcessors(GrContext*, |
560 SkTDArray<GrFragmentProcessor*>*
array) const { | 560 SkTDArray<GrFragmentProcessor*>*
array) const { |
561 GrFragmentProcessor* frag = ColorMatrixEffect::Create(fMatrix); | 561 GrFragmentProcessor* frag = ColorMatrixEffect::Create(fMatrix); |
562 if (frag) { | 562 if (frag) { |
563 if (array) { | 563 if (array) { |
564 *array->append() = frag; | 564 *array->append() = frag; |
| 565 } else { |
| 566 frag->unref(); |
| 567 SkDEBUGCODE(frag = NULL;) |
565 } | 568 } |
566 return true; | 569 return true; |
567 } | 570 } |
568 return false; | 571 return false; |
569 } | 572 } |
570 | 573 |
571 #endif | 574 #endif |
572 | 575 |
573 #ifndef SK_IGNORE_TO_STRING | 576 #ifndef SK_IGNORE_TO_STRING |
574 void SkColorMatrixFilter::toString(SkString* str) const { | 577 void SkColorMatrixFilter::toString(SkString* str) const { |
575 str->append("SkColorMatrixFilter: "); | 578 str->append("SkColorMatrixFilter: "); |
576 | 579 |
577 str->append("matrix: ("); | 580 str->append("matrix: ("); |
578 for (int i = 0; i < 20; ++i) { | 581 for (int i = 0; i < 20; ++i) { |
579 str->appendScalar(fMatrix.fMat[i]); | 582 str->appendScalar(fMatrix.fMat[i]); |
580 if (i < 19) { | 583 if (i < 19) { |
581 str->append(", "); | 584 str->append(", "); |
582 } | 585 } |
583 } | 586 } |
584 str->append(")"); | 587 str->append(")"); |
585 } | 588 } |
586 #endif | 589 #endif |
OLD | NEW |