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 |
11 #include "SkColor.h" | 11 #include "SkColor.h" |
12 #include "SkFlattenable.h" | 12 #include "SkFlattenable.h" |
13 #include "SkTDArray.h" | 13 #include "SkTDArray.h" |
14 #include "SkXfermode.h" | 14 #include "SkXfermode.h" |
15 | 15 |
16 class GrContext; | 16 class GrContext; |
17 class GrFragmentProcessor; | 17 class GrFragmentProcessor; |
18 class GrProcessorDataManager; | |
19 class SkBitmap; | 18 class SkBitmap; |
20 | 19 |
21 /** | 20 /** |
22 * ColorFilters are optional objects in the drawing pipeline. When present in | 21 * ColorFilters are optional objects in the drawing pipeline. When present in |
23 * a paint, they are called with the "src" colors, and return new colors, which | 22 * a paint, they are called with the "src" colors, and return new colors, which |
24 * are then passed onto the next stage (either ImageFilter or Xfermode). | 23 * are then passed onto the next stage (either ImageFilter or Xfermode). |
25 * | 24 * |
26 * All subclasses are required to be reentrant-safe : it must be legal to share | 25 * All subclasses are required to be reentrant-safe : it must be legal to share |
27 * the same instance between several threads. | 26 * the same instance between several threads. |
28 */ | 27 */ |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 124 |
126 /** | 125 /** |
127 * A subclass may implement this factory function to work with the GPU back
end. It returns | 126 * A subclass may implement this factory function to work with the GPU back
end. It returns |
128 * a GrFragmentProcessor that implemets the color filter in GPU shader code
. | 127 * a GrFragmentProcessor that implemets the color filter in GPU shader code
. |
129 * | 128 * |
130 * The fragment processor receives a premultiplied input color and produces
a premultiplied | 129 * The fragment processor receives a premultiplied input color and produces
a premultiplied |
131 * output color. | 130 * output color. |
132 * | 131 * |
133 * A null return indicates that the color filter isn't implemented for the
GPU backend. | 132 * A null return indicates that the color filter isn't implemented for the
GPU backend. |
134 */ | 133 */ |
135 virtual const GrFragmentProcessor* asFragmentProcessor(GrContext*, | 134 virtual const GrFragmentProcessor* asFragmentProcessor(GrContext*) const { |
136 GrProcessorDataManage
r*) const { | |
137 return nullptr; | 135 return nullptr; |
138 } | 136 } |
139 | 137 |
140 bool affectsTransparentBlack() const { | 138 bool affectsTransparentBlack() const { |
141 return this->filterColor(0) != 0; | 139 return this->filterColor(0) != 0; |
142 } | 140 } |
143 | 141 |
144 SK_TO_STRING_PUREVIRT() | 142 SK_TO_STRING_PUREVIRT() |
145 | 143 |
146 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 144 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
(...skipping 10 matching lines...) Expand all Loading... |
157 * | 155 * |
158 * e.g. compose(filter, compose(compose(filter, filter), filter)) --> 4 | 156 * e.g. compose(filter, compose(compose(filter, filter), filter)) --> 4 |
159 */ | 157 */ |
160 virtual int privateComposedFilterCount() const { return 1; } | 158 virtual int privateComposedFilterCount() const { return 1; } |
161 friend class SkComposeColorFilter; | 159 friend class SkComposeColorFilter; |
162 | 160 |
163 typedef SkFlattenable INHERITED; | 161 typedef SkFlattenable INHERITED; |
164 }; | 162 }; |
165 | 163 |
166 #endif | 164 #endif |
OLD | NEW |