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 GrEffectRef; |
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 asNewEffect(GrEffectRef** effect, GrTexture* background = 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 asNewEffect() virtuals. 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 AsNewEffectOrCoeff(SkXfermode*, |
209 GrEffect** effect, | 209 GrEffectRef** effect, |
210 Coeff* src, | 210 Coeff* src, |
211 Coeff* dst, | 211 Coeff* dst, |
212 GrTexture* background = NULL); | 212 GrTexture* background = NULL); |
213 | 213 |
214 SK_TO_STRING_PUREVIRT() | 214 SK_TO_STRING_PUREVIRT() |
215 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 215 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
216 SK_DEFINE_FLATTENABLE_TYPE(SkXfermode) | 216 SK_DEFINE_FLATTENABLE_TYPE(SkXfermode) |
217 | 217 |
218 protected: | 218 protected: |
219 SkXfermode() {} | 219 SkXfermode() {} |
(...skipping 11 matching lines...) Expand all Loading... |
231 | 231 |
232 private: | 232 private: |
233 enum { | 233 enum { |
234 kModeCount = kLastMode + 1 | 234 kModeCount = kLastMode + 1 |
235 }; | 235 }; |
236 | 236 |
237 typedef SkFlattenable INHERITED; | 237 typedef SkFlattenable INHERITED; |
238 }; | 238 }; |
239 | 239 |
240 #endif | 240 #endif |
OLD | NEW |