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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // DEPRECATED: call AsMode(...) | 181 // DEPRECATED: call AsMode(...) |
182 static bool IsMode(const SkXfermode* xfer, Mode* mode) { | 182 static bool IsMode(const SkXfermode* xfer, Mode* mode) { |
183 return AsMode(xfer, mode); | 183 return AsMode(xfer, mode); |
184 } | 184 } |
185 | 185 |
186 /** A subclass may implement this factory function to work with the GPU back
end. It is legal | 186 /** A subclass may implement this factory function to work with the GPU back
end. It is legal |
187 to call this with all but the context param NULL to simply test the retu
rn value. effect, | 187 to call this with all but the context param NULL to simply test the retu
rn value. effect, |
188 src, and dst must all be NULL or all non-NULL. If effect is non-NULL the
n the xfermode may | 188 src, and dst must all be NULL or all non-NULL. If effect is non-NULL the
n the xfermode may |
189 optionally allocate an effect to return and the caller as *effect. The c
aller will install | 189 optionally allocate an effect to return and the caller as *effect. The c
aller will install |
190 it and own a ref to it. Since the xfermode may or may not assign *effect
, the caller should | 190 it and own a ref to it. Since the xfermode may or may not assign *effect
, the caller should |
191 set *effect to NULL beforehand. If the function returns true then the sr
c and dst coeffs | 191 set *effect to NULL beforehand. If the function returns true and *effect
is NULL then the |
192 will be applied to the draw regardless of whether an effect was returned
. | 192 src and dst coeffs will be applied to the draw. When *effect is non-NULL
the coeffs are |
| 193 ignored. |
193 */ | 194 */ |
194 virtual bool asNewEffect(GrContext*, GrEffectRef** effect, Coeff* src, Coeff
* dst) const; | 195 virtual bool asNewEffectOrCoeff(GrContext*, |
| 196 GrEffectRef** effect, |
| 197 Coeff* src, |
| 198 Coeff* dst) const; |
195 | 199 |
196 /** | 200 /** |
197 * The same as calling xfermode->asNewEffect(...), except that this also ch
ecks if the xfermode | 201 * The same as calling xfermode->asNewEffect(...), except that this also ch
ecks if the xfermode |
198 * is NULL, and if so, treats it as kSrcOver_Mode. | 202 * is NULL, and if so, treats it as kSrcOver_Mode. |
199 */ | 203 */ |
200 static bool AsNewEffect(SkXfermode*, GrContext*, GrEffectRef** effect, Coeff
* src, Coeff* dst); | 204 static bool AsNewEffectOrCoeff(SkXfermode*, |
| 205 GrContext*, |
| 206 GrEffectRef** effect, |
| 207 Coeff* src, |
| 208 Coeff* dst); |
201 | 209 |
202 SkDEVCODE(virtual void toString(SkString* str) const = 0;) | 210 SkDEVCODE(virtual void toString(SkString* str) const = 0;) |
203 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 211 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
204 protected: | 212 protected: |
205 SkXfermode(SkFlattenableReadBuffer& rb) : SkFlattenable(rb) {} | 213 SkXfermode(SkFlattenableReadBuffer& rb) : SkFlattenable(rb) {} |
206 | 214 |
207 /** The default implementation of xfer32/xfer16/xferA8 in turn call this | 215 /** The default implementation of xfer32/xfer16/xferA8 in turn call this |
208 method, 1 color at a time (upscaled to a SkPMColor). The default | 216 method, 1 color at a time (upscaled to a SkPMColor). The default |
209 implmentation of this method just returns dst. If performance is | 217 implmentation of this method just returns dst. If performance is |
210 important, your subclass should override xfer32/xfer16/xferA8 directly. | 218 important, your subclass should override xfer32/xfer16/xferA8 directly. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 fProc = proc; | 262 fProc = proc; |
255 } | 263 } |
256 | 264 |
257 private: | 265 private: |
258 SkXfermodeProc fProc; | 266 SkXfermodeProc fProc; |
259 | 267 |
260 typedef SkXfermode INHERITED; | 268 typedef SkXfermode INHERITED; |
261 }; | 269 }; |
262 | 270 |
263 #endif | 271 #endif |
OLD | NEW |