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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 * src and dst parameters. | 185 * src and dst parameters. |
186 */ | 186 */ |
187 static bool ModeAsCoeff(Mode mode, Coeff* src, Coeff* dst); | 187 static bool ModeAsCoeff(Mode mode, Coeff* src, Coeff* dst); |
188 | 188 |
189 // DEPRECATED: call AsMode(...) | 189 // DEPRECATED: call AsMode(...) |
190 static bool IsMode(const SkXfermode* xfer, Mode* mode) { | 190 static bool IsMode(const SkXfermode* xfer, Mode* mode) { |
191 return AsMode(xfer, mode); | 191 return AsMode(xfer, mode); |
192 } | 192 } |
193 | 193 |
194 /** A subclass may implement this factory function to work with the GPU back
end. It is legal | 194 /** A subclass may implement this factory function to work with the GPU back
end. It is legal |
195 to call this with all but the context param NULL to simply test the retu
rn value. effect, | 195 to call this with all params NULL to simply test the return value. If ef
fect is non-NULL |
196 src, and dst must all be NULL or all non-NULL. If effect is non-NULL the
n the xfermode may | 196 then the xfermode may optionally allocate an effect to return and the ca
ller as *effect. |
197 optionally allocate an effect to return and the caller as *effect. The c
aller will install | 197 The caller will install it and own a ref to it. Since the xfermode may o
r may not assign |
198 it and own a ref to it. Since the xfermode may or may not assign *effect
, the caller should | 198 *effect, the caller should set *effect to NULL beforehand. background sp
ecifies the |
199 set *effect to NULL beforehand. If the function returns true and *effect
is NULL then the | 199 texture to use as the background for compositing, and should be accessed
in the effect's |
200 src and dst coeffs will be applied to the draw. When *effect is non-NULL
the coeffs are | 200 fragment shader. If NULL, the effect should request access to destinatio
n color |
201 ignored. background specifies the texture to use as the background for c
ompositing, and | 201 (setWillReadDstColor()), and use that in the fragment shader (builder->d
stColor()). |
202 should be accessed in the effect's fragment shader. If NULL, the effect
should request | |
203 access to destination color (setWillReadDstColor()), and use that in the
fragment shader | |
204 (builder->dstColor()). | |
205 */ | 202 */ |
206 virtual bool asNewEffectOrCoeff(GrEffectRef** effect, | 203 virtual bool asNewEffect(GrEffectRef** effect, GrTexture* background = NULL)
const; |
207 Coeff* src, | |
208 Coeff* dst, | |
209 GrTexture* background = NULL) const; | |
210 | 204 |
211 /** | 205 /** Returns true if the xfermode can be expressed as coeffs (src, dst), or a
s an effect |
212 * The same as calling xfermode->asNewEffect(...), except that this also ch
ecks if the xfermode | 206 (effect). This helper calls the asCoeff() and asNewEffect() virtuals. If
the xfermode is |
213 * is NULL, and if so, treats it as kSrcOver_Mode. | 207 NULL, it is treated as kSrcOver_Mode. It is legal to call this with all
params NULL to |
| 208 simply test the return value. effect, src, and dst must all be NULL or
all non-NULL. |
214 */ | 209 */ |
215 static bool AsNewEffectOrCoeff(SkXfermode*, | 210 static bool AsNewEffectOrCoeff(SkXfermode*, |
216 GrEffectRef** effect, | 211 GrEffectRef** effect, |
217 Coeff* src, | 212 Coeff* src, |
218 Coeff* dst, | 213 Coeff* dst, |
219 GrTexture* background = NULL); | 214 GrTexture* background = NULL); |
220 | 215 |
221 SkDEVCODE(virtual void toString(SkString* str) const = 0;) | 216 SkDEVCODE(virtual void toString(SkString* str) const = 0;) |
222 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 217 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
223 protected: | 218 protected: |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 return fProc; | 274 return fProc; |
280 } | 275 } |
281 | 276 |
282 private: | 277 private: |
283 SkXfermodeProc fProc; | 278 SkXfermodeProc fProc; |
284 | 279 |
285 typedef SkXfermode INHERITED; | 280 typedef SkXfermode INHERITED; |
286 }; | 281 }; |
287 | 282 |
288 #endif | 283 #endif |
OLD | NEW |