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 GrProcessorDataManager; |
18 class GrTexture; | 18 class GrTexture; |
19 class GrXPFactory; | 19 class GrXPFactory; |
20 class SkString; | 20 class SkString; |
21 | 21 |
22 /** \class SkXfermode | 22 /** \class SkXfermode |
23 * | 23 * |
24 * 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 |
25 * "transfer-modes" in the drawing pipeline. The static function Create(Modes) | 25 * "transfer-modes" in the drawing pipeline. The static function Create(Modes) |
26 * 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 |
27 * 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... |
201 */ | 201 */ |
202 static bool IsOpaque(const SkXfermode* xfer, SrcColorOpacity opacityType); | 202 static bool IsOpaque(const SkXfermode* xfer, SrcColorOpacity opacityType); |
203 | 203 |
204 /** 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 |
205 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 |
206 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 |
207 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 |
208 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 |
209 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. |
210 */ | 210 */ |
211 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrShaderDataManager*
, | 211 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrProcessorDataManag
er*, |
212 GrTexture* background) const; | 212 GrTexture* background) const; |
213 | 213 |
214 /** 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 |
215 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 |
216 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 |
217 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 |
218 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. |
219 */ | 219 */ |
220 virtual bool asXPFactory(GrXPFactory** xpf) const; | 220 virtual bool asXPFactory(GrXPFactory** xpf) const; |
221 | 221 |
(...skipping 21 matching lines...) Expand all Loading... |
243 | 243 |
244 private: | 244 private: |
245 enum { | 245 enum { |
246 kModeCount = kLastMode + 1 | 246 kModeCount = kLastMode + 1 |
247 }; | 247 }; |
248 | 248 |
249 typedef SkFlattenable INHERITED; | 249 typedef SkFlattenable INHERITED; |
250 }; | 250 }; |
251 | 251 |
252 #endif | 252 #endif |
OLD | NEW |