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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 * The fragment processor(s) must each return their color as a premul norma
lized value | 133 * The fragment processor(s) must each return their color as a premul norma
lized value |
134 * e.g. each component between [0..1] and each color component <= alpha. | 134 * e.g. each component between [0..1] and each color component <= alpha. |
135 * | 135 * |
136 * If the subclass returns false, then it should not modify the array at al
l. | 136 * If the subclass returns false, then it should not modify the array at al
l. |
137 */ | 137 */ |
138 virtual bool asFragmentProcessors(GrContext*, GrProcessorDataManager*, | 138 virtual bool asFragmentProcessors(GrContext*, GrProcessorDataManager*, |
139 SkTDArray<GrFragmentProcessor*>*) const { | 139 SkTDArray<GrFragmentProcessor*>*) const { |
140 return false; | 140 return false; |
141 } | 141 } |
142 | 142 |
| 143 bool affectsTransparentBlack() const { |
| 144 return this->filterColor(0) != 0; |
| 145 } |
| 146 |
143 SK_TO_STRING_PUREVIRT() | 147 SK_TO_STRING_PUREVIRT() |
144 | 148 |
145 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 149 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
146 SK_DEFINE_FLATTENABLE_TYPE(SkColorFilter) | 150 SK_DEFINE_FLATTENABLE_TYPE(SkColorFilter) |
147 | 151 |
148 protected: | 152 protected: |
149 SkColorFilter() {} | 153 SkColorFilter() {} |
150 | 154 |
151 private: | 155 private: |
152 /* | 156 /* |
153 * Returns 1 if this is a single filter (not a composition of other filters
), otherwise it | 157 * Returns 1 if this is a single filter (not a composition of other filters
), otherwise it |
154 * reutrns the number of leaf-node filters in a composition. This should be
the same value | 158 * reutrns the number of leaf-node filters in a composition. This should be
the same value |
155 * as the number of GrFragmentProcessors returned by asFragmentProcessors's
array parameter. | 159 * as the number of GrFragmentProcessors returned by asFragmentProcessors's
array parameter. |
156 * | 160 * |
157 * e.g. compose(filter, compose(compose(filter, filter), filter)) --> 4 | 161 * e.g. compose(filter, compose(compose(filter, filter), filter)) --> 4 |
158 */ | 162 */ |
159 virtual int privateComposedFilterCount() const { return 1; } | 163 virtual int privateComposedFilterCount() const { return 1; } |
160 friend class SkComposeColorFilter; | 164 friend class SkComposeColorFilter; |
161 | 165 |
162 typedef SkFlattenable INHERITED; | 166 typedef SkFlattenable INHERITED; |
163 }; | 167 }; |
164 | 168 |
165 #endif | 169 #endif |
OLD | NEW |