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 GrFragmentProcessor; | 16 class GrFragmentProcessor; |
| 17 class GrShaderDataManager; |
17 class GrTexture; | 18 class GrTexture; |
18 class GrXPFactory; | 19 class GrXPFactory; |
19 class SkString; | 20 class SkString; |
20 | 21 |
21 /** \class SkXfermode | 22 /** \class SkXfermode |
22 * | 23 * |
23 * SkXfermode is the base class for objects that are called to implement custom | 24 * 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) | 25 * "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 | 26 * 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, | 27 * specified in the Modes enum. When an SkXfermode is assigned to an SkPaint, |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 */ | 201 */ |
201 static bool IsOpaque(const SkXfermode* xfer, SrcColorOpacity opacityType); | 202 static bool IsOpaque(const SkXfermode* xfer, SrcColorOpacity opacityType); |
202 | 203 |
203 /** Implemented by a subclass to support use as an image filter in the GPU b
ackend. When used as | 204 /** Implemented by a subclass to support use as an image filter in the GPU b
ackend. When used as |
204 an image filter the xfer mode blends the source color against a backgrou
nd texture rather | 205 an image filter the xfer mode blends the source color against a backgrou
nd texture rather |
205 than the destination. It is implemented as a fragment processor. This ca
n be called with | 206 than the destination. It is implemented as a fragment processor. This ca
n be called with |
206 both params set to NULL to query whether it would succeed. Otherwise, bo
th params are | 207 both params set to NULL to query whether it would succeed. Otherwise, bo
th params are |
207 required. Upon success the function returns true and the caller owns a r
ef to the fragment | 208 required. Upon success the function returns true and the caller owns a r
ef to the fragment |
208 parameter. Upon failure false is returned and the processor param is not
written to. | 209 parameter. Upon failure false is returned and the processor param is not
written to. |
209 */ | 210 */ |
210 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture* backgroun
d) const; | 211 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrShaderDataManager*
, |
| 212 GrTexture* background) const; |
211 | 213 |
212 /** A subclass may implement this factory function to work with the GPU back
end. It is legal | 214 /** A subclass may implement this factory function to work with the GPU back
end. It is legal |
213 to call this with xpf NULL to simply test the return value. If xpf is no
n-NULL then the | 215 to call this with xpf NULL to simply test the return value. If xpf is no
n-NULL then the |
214 xfermode may optionally allocate a factory to return to the caller as *x
pf. The caller | 216 xfermode may optionally allocate a factory to return to the caller as *x
pf. The caller |
215 will install it and own a ref to it. Since the xfermode may or may not a
ssign *xpf, the | 217 will install it and own a ref to it. Since the xfermode may or may not a
ssign *xpf, the |
216 caller should set *xpf to NULL beforehand. XferProcessors cannot use a b
ackground texture. | 218 caller should set *xpf to NULL beforehand. XferProcessors cannot use a b
ackground texture. |
217 */ | 219 */ |
218 virtual bool asXPFactory(GrXPFactory** xpf) const; | 220 virtual bool asXPFactory(GrXPFactory** xpf) const; |
219 | 221 |
220 /** Returns true if the xfermode can be expressed as an xfer processor facto
ry (xpFactory). | 222 /** Returns true if the xfermode can be expressed as an xfer processor facto
ry (xpFactory). |
(...skipping 20 matching lines...) Expand all Loading... |
241 | 243 |
242 private: | 244 private: |
243 enum { | 245 enum { |
244 kModeCount = kLastMode + 1 | 246 kModeCount = kLastMode + 1 |
245 }; | 247 }; |
246 | 248 |
247 typedef SkFlattenable INHERITED; | 249 typedef SkFlattenable INHERITED; |
248 }; | 250 }; |
249 | 251 |
250 #endif | 252 #endif |
OLD | NEW |