| 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 |
| 11 #define SkXfermode_DEFINED | 11 #define SkXfermode_DEFINED |
| 12 | 12 |
| 13 #include "SkFlattenable.h" | 13 #include "SkFlattenable.h" |
| 14 #include "SkColor.h" | 14 #include "SkColor.h" |
| 15 | 15 |
| 16 class GrContext; | |
| 17 class GrEffectRef; | 16 class GrEffectRef; |
| 18 class GrTexture; | 17 class GrTexture; |
| 19 class SkString; | 18 class SkString; |
| 20 | 19 |
| 21 /** \class SkXfermode | 20 /** \class SkXfermode |
| 22 * | 21 * |
| 23 * SkXfermode is the base class for objects that are called to implement custom | 22 * SkXfermode is the base class for objects that are called to implement custom |
| 24 * "transfer-modes" in the drawing pipeline. The static function Create(Modes) | 23 * "transfer-modes" in the drawing pipeline. The static function Create(Modes) |
| 25 * can be called to return an instance of any of the predefined subclasses as | 24 * can be called to return an instance of any of the predefined subclasses as |
| 26 * specified in the Modes enum. When an SkXfermode is assigned to an SkPaint, | 25 * specified in the Modes enum. When an SkXfermode is assigned to an SkPaint, |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 src, and dst must all be NULL or all non-NULL. If effect is non-NULL the
n the xfermode may | 196 src, and dst must all be NULL or all non-NULL. If effect is non-NULL the
n the xfermode may |
| 198 optionally allocate an effect to return and the caller as *effect. The c
aller will install | 197 optionally allocate an effect to return and the caller as *effect. The c
aller will install |
| 199 it and own a ref to it. Since the xfermode may or may not assign *effect
, the caller should | 198 it and own a ref to it. Since the xfermode may or may not assign *effect
, the caller should |
| 200 set *effect to NULL beforehand. If the function returns true and *effect
is NULL then the | 199 set *effect to NULL beforehand. If the function returns true and *effect
is NULL then the |
| 201 src and dst coeffs will be applied to the draw. When *effect is non-NULL
the coeffs are | 200 src and dst coeffs will be applied to the draw. When *effect is non-NULL
the coeffs are |
| 202 ignored. background specifies the texture to use as the background for c
ompositing, and | 201 ignored. background specifies the texture to use as the background for c
ompositing, and |
| 203 should be accessed in the effect's fragment shader. If NULL, the effect
should request | 202 should be accessed in the effect's fragment shader. If NULL, the effect
should request |
| 204 access to destination color (setWillReadDstColor()), and use that in the
fragment shader | 203 access to destination color (setWillReadDstColor()), and use that in the
fragment shader |
| 205 (builder->dstColor()). | 204 (builder->dstColor()). |
| 206 */ | 205 */ |
| 207 virtual bool asNewEffectOrCoeff(GrContext*, | 206 virtual bool asNewEffectOrCoeff(GrEffectRef** effect, |
| 208 GrEffectRef** effect, | |
| 209 Coeff* src, | 207 Coeff* src, |
| 210 Coeff* dst, | 208 Coeff* dst, |
| 211 GrTexture* background = NULL) const; | 209 GrTexture* background = NULL) const; |
| 212 | 210 |
| 213 /** | 211 /** |
| 214 * The same as calling xfermode->asNewEffect(...), except that this also ch
ecks if the xfermode | 212 * The same as calling xfermode->asNewEffect(...), except that this also ch
ecks if the xfermode |
| 215 * is NULL, and if so, treats it as kSrcOver_Mode. | 213 * is NULL, and if so, treats it as kSrcOver_Mode. |
| 216 */ | 214 */ |
| 217 static bool AsNewEffectOrCoeff(SkXfermode*, | 215 static bool AsNewEffectOrCoeff(SkXfermode*, |
| 218 GrContext*, | |
| 219 GrEffectRef** effect, | 216 GrEffectRef** effect, |
| 220 Coeff* src, | 217 Coeff* src, |
| 221 Coeff* dst, | 218 Coeff* dst, |
| 222 GrTexture* background = NULL); | 219 GrTexture* background = NULL); |
| 223 | 220 |
| 224 SkDEVCODE(virtual void toString(SkString* str) const = 0;) | 221 SkDEVCODE(virtual void toString(SkString* str) const = 0;) |
| 225 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 222 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
| 226 protected: | 223 protected: |
| 227 SkXfermode(SkFlattenableReadBuffer& rb) : SkFlattenable(rb) {} | 224 SkXfermode(SkFlattenableReadBuffer& rb) : SkFlattenable(rb) {} |
| 228 | 225 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 return fProc; | 279 return fProc; |
| 283 } | 280 } |
| 284 | 281 |
| 285 private: | 282 private: |
| 286 SkXfermodeProc fProc; | 283 SkXfermodeProc fProc; |
| 287 | 284 |
| 288 typedef SkXfermode INHERITED; | 285 typedef SkXfermode INHERITED; |
| 289 }; | 286 }; |
| 290 | 287 |
| 291 #endif | 288 #endif |
| OLD | NEW |