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 30 matching lines...) Expand all Loading... |
41 fFlags |= kB_Flag; | 41 fFlags |= kB_Flag; |
42 } | 42 } |
43 } | 43 } |
44 | 44 |
45 virtual ~SkTable_ColorFilter() { delete fBitmap; } | 45 virtual ~SkTable_ColorFilter() { delete fBitmap; } |
46 | 46 |
47 bool asComponentTable(SkBitmap* table) const override; | 47 bool asComponentTable(SkBitmap* table) const override; |
48 SkColorFilter* newComposed(const SkColorFilter* inner) const override; | 48 SkColorFilter* newComposed(const SkColorFilter* inner) const override; |
49 | 49 |
50 #if SK_SUPPORT_GPU | 50 #if SK_SUPPORT_GPU |
51 const GrFragmentProcessor* asFragmentProcessor(GrContext*, | 51 const GrFragmentProcessor* asFragmentProcessor(GrContext*) const override; |
52 GrProcessorDataManager*) cons
t override; | |
53 #endif | 52 #endif |
54 | 53 |
55 void filterSpan(const SkPMColor src[], int count, SkPMColor dst[]) const ove
rride; | 54 void filterSpan(const SkPMColor src[], int count, SkPMColor dst[]) const ove
rride; |
56 | 55 |
57 SK_TO_STRING_OVERRIDE() | 56 SK_TO_STRING_OVERRIDE() |
58 | 57 |
59 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTable_ColorFilter) | 58 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTable_ColorFilter) |
60 | 59 |
61 enum { | 60 enum { |
62 kA_Flag = 1 << 0, | 61 kA_Flag = 1 << 0, |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 } | 556 } |
558 } | 557 } |
559 } | 558 } |
560 SkAutoTUnref<SkColorFilter> filter(SkTableColorFilter::CreateARGB( | 559 SkAutoTUnref<SkColorFilter> filter(SkTableColorFilter::CreateARGB( |
561 (flags & (1 << 0)) ? luts[0] : nullptr, | 560 (flags & (1 << 0)) ? luts[0] : nullptr, |
562 (flags & (1 << 1)) ? luts[1] : nullptr, | 561 (flags & (1 << 1)) ? luts[1] : nullptr, |
563 (flags & (1 << 2)) ? luts[2] : nullptr, | 562 (flags & (1 << 2)) ? luts[2] : nullptr, |
564 (flags & (1 << 3)) ? luts[3] : nullptr | 563 (flags & (1 << 3)) ? luts[3] : nullptr |
565 )); | 564 )); |
566 | 565 |
567 const GrFragmentProcessor* fp = filter->asFragmentProcessor(d->fContext, d->
fProcDataManager); | 566 const GrFragmentProcessor* fp = filter->asFragmentProcessor(d->fContext); |
568 SkASSERT(fp); | 567 SkASSERT(fp); |
569 return fp; | 568 return fp; |
570 } | 569 } |
571 | 570 |
572 const GrFragmentProcessor* SkTable_ColorFilter::asFragmentProcessor(GrContext* c
ontext, | 571 const GrFragmentProcessor* SkTable_ColorFilter::asFragmentProcessor(GrContext* c
ontext) const { |
573 GrProcessorD
ataManager*) const { | |
574 SkBitmap bitmap; | 572 SkBitmap bitmap; |
575 this->asComponentTable(&bitmap); | 573 this->asComponentTable(&bitmap); |
576 | 574 |
577 return ColorTableEffect::Create(context, bitmap, fFlags); | 575 return ColorTableEffect::Create(context, bitmap, fFlags); |
578 } | 576 } |
579 | 577 |
580 #endif // SK_SUPPORT_GPU | 578 #endif // SK_SUPPORT_GPU |
581 | 579 |
582 /////////////////////////////////////////////////////////////////////////////// | 580 /////////////////////////////////////////////////////////////////////////////// |
583 | 581 |
(...skipping 14 matching lines...) Expand all Loading... |
598 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256], | 596 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256], |
599 const uint8_t tableR[256], | 597 const uint8_t tableR[256], |
600 const uint8_t tableG[256], | 598 const uint8_t tableG[256], |
601 const uint8_t tableB[256]) { | 599 const uint8_t tableB[256]) { |
602 return new SkTable_ColorFilter(tableA, tableR, tableG, tableB); | 600 return new SkTable_ColorFilter(tableA, tableR, tableG, tableB); |
603 } | 601 } |
604 | 602 |
605 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) | 603 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) |
606 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) | 604 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) |
607 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 605 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |