OLD | NEW |
---|---|
1 | |
2 /* | 1 /* |
3 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
4 * | 3 * |
5 * 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 |
6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
7 */ | 6 */ |
8 | 7 |
9 | |
10 #ifndef SkColorFilter_DEFINED | 8 #ifndef SkColorFilter_DEFINED |
11 #define SkColorFilter_DEFINED | 9 #define SkColorFilter_DEFINED |
12 | 10 |
13 #include "SkColor.h" | 11 #include "SkColor.h" |
14 #include "SkFlattenable.h" | 12 #include "SkFlattenable.h" |
13 #include "SkTDArray.h" | |
15 #include "SkXfermode.h" | 14 #include "SkXfermode.h" |
16 | 15 |
17 class SkBitmap; | 16 class SkBitmap; |
18 class GrProcessor; | 17 class GrProcessor; |
19 class GrContext; | 18 class GrContext; |
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). |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 are ignored. | 130 are ignored. |
132 */ | 131 */ |
133 static SkColorFilter* CreateLightingFilter(SkColor mul, SkColor add); | 132 static SkColorFilter* CreateLightingFilter(SkColor mul, SkColor add); |
134 | 133 |
135 /** Construct a colorfilter whose effect is to first apply the inner filter and then apply | 134 /** Construct a colorfilter whose effect is to first apply the inner filter and then apply |
136 * the outer filter to the result of the inner's. | 135 * the outer filter to the result of the inner's. |
137 * The reference counts for outer and inner are incremented. | 136 * The reference counts for outer and inner are incremented. |
138 */ | 137 */ |
139 static SkColorFilter* CreateComposeFilter(SkColorFilter* outer, SkColorFilte r* inner); | 138 static SkColorFilter* CreateComposeFilter(SkColorFilter* outer, SkColorFilte r* inner); |
140 | 139 |
141 /** A subclass may implement this factory function to work with the GPU back end. If the return | 140 /** |
142 is non-NULL then the caller owns a ref on the returned object. | 141 * A subclass may implement this factory function to work with the GPU back end. |
142 * If it returns true, then 1 or more fragment processors will have been ap pended to the | |
143 * array, each of which has been ref'd, so that the caller is responsible f or calling unref() | |
144 * on them when they are finished. If more than one processor is appended, they will be | |
145 * applied in FIFO order. | |
146 * | |
147 * If the subclass returns false, then it should not modify the array at al l. | |
143 */ | 148 */ |
144 virtual GrFragmentProcessor* asFragmentProcessor(GrContext*) const; | 149 virtual bool asFragmentProcessors(GrContext*, SkTDArray<GrFragmentProcessor* >*) const { |
bsalomon
2015/03/03 17:51:01
Does this mean we always have to malloc for the co
| |
150 return false; | |
151 } | |
145 | 152 |
146 SK_TO_STRING_PUREVIRT() | 153 SK_TO_STRING_PUREVIRT() |
147 | 154 |
148 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 155 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
149 SK_DEFINE_FLATTENABLE_TYPE(SkColorFilter) | 156 SK_DEFINE_FLATTENABLE_TYPE(SkColorFilter) |
150 | 157 |
151 protected: | 158 protected: |
152 SkColorFilter() {} | 159 SkColorFilter() {} |
153 | 160 |
154 private: | 161 private: |
155 typedef SkFlattenable INHERITED; | 162 typedef SkFlattenable INHERITED; |
156 }; | 163 }; |
157 | 164 |
158 #endif | 165 #endif |
OLD | NEW |