| 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 GrEffect; | 16 class GrFragmentProcessor; |
| 17 class GrTexture; | 17 class GrTexture; |
| 18 class SkString; | 18 class SkString; |
| 19 | 19 |
| 20 /** \class SkXfermode | 20 /** \class SkXfermode |
| 21 * | 21 * |
| 22 * 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 |
| 23 * "transfer-modes" in the drawing pipeline. The static function Create(Modes) | 23 * "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 | 24 * 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, | 25 * specified in the Modes enum. When an SkXfermode is assigned to an SkPaint, |
| 26 * then objects drawn with that paint have the xfermode applied. | 26 * then objects drawn with that paint have the xfermode applied. |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 191 |
| 192 /** A subclass may implement this factory function to work with the GPU back
end. It is legal | 192 /** A subclass may implement this factory function to work with the GPU back
end. It is legal |
| 193 to call this with all params NULL to simply test the return value. If ef
fect is non-NULL | 193 to call this with all params NULL to simply test the return value. If ef
fect is non-NULL |
| 194 then the xfermode may optionally allocate an effect to return and the ca
ller as *effect. | 194 then the xfermode may optionally allocate an effect to return and the ca
ller as *effect. |
| 195 The caller will install it and own a ref to it. Since the xfermode may o
r may not assign | 195 The caller will install it and own a ref to it. Since the xfermode may o
r may not assign |
| 196 *effect, the caller should set *effect to NULL beforehand. background sp
ecifies the | 196 *effect, the caller should set *effect to NULL beforehand. background sp
ecifies the |
| 197 texture to use as the background for compositing, and should be accessed
in the effect's | 197 texture to use as the background for compositing, and should be accessed
in the effect's |
| 198 fragment shader. If NULL, the effect should request access to destinatio
n color | 198 fragment shader. If NULL, the effect should request access to destinatio
n color |
| 199 (setWillReadDstColor()), and use that in the fragment shader (builder->d
stColor()). | 199 (setWillReadDstColor()), and use that in the fragment shader (builder->d
stColor()). |
| 200 */ | 200 */ |
| 201 virtual bool asNewEffect(GrEffect** effect, GrTexture* background = NULL) co
nst; | 201 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture* backgroun
d = NULL) const; |
| 202 | 202 |
| 203 /** Returns true if the xfermode can be expressed as coeffs (src, dst), or a
s an effect | 203 /** Returns true if the xfermode can be expressed as coeffs (src, dst), or a
s an effect |
| 204 (effect). This helper calls the asCoeff() and asNewEffect() virtuals. If
the xfermode is | 204 (effect). This helper calls the asCoeff() and asFragmentProcessor() virt
uals. If the xfermode is |
| 205 NULL, it is treated as kSrcOver_Mode. It is legal to call this with all
params NULL to | 205 NULL, it is treated as kSrcOver_Mode. It is legal to call this with all
params NULL to |
| 206 simply test the return value. effect, src, and dst must all be NULL or
all non-NULL. | 206 simply test the return value. effect, src, and dst must all be NULL or
all non-NULL. |
| 207 */ | 207 */ |
| 208 static bool AsNewEffectOrCoeff(SkXfermode*, | 208 static bool asFragmentProcessorOrCoeff(SkXfermode*, GrFragmentProcessor**, C
oeff* src, |
| 209 GrEffect** effect, | 209 Coeff* dst, GrTexture* background = N
ULL); |
| 210 Coeff* src, | |
| 211 Coeff* dst, | |
| 212 GrTexture* background = NULL); | |
| 213 | 210 |
| 214 SK_TO_STRING_PUREVIRT() | 211 SK_TO_STRING_PUREVIRT() |
| 215 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 212 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
| 216 SK_DEFINE_FLATTENABLE_TYPE(SkXfermode) | 213 SK_DEFINE_FLATTENABLE_TYPE(SkXfermode) |
| 217 | 214 |
| 218 protected: | 215 protected: |
| 219 SkXfermode() {} | 216 SkXfermode() {} |
| 220 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING | 217 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
| 221 explicit SkXfermode(SkReadBuffer& rb) : SkFlattenable(rb) {} | 218 explicit SkXfermode(SkReadBuffer& rb) : SkFlattenable(rb) {} |
| 222 #endif | 219 #endif |
| (...skipping 10 matching lines...) Expand all Loading... |
| 233 | 230 |
| 234 private: | 231 private: |
| 235 enum { | 232 enum { |
| 236 kModeCount = kLastMode + 1 | 233 kModeCount = kLastMode + 1 |
| 237 }; | 234 }; |
| 238 | 235 |
| 239 typedef SkFlattenable INHERITED; | 236 typedef SkFlattenable INHERITED; |
| 240 }; | 237 }; |
| 241 | 238 |
| 242 #endif | 239 #endif |
| OLD | NEW |