| 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 class GrProcessorDataManager; |
| 20 | 20 |
| 21 /** | 21 /** |
| 22 * ColorFilters are optional objects in the drawing pipeline. When present in | 22 * 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 | 23 * 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). | 24 * are then passed onto the next stage (either ImageFilter or Xfermode). |
| 25 * | 25 * |
| 26 * 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 |
| 27 * the same instance between several threads. | 27 * the same instance between several threads. |
| 28 */ | 28 */ |
| 29 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... |
| 128 * 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 |
| 129 * 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() |
| 130 * 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 |
| 131 * applied in FIFO order. | 131 * applied in FIFO order. |
| 132 * | 132 * |
| 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*, GrShaderDataManager*, | 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 SK_TO_STRING_PUREVIRT() | 143 SK_TO_STRING_PUREVIRT() |
| 144 | 144 |
| 145 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 145 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
| 146 SK_DEFINE_FLATTENABLE_TYPE(SkColorFilter) | 146 SK_DEFINE_FLATTENABLE_TYPE(SkColorFilter) |
| 147 | 147 |
| 148 protected: | 148 protected: |
| 149 SkColorFilter() {} | 149 SkColorFilter() {} |
| 150 | 150 |
| 151 private: | 151 private: |
| 152 /* | 152 /* |
| 153 * 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 |
| 154 * 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 |
| 155 * as the number of GrFragmentProcessors returned by asFragmentProcessors's
array parameter. | 155 * as the number of GrFragmentProcessors returned by asFragmentProcessors's
array parameter. |
| 156 * | 156 * |
| 157 * e.g. compose(filter, compose(compose(filter, filter), filter)) --> 4 | 157 * e.g. compose(filter, compose(compose(filter, filter), filter)) --> 4 |
| 158 */ | 158 */ |
| 159 virtual int privateComposedFilterCount() const { return 1; } | 159 virtual int privateComposedFilterCount() const { return 1; } |
| 160 friend class SkComposeColorFilter; | 160 friend class SkComposeColorFilter; |
| 161 | 161 |
| 162 typedef SkFlattenable INHERITED; | 162 typedef SkFlattenable INHERITED; |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 #endif | 165 #endif |
| OLD | NEW |