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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } | 43 } |
44 | 44 |
45 virtual ~SkTable_ColorFilter() { | 45 virtual ~SkTable_ColorFilter() { |
46 SkDELETE(fBitmap); | 46 SkDELETE(fBitmap); |
47 } | 47 } |
48 | 48 |
49 bool asComponentTable(SkBitmap* table) const override; | 49 bool asComponentTable(SkBitmap* table) const override; |
50 SkColorFilter* newComposed(const SkColorFilter* inner) const override; | 50 SkColorFilter* newComposed(const SkColorFilter* inner) const override; |
51 | 51 |
52 #if SK_SUPPORT_GPU | 52 #if SK_SUPPORT_GPU |
53 bool asFragmentProcessors(GrContext*, GrShaderDataManager*, | 53 bool asFragmentProcessors(GrContext*, GrProcessorDataManager*, |
54 SkTDArray<GrFragmentProcessor*>*) const override; | 54 SkTDArray<GrFragmentProcessor*>*) const override; |
55 #endif | 55 #endif |
56 | 56 |
57 void filterSpan(const SkPMColor src[], int count, SkPMColor dst[]) const ove
rride; | 57 void filterSpan(const SkPMColor src[], int count, SkPMColor dst[]) const ove
rride; |
58 | 58 |
59 SK_TO_STRING_OVERRIDE() | 59 SK_TO_STRING_OVERRIDE() |
60 | 60 |
61 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTable_ColorFilter) | 61 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTable_ColorFilter) |
62 | 62 |
63 enum { | 63 enum { |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 } | 567 } |
568 } | 568 } |
569 SkAutoTUnref<SkColorFilter> filter(SkTableColorFilter::CreateARGB( | 569 SkAutoTUnref<SkColorFilter> filter(SkTableColorFilter::CreateARGB( |
570 (flags & (1 << 0)) ? luts[0] : NULL, | 570 (flags & (1 << 0)) ? luts[0] : NULL, |
571 (flags & (1 << 1)) ? luts[1] : NULL, | 571 (flags & (1 << 1)) ? luts[1] : NULL, |
572 (flags & (1 << 2)) ? luts[2] : NULL, | 572 (flags & (1 << 2)) ? luts[2] : NULL, |
573 (flags & (1 << 3)) ? luts[3] : NULL | 573 (flags & (1 << 3)) ? luts[3] : NULL |
574 )); | 574 )); |
575 | 575 |
576 SkTDArray<GrFragmentProcessor*> array; | 576 SkTDArray<GrFragmentProcessor*> array; |
577 if (filter->asFragmentProcessors(d->fContext, d->fShaderDataManager, &array)
) { | 577 if (filter->asFragmentProcessors(d->fContext, d->fProcDataManager, &array))
{ |
578 SkASSERT(1 == array.count()); // TableColorFilter only returns 1 | 578 SkASSERT(1 == array.count()); // TableColorFilter only returns 1 |
579 return array[0]; | 579 return array[0]; |
580 } | 580 } |
581 return NULL; | 581 return NULL; |
582 } | 582 } |
583 | 583 |
584 bool SkTable_ColorFilter::asFragmentProcessors(GrContext* context, | 584 bool SkTable_ColorFilter::asFragmentProcessors(GrContext* context, |
585 GrShaderDataManager*, | 585 GrProcessorDataManager*, |
586 SkTDArray<GrFragmentProcessor*>*
array) const { | 586 SkTDArray<GrFragmentProcessor*>*
array) const { |
587 SkBitmap bitmap; | 587 SkBitmap bitmap; |
588 this->asComponentTable(&bitmap); | 588 this->asComponentTable(&bitmap); |
589 | 589 |
590 GrFragmentProcessor* frag = ColorTableEffect::Create(context, bitmap, fFlags
); | 590 GrFragmentProcessor* frag = ColorTableEffect::Create(context, bitmap, fFlags
); |
591 if (frag) { | 591 if (frag) { |
592 if (array) { | 592 if (array) { |
593 *array->append() = frag; | 593 *array->append() = frag; |
594 } else { | 594 } else { |
595 frag->unref(); | 595 frag->unref(); |
(...skipping 25 matching lines...) Expand all Loading... |
621 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256], | 621 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256], |
622 const uint8_t tableR[256], | 622 const uint8_t tableR[256], |
623 const uint8_t tableG[256], | 623 const uint8_t tableG[256], |
624 const uint8_t tableB[256]) { | 624 const uint8_t tableB[256]) { |
625 return SkNEW_ARGS(SkTable_ColorFilter, (tableA, tableR, tableG, tableB)); | 625 return SkNEW_ARGS(SkTable_ColorFilter, (tableA, tableR, tableG, tableB)); |
626 } | 626 } |
627 | 627 |
628 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) | 628 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) |
629 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) | 629 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) |
630 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 630 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |