OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkTableColorFilter.h" | 9 #include "SkTableColorFilter.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 | 585 |
586 bool SkTable_ColorFilter::asFragmentProcessors(GrContext* context, | 586 bool SkTable_ColorFilter::asFragmentProcessors(GrContext* context, |
587 SkTDArray<GrFragmentProcessor*>*
array) const { | 587 SkTDArray<GrFragmentProcessor*>*
array) const { |
588 SkBitmap bitmap; | 588 SkBitmap bitmap; |
589 this->asComponentTable(&bitmap); | 589 this->asComponentTable(&bitmap); |
590 | 590 |
591 GrFragmentProcessor* frag = ColorTableEffect::Create(context, bitmap, fFlags
); | 591 GrFragmentProcessor* frag = ColorTableEffect::Create(context, bitmap, fFlags
); |
592 if (frag) { | 592 if (frag) { |
593 if (array) { | 593 if (array) { |
594 *array->append() = frag; | 594 *array->append() = frag; |
| 595 } else { |
| 596 frag->unref(); |
| 597 SkDEBUGCODE(frag = NULL;) |
595 } | 598 } |
596 return true; | 599 return true; |
597 } | 600 } |
598 return false; | 601 return false; |
599 } | 602 } |
600 | 603 |
601 #endif // SK_SUPPORT_GPU | 604 #endif // SK_SUPPORT_GPU |
602 | 605 |
603 /////////////////////////////////////////////////////////////////////////////// | 606 /////////////////////////////////////////////////////////////////////////////// |
604 | 607 |
(...skipping 14 matching lines...) Expand all Loading... |
619 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256], | 622 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256], |
620 const uint8_t tableR[256], | 623 const uint8_t tableR[256], |
621 const uint8_t tableG[256], | 624 const uint8_t tableG[256], |
622 const uint8_t tableB[256]) { | 625 const uint8_t tableB[256]) { |
623 return SkNEW_ARGS(SkTable_ColorFilter, (tableA, tableR, tableG, tableB)); | 626 return SkNEW_ARGS(SkTable_ColorFilter, (tableA, tableR, tableG, tableB)); |
624 } | 627 } |
625 | 628 |
626 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) | 629 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) |
627 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) | 630 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) |
628 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 631 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |