OLD | NEW |
1 | 1 |
2 #include "SkBitmap.h" | 2 #include "SkBitmap.h" |
3 #include "SkTableColorFilter.h" | 3 #include "SkTableColorFilter.h" |
4 #include "SkColorPriv.h" | 4 #include "SkColorPriv.h" |
5 #include "SkFlattenableBuffers.h" | 5 #include "SkFlattenableBuffers.h" |
6 #include "SkUnPreMultiply.h" | 6 #include "SkUnPreMultiply.h" |
| 7 #include "SkString.h" |
7 | 8 |
8 class SkTable_ColorFilter : public SkColorFilter { | 9 class SkTable_ColorFilter : public SkColorFilter { |
9 public: | 10 public: |
10 SkTable_ColorFilter(const uint8_t tableA[], const uint8_t tableR[], | 11 SkTable_ColorFilter(const uint8_t tableA[], const uint8_t tableR[], |
11 const uint8_t tableG[], const uint8_t tableB[]) { | 12 const uint8_t tableG[], const uint8_t tableB[]) { |
12 fBitmap = NULL; | 13 fBitmap = NULL; |
13 fFlags = 0; | 14 fFlags = 0; |
14 | 15 |
15 uint8_t* dst = fStorage; | 16 uint8_t* dst = fStorage; |
16 if (tableA) { | 17 if (tableA) { |
(...skipping 23 matching lines...) Expand all Loading... |
40 | 41 |
41 virtual bool asComponentTable(SkBitmap* table) const SK_OVERRIDE; | 42 virtual bool asComponentTable(SkBitmap* table) const SK_OVERRIDE; |
42 | 43 |
43 #if SK_SUPPORT_GPU | 44 #if SK_SUPPORT_GPU |
44 virtual GrEffectRef* asNewEffect(GrContext* context) const SK_OVERRIDE; | 45 virtual GrEffectRef* asNewEffect(GrContext* context) const SK_OVERRIDE; |
45 #endif | 46 #endif |
46 | 47 |
47 virtual void filterSpan(const SkPMColor src[], int count, | 48 virtual void filterSpan(const SkPMColor src[], int count, |
48 SkPMColor dst[]) const SK_OVERRIDE; | 49 SkPMColor dst[]) const SK_OVERRIDE; |
49 | 50 |
| 51 SkDEVCODE(virtual void toString(SkString* str) const SK_OVERRIDE;) |
| 52 |
50 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTable_ColorFilter) | 53 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTable_ColorFilter) |
51 | 54 |
52 enum { | 55 enum { |
53 kA_Flag = 1 << 0, | 56 kA_Flag = 1 << 0, |
54 kR_Flag = 1 << 1, | 57 kR_Flag = 1 << 1, |
55 kG_Flag = 1 << 2, | 58 kG_Flag = 1 << 2, |
56 kB_Flag = 1 << 3, | 59 kB_Flag = 1 << 3, |
57 }; | 60 }; |
58 | 61 |
59 protected: | 62 protected: |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 r = SkUnPreMultiply::ApplyScale(scale, r); | 144 r = SkUnPreMultiply::ApplyScale(scale, r); |
142 g = SkUnPreMultiply::ApplyScale(scale, g); | 145 g = SkUnPreMultiply::ApplyScale(scale, g); |
143 b = SkUnPreMultiply::ApplyScale(scale, b); | 146 b = SkUnPreMultiply::ApplyScale(scale, b); |
144 } | 147 } |
145 } | 148 } |
146 dst[i] = SkPremultiplyARGBInline(tableA[a], tableR[r], | 149 dst[i] = SkPremultiplyARGBInline(tableA[a], tableR[r], |
147 tableG[g], tableB[b]); | 150 tableG[g], tableB[b]); |
148 } | 151 } |
149 } | 152 } |
150 | 153 |
| 154 #ifdef SK_DEVELOPER |
| 155 void SkTable_ColorFilter::toString(SkString* str) const { |
| 156 str->append("SkTable_ColorFilter"); |
| 157 } |
| 158 #endif |
| 159 |
151 static const uint8_t gCountNibBits[] = { | 160 static const uint8_t gCountNibBits[] = { |
152 0, 1, 1, 2, | 161 0, 1, 1, 2, |
153 1, 2, 2, 3, | 162 1, 2, 2, 3, |
154 1, 2, 2, 3, | 163 1, 2, 2, 3, |
155 2, 3, 3, 4 | 164 2, 3, 3, 4 |
156 }; | 165 }; |
157 | 166 |
158 #include "SkPackBits.h" | 167 #include "SkPackBits.h" |
159 | 168 |
160 void SkTable_ColorFilter::flatten(SkFlattenableWriteBuffer& buffer) const { | 169 void SkTable_ColorFilter::flatten(SkFlattenableWriteBuffer& buffer) const { |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256], | 419 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256], |
411 const uint8_t tableR[256], | 420 const uint8_t tableR[256], |
412 const uint8_t tableG[256], | 421 const uint8_t tableG[256], |
413 const uint8_t tableB[256]) { | 422 const uint8_t tableB[256]) { |
414 return SkNEW_ARGS(SkTable_ColorFilter, (tableA, tableR, tableG, tableB)); | 423 return SkNEW_ARGS(SkTable_ColorFilter, (tableA, tableR, tableG, tableB)); |
415 } | 424 } |
416 | 425 |
417 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) | 426 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) |
418 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) | 427 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) |
419 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 428 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |