OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkXfermode_DEFINED | 10 #ifndef SkXfermode_DEFINED |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture* backgroun
d) const; | 200 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture* backgroun
d) const; |
201 | 201 |
202 /** A subclass may implement this factory function to work with the GPU back
end. It is legal | 202 /** A subclass may implement this factory function to work with the GPU back
end. It is legal |
203 to call this with xpf NULL to simply test the return value. If xpf is no
n-NULL then the | 203 to call this with xpf NULL to simply test the return value. If xpf is no
n-NULL then the |
204 xfermode may optionally allocate a factory to return to the caller as *x
pf. The caller | 204 xfermode may optionally allocate a factory to return to the caller as *x
pf. The caller |
205 will install it and own a ref to it. Since the xfermode may or may not a
ssign *xpf, the | 205 will install it and own a ref to it. Since the xfermode may or may not a
ssign *xpf, the |
206 caller should set *xpf to NULL beforehand. XferProcessors cannot use a b
ackground texture. | 206 caller should set *xpf to NULL beforehand. XferProcessors cannot use a b
ackground texture. |
207 */ | 207 */ |
208 virtual bool asXPFactory(GrXPFactory** xpf) const; | 208 virtual bool asXPFactory(GrXPFactory** xpf) const; |
209 | 209 |
210 /** Returns true if the xfermode can be expressed as an xfer processor facto
ry (xpFactory), | 210 /** Returns true if the xfermode can be expressed as an xfer processor facto
ry (xpFactory). |
211 or a fragment processor. This helper calls the asCoeff(), asXPFactory(), | 211 This helper calls the asXPFactory() virtual. If the xfermode is NULL, it
is treated as |
212 and asFragmentProcessor() virtuals. If the xfermode is NULL, it is treat
ed as kSrcOver_Mode. | 212 kSrcOver_Mode. It is legal to call this with xpf param NULL to simply te
st the return value. |
213 It is legal to call this with all params NULL to simply test the return
value. | |
214 fp and xpf must both be NULL or all non-NULL. | |
215 */ | 213 */ |
216 static bool AsFragmentProcessorOrXPFactory(SkXfermode*, GrFragmentProcessor*
*, | 214 static bool AsXPFactory(SkXfermode*, GrXPFactory**); |
217 GrXPFactory**); | |
218 | 215 |
219 SK_TO_STRING_PUREVIRT() | 216 SK_TO_STRING_PUREVIRT() |
220 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 217 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
221 SK_DEFINE_FLATTENABLE_TYPE(SkXfermode) | 218 SK_DEFINE_FLATTENABLE_TYPE(SkXfermode) |
222 | 219 |
223 protected: | 220 protected: |
224 SkXfermode() {} | 221 SkXfermode() {} |
225 /** The default implementation of xfer32/xfer16/xferA8 in turn call this | 222 /** The default implementation of xfer32/xfer16/xferA8 in turn call this |
226 method, 1 color at a time (upscaled to a SkPMColor). The default | 223 method, 1 color at a time (upscaled to a SkPMColor). The default |
227 implmentation of this method just returns dst. If performance is | 224 implmentation of this method just returns dst. If performance is |
228 important, your subclass should override xfer32/xfer16/xferA8 directly. | 225 important, your subclass should override xfer32/xfer16/xferA8 directly. |
229 | 226 |
230 This method will not be called directly by the client, so it need not | 227 This method will not be called directly by the client, so it need not |
231 be implemented if your subclass has overridden xfer32/xfer16/xferA8 | 228 be implemented if your subclass has overridden xfer32/xfer16/xferA8 |
232 */ | 229 */ |
233 virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst) const; | 230 virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst) const; |
234 | 231 |
235 private: | 232 private: |
236 enum { | 233 enum { |
237 kModeCount = kLastMode + 1 | 234 kModeCount = kLastMode + 1 |
238 }; | 235 }; |
239 | 236 |
240 typedef SkFlattenable INHERITED; | 237 typedef SkFlattenable INHERITED; |
241 }; | 238 }; |
242 | 239 |
243 #endif | 240 #endif |
OLD | NEW |