| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 /** Construct a colorfilter whose effect is to first apply the inner filter
and then apply | 117 /** Construct a colorfilter whose effect is to first apply the inner filter
and then apply |
| 118 * the outer filter to the result of the inner's. | 118 * the outer filter to the result of the inner's. |
| 119 * The reference counts for outer and inner are incremented. | 119 * The reference counts for outer and inner are incremented. |
| 120 * | 120 * |
| 121 * Due to internal limits, it is possible that this will return NULL, so th
e caller must | 121 * Due to internal limits, it is possible that this will return NULL, so th
e caller must |
| 122 * always check. | 122 * always check. |
| 123 */ | 123 */ |
| 124 static SkColorFilter* CreateComposeFilter(SkColorFilter* outer, SkColorFilte
r* inner); | 124 static SkColorFilter* CreateComposeFilter(SkColorFilter* outer, SkColorFilte
r* inner); |
| 125 | 125 |
| 126 /** | 126 /** |
| 127 * A subclass may implement this factory function to work with the GPU back
end. | 127 * A subclass may implement this factory function to work with the GPU back
end. It returns |
| 128 * If it returns true, then 1 or more fragment processors will have been ap
pended to the | 128 * a GrFragmentProcessor that implemets the color filter in GPU shader code
. |
| 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 | |
| 131 * applied in FIFO order. | |
| 132 * | 129 * |
| 133 * The fragment processor(s) must each return their color as a premul norma
lized value | 130 * The fragment processor receives a premultiplied input color and produces
a premultiplied |
| 134 * e.g. each component between [0..1] and each color component <= alpha. | 131 * output color. |
| 135 * | 132 * |
| 136 * If the subclass returns false, then it should not modify the array at al
l. | 133 * A null return indicates that the color filter isn't implemented for the
GPU backend. |
| 137 */ | 134 */ |
| 138 virtual bool asFragmentProcessors(GrContext*, GrProcessorDataManager*, | 135 virtual const GrFragmentProcessor* asFragmentProcessor(GrContext*, |
| 139 SkTDArray<const GrFragmentProcessor*>*) co
nst { | 136 GrProcessorDataManage
r*) const { |
| 140 return false; | 137 return nullptr; |
| 141 } | 138 } |
| 142 | 139 |
| 143 bool affectsTransparentBlack() const { | 140 bool affectsTransparentBlack() const { |
| 144 return this->filterColor(0) != 0; | 141 return this->filterColor(0) != 0; |
| 145 } | 142 } |
| 146 | 143 |
| 147 SK_TO_STRING_PUREVIRT() | 144 SK_TO_STRING_PUREVIRT() |
| 148 | 145 |
| 149 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 146 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
| 150 SK_DEFINE_FLATTENABLE_TYPE(SkColorFilter) | 147 SK_DEFINE_FLATTENABLE_TYPE(SkColorFilter) |
| 151 | 148 |
| 152 protected: | 149 protected: |
| 153 SkColorFilter() {} | 150 SkColorFilter() {} |
| 154 | 151 |
| 155 private: | 152 private: |
| 156 /* | 153 /* |
| 157 * Returns 1 if this is a single filter (not a composition of other filters
), otherwise it | 154 * Returns 1 if this is a single filter (not a composition of other filters
), otherwise it |
| 158 * reutrns the number of leaf-node filters in a composition. This should be
the same value | 155 * reutrns the number of leaf-node filters in a composition. This should be
the same value |
| 159 * as the number of GrFragmentProcessors returned by asFragmentProcessors's
array parameter. | 156 * as the number of GrFragmentProcessors returned by asFragmentProcessors's
array parameter. |
| 160 * | 157 * |
| 161 * e.g. compose(filter, compose(compose(filter, filter), filter)) --> 4 | 158 * e.g. compose(filter, compose(compose(filter, filter), filter)) --> 4 |
| 162 */ | 159 */ |
| 163 virtual int privateComposedFilterCount() const { return 1; } | 160 virtual int privateComposedFilterCount() const { return 1; } |
| 164 friend class SkComposeColorFilter; | 161 friend class SkComposeColorFilter; |
| 165 | 162 |
| 166 typedef SkFlattenable INHERITED; | 163 typedef SkFlattenable INHERITED; |
| 167 }; | 164 }; |
| 168 | 165 |
| 169 #endif | 166 #endif |
| OLD | NEW |