OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 #ifndef SkColorFilter_DEFINED | 8 #ifndef SkColorFilter_DEFINED |
9 #define SkColorFilter_DEFINED | 9 #define SkColorFilter_DEFINED |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 */ | 61 */ |
62 virtual bool asComponentTable(SkBitmap* table) const; | 62 virtual bool asComponentTable(SkBitmap* table) const; |
63 | 63 |
64 /** Called with a scanline of colors, as if there was a shader installed. | 64 /** Called with a scanline of colors, as if there was a shader installed. |
65 The implementation writes out its filtered version into result[]. | 65 The implementation writes out its filtered version into result[]. |
66 Note: shader and result may be the same buffer. | 66 Note: shader and result may be the same buffer. |
67 @param src array of colors, possibly generated by a shader | 67 @param src array of colors, possibly generated by a shader |
68 @param count the number of entries in the src[] and result[] arrays | 68 @param count the number of entries in the src[] and result[] arrays |
69 @param result written by the filter | 69 @param result written by the filter |
70 */ | 70 */ |
71 virtual void filterSpan(const SkPMColor src[], int count, | 71 virtual void filterSpan(const SkPMColor src[], int count, SkPMColor result[]
) const = 0; |
72 SkPMColor result[]) const = 0; | |
73 /** Called with a scanline of colors, as if there was a shader installed. | |
74 The implementation writes out its filtered version into result[]. | |
75 Note: shader and result may be the same buffer. | |
76 @param src array of colors, possibly generated by a shader | |
77 @param count the number of entries in the src[] and result[] arrays | |
78 @param result written by the filter | |
79 */ | |
80 virtual void filterSpan16(const uint16_t shader[], int count, | |
81 uint16_t result[]) const; | |
82 | 72 |
83 enum Flags { | 73 enum Flags { |
84 /** If set the filter methods will not change the alpha channel of the | 74 /** If set the filter methods will not change the alpha channel of the c
olors. |
85 colors. | |
86 */ | 75 */ |
87 kAlphaUnchanged_Flag = 0x01, | 76 kAlphaUnchanged_Flag = 0x01, |
88 /** If set, this subclass implements filterSpan16(). If this flag is | |
89 set, then kAlphaUnchanged_Flag must also be set. | |
90 */ | |
91 kHasFilter16_Flag = 0x02 | |
92 }; | 77 }; |
93 | 78 |
94 /** Returns the flags for this filter. Override in subclasses to return | 79 /** Returns the flags for this filter. Override in subclasses to return cust
om flags. |
95 custom flags. | |
96 */ | 80 */ |
97 virtual uint32_t getFlags() const { return 0; } | 81 virtual uint32_t getFlags() const { return 0; } |
98 | 82 |
99 /** | 83 /** |
100 * If this subclass can optimally createa composition with the inner filter
, return it as | 84 * If this subclass can optimally createa composition with the inner filter
, return it as |
101 * a new filter (which the caller must unref() when it is done). If no such
optimization | 85 * a new filter (which the caller must unref() when it is done). If no such
optimization |
102 * is known, return NULL. | 86 * is known, return NULL. |
103 * | 87 * |
104 * e.g. result(color) == this_filter(inner(color)) | 88 * e.g. result(color) == this_filter(inner(color)) |
105 */ | 89 */ |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 * | 156 * |
173 * e.g. compose(filter, compose(compose(filter, filter), filter)) --> 4 | 157 * e.g. compose(filter, compose(compose(filter, filter), filter)) --> 4 |
174 */ | 158 */ |
175 virtual int privateComposedFilterCount() const { return 1; } | 159 virtual int privateComposedFilterCount() const { return 1; } |
176 friend class SkComposeColorFilter; | 160 friend class SkComposeColorFilter; |
177 | 161 |
178 typedef SkFlattenable INHERITED; | 162 typedef SkFlattenable INHERITED; |
179 }; | 163 }; |
180 | 164 |
181 #endif | 165 #endif |
OLD | NEW |