| 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; | 16 class GrContext; |
| 17 class GrEffectRef; | 17 class GrEffectRef; |
| 18 class GrTexture; |
| 18 class SkString; | 19 class SkString; |
| 19 | 20 |
| 20 /** \class SkXfermode | 21 /** \class SkXfermode |
| 21 | 22 |
| 22 SkXfermode is the base class for objects that are called to implement custom | 23 SkXfermode is the base class for objects that are called to implement custom |
| 23 "transfer-modes" in the drawing pipeline. The static function Create(Modes) | 24 "transfer-modes" in the drawing pipeline. The static function Create(Modes) |
| 24 can be called to return an instance of any of the predefined subclasses as | 25 can be called to return an instance of any of the predefined subclasses as |
| 25 specified in the Modes enum. When an SkXfermode is assigned to an SkPaint, | 26 specified in the Modes enum. When an SkXfermode is assigned to an SkPaint, |
| 26 then objects drawn with that paint have the xfermode applied. | 27 then objects drawn with that paint have the xfermode applied. |
| 27 */ | 28 */ |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 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 |
| 196 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 |
| 197 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 |
| 198 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 |
| 199 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 |
| 200 ignored. | 201 ignored. |
| 201 */ | 202 */ |
| 202 virtual bool asNewEffectOrCoeff(GrContext*, | 203 virtual bool asNewEffectOrCoeff(GrContext*, |
| 203 GrEffectRef** effect, | 204 GrEffectRef** effect, |
| 204 Coeff* src, | 205 Coeff* src, |
| 205 Coeff* dst) const; | 206 Coeff* dst, |
| 207 GrTexture* background = NULL) const; |
| 206 | 208 |
| 207 /** | 209 /** |
| 208 * The same as calling xfermode->asNewEffect(...), except that this also ch
ecks if the xfermode | 210 * The same as calling xfermode->asNewEffect(...), except that this also ch
ecks if the xfermode |
| 209 * is NULL, and if so, treats it as kSrcOver_Mode. | 211 * is NULL, and if so, treats it as kSrcOver_Mode. |
| 210 */ | 212 */ |
| 211 static bool AsNewEffectOrCoeff(SkXfermode*, | 213 static bool AsNewEffectOrCoeff(SkXfermode*, |
| 212 GrContext*, | 214 GrContext*, |
| 213 GrEffectRef** effect, | 215 GrEffectRef** effect, |
| 214 Coeff* src, | 216 Coeff* src, |
| 215 Coeff* dst); | 217 Coeff* dst, |
| 218 GrTexture* background = NULL); |
| 216 | 219 |
| 217 SkDEVCODE(virtual void toString(SkString* str) const = 0;) | 220 SkDEVCODE(virtual void toString(SkString* str) const = 0;) |
| 218 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 221 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
| 219 protected: | 222 protected: |
| 220 SkXfermode(SkFlattenableReadBuffer& rb) : SkFlattenable(rb) {} | 223 SkXfermode(SkFlattenableReadBuffer& rb) : SkFlattenable(rb) {} |
| 221 | 224 |
| 222 /** The default implementation of xfer32/xfer16/xferA8 in turn call this | 225 /** The default implementation of xfer32/xfer16/xferA8 in turn call this |
| 223 method, 1 color at a time (upscaled to a SkPMColor). The default | 226 method, 1 color at a time (upscaled to a SkPMColor). The default |
| 224 implmentation of this method just returns dst. If performance is | 227 implmentation of this method just returns dst. If performance is |
| 225 important, your subclass should override xfer32/xfer16/xferA8 directly. | 228 important, your subclass should override xfer32/xfer16/xferA8 directly. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 fProc = proc; | 272 fProc = proc; |
| 270 } | 273 } |
| 271 | 274 |
| 272 private: | 275 private: |
| 273 SkXfermodeProc fProc; | 276 SkXfermodeProc fProc; |
| 274 | 277 |
| 275 typedef SkXfermode INHERITED; | 278 typedef SkXfermode INHERITED; |
| 276 }; | 279 }; |
| 277 | 280 |
| 278 #endif | 281 #endif |
| OLD | NEW |