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 asMode(), asCoeff() and asXPFactory() virtuals. If the xfermode is |
bsalomon
2015/01/20 14:59:34
Do we still need asMode() and asCoeff() or can tho
egdaniel
2015/01/20 16:03:11
Removed the need to check these in this function.
| |
212 and asFragmentProcessor() virtuals. If the xfermode is NULL, it is treat ed as kSrcOver_Mode. | 212 NULL, it is treated as kSrcOver_Mode. It is legal to call this with xpf param NULL to simply |
213 It is legal to call this with all params NULL to simply test the return value. | 213 test the return value. |
214 fp and xpf must both be NULL or all non-NULL. | |
215 */ | 214 */ |
216 static bool AsFragmentProcessorOrXPFactory(SkXfermode*, GrFragmentProcessor* *, | 215 static bool AsXPFactory(SkXfermode*, GrXPFactory**); |
217 GrXPFactory**); | |
218 | 216 |
219 SK_TO_STRING_PUREVIRT() | 217 SK_TO_STRING_PUREVIRT() |
220 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 218 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
221 SK_DEFINE_FLATTENABLE_TYPE(SkXfermode) | 219 SK_DEFINE_FLATTENABLE_TYPE(SkXfermode) |
222 | 220 |
223 protected: | 221 protected: |
224 SkXfermode() {} | 222 SkXfermode() {} |
225 /** The default implementation of xfer32/xfer16/xferA8 in turn call this | 223 /** The default implementation of xfer32/xfer16/xferA8 in turn call this |
226 method, 1 color at a time (upscaled to a SkPMColor). The default | 224 method, 1 color at a time (upscaled to a SkPMColor). The default |
227 implmentation of this method just returns dst. If performance is | 225 implmentation of this method just returns dst. If performance is |
228 important, your subclass should override xfer32/xfer16/xferA8 directly. | 226 important, your subclass should override xfer32/xfer16/xferA8 directly. |
229 | 227 |
230 This method will not be called directly by the client, so it need not | 228 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 | 229 be implemented if your subclass has overridden xfer32/xfer16/xferA8 |
232 */ | 230 */ |
233 virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst) const; | 231 virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst) const; |
234 | 232 |
235 private: | 233 private: |
236 enum { | 234 enum { |
237 kModeCount = kLastMode + 1 | 235 kModeCount = kLastMode + 1 |
238 }; | 236 }; |
239 | 237 |
240 typedef SkFlattenable INHERITED; | 238 typedef SkFlattenable INHERITED; |
241 }; | 239 }; |
242 | 240 |
243 #endif | 241 #endif |
OLD | NEW |