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 SkBitmap; | 16 class SkBitmap; |
17 class GrProcessor; | 17 class GrProcessor; |
18 class GrContext; | 18 class GrContext; |
| 19 class GrShaderDataManager; |
19 | 20 |
20 /** | 21 /** |
21 * ColorFilters are optional objects in the drawing pipeline. When present in | 22 * ColorFilters are optional objects in the drawing pipeline. When present in |
22 * a paint, they are called with the "src" colors, and return new colors, which | 23 * a paint, they are called with the "src" colors, and return new colors, which |
23 * are then passed onto the next stage (either ImageFilter or Xfermode). | 24 * are then passed onto the next stage (either ImageFilter or Xfermode). |
24 * | 25 * |
25 * All subclasses are required to be reentrant-safe : it must be legal to share | 26 * All subclasses are required to be reentrant-safe : it must be legal to share |
26 * the same instance between several threads. | 27 * the same instance between several threads. |
27 */ | 28 */ |
28 class SK_API SkColorFilter : public SkFlattenable { | 29 class SK_API SkColorFilter : public SkFlattenable { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 * If it returns true, then 1 or more fragment processors will have been ap
pended to the | 128 * If it returns true, then 1 or more fragment processors will have been ap
pended to the |
128 * array, each of which has been ref'd, so that the caller is responsible f
or calling unref() | 129 * array, each of which has been ref'd, so that the caller is responsible f
or calling unref() |
129 * on them when they are finished. If more than one processor is appended,
they will be | 130 * on them when they are finished. If more than one processor is appended,
they will be |
130 * applied in FIFO order. | 131 * applied in FIFO order. |
131 * | 132 * |
132 * 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 |
133 * 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. |
134 * | 135 * |
135 * 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. |
136 */ | 137 */ |
137 virtual bool asFragmentProcessors(GrContext*, SkTDArray<GrFragmentProcessor*
>*) const { | 138 virtual bool asFragmentProcessors(GrContext*, GrShaderDataManager*, |
| 139 SkTDArray<GrFragmentProcessor*>*) const { |
138 return false; | 140 return false; |
139 } | 141 } |
140 | 142 |
141 SK_TO_STRING_PUREVIRT() | 143 SK_TO_STRING_PUREVIRT() |
142 | 144 |
143 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 145 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
144 SK_DEFINE_FLATTENABLE_TYPE(SkColorFilter) | 146 SK_DEFINE_FLATTENABLE_TYPE(SkColorFilter) |
145 | 147 |
146 protected: | 148 protected: |
147 SkColorFilter() {} | 149 SkColorFilter() {} |
148 | 150 |
149 private: | 151 private: |
150 /* | 152 /* |
151 * Returns 1 if this is a single filter (not a composition of other filters
), otherwise it | 153 * Returns 1 if this is a single filter (not a composition of other filters
), otherwise it |
152 * reutrns the number of leaf-node filters in a composition. This should be
the same value | 154 * reutrns the number of leaf-node filters in a composition. This should be
the same value |
153 * as the number of GrFragmentProcessors returned by asFragmentProcessors's
array parameter. | 155 * as the number of GrFragmentProcessors returned by asFragmentProcessors's
array parameter. |
154 * | 156 * |
155 * e.g. compose(filter, compose(compose(filter, filter), filter)) --> 4 | 157 * e.g. compose(filter, compose(compose(filter, filter), filter)) --> 4 |
156 */ | 158 */ |
157 virtual int privateComposedFilterCount() const { return 1; } | 159 virtual int privateComposedFilterCount() const { return 1; } |
158 friend class SkComposeColorFilter; | 160 friend class SkComposeColorFilter; |
159 | 161 |
160 typedef SkFlattenable INHERITED; | 162 typedef SkFlattenable INHERITED; |
161 }; | 163 }; |
162 | 164 |
163 #endif | 165 #endif |
OLD | NEW |