Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(356)

Side by Side Diff: include/core/SkXfermode.h

Issue 853543003: Do some minor pre cleanup work before converting all xfermodes to XPs. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Review updates Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/core/SkXfermode.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 * not representable as a pair of Coeffs, return false and ignore the 183 * not representable as a pair of Coeffs, return false and ignore the
184 * src and dst parameters. 184 * src and dst parameters.
185 */ 185 */
186 static bool ModeAsCoeff(Mode mode, Coeff* src, Coeff* dst); 186 static bool ModeAsCoeff(Mode mode, Coeff* src, Coeff* dst);
187 187
188 SK_ATTR_DEPRECATED("use AsMode(...)") 188 SK_ATTR_DEPRECATED("use AsMode(...)")
189 static bool IsMode(const SkXfermode* xfer, Mode* mode) { 189 static bool IsMode(const SkXfermode* xfer, Mode* mode) {
190 return AsMode(xfer, mode); 190 return AsMode(xfer, mode);
191 } 191 }
192 192
193 /** A subclass may implement this factory function to work with the GPU back end. It is legal 193 /** Implemented by a subclass to support use as an image filter in the GPU b ackend. When used as
194 to call this with all params NULL to simply test the return value. If ef fect is non-NULL 194 an image filter the xfer mode blends the source color against a backgrou nd texture rather
195 then the xfermode may optionally allocate an effect to return and the ca ller as *effect. 195 than the destination. It is implemented as a fragment processor. This ca n be called with
196 The caller will install it and own a ref to it. Since the xfermode may o r may not assign 196 both params set to NULL to query whether it would succeed. Otherwise, bo th params are
197 *effect, the caller should set *effect to NULL beforehand. background sp ecifies the 197 required. Upon success the function returns true and the caller owns a r ef to the fragment
198 texture to use as the background for compositing, and should be accessed in the effect's 198 parameter. Upon failure false is returned and the processor param is not written to.
199 fragment shader. If NULL, the effect should request access to destinatio n color
200 (setWillReadDstColor()), and use that in the fragment shader (builder->d stColor()).
201 */ 199 */
202 // TODO: Once all custom xp's have been created the background parameter wil l be required here. 200 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture* backgroun d) const;
203 // We will always use the XPFactory if there is no background texture and the fragment if
204 // there is one.
205 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture* backgroun d = NULL) const;
206 201
207 /** A subclass may implement this factory function to work with the GPU back end. It is legal 202 /** A subclass may implement this factory function to work with the GPU back end. It is legal
208 to call this with xpf NULL to simply test the return value. If xpf is no n-NULL then the 203 to call this with xpf NULL to simply test the return value. If xpf is no n-NULL then the
209 xfermode may optionally allocate a factory to return to the caller as *x pf. The caller 204 xfermode may optionally allocate a factory to return to the caller as *x pf. The caller
210 will install it and own a ref to it. Since the xfermode may or may not a ssign *xpf, the 205 will install it and own a ref to it. Since the xfermode may or may not a ssign *xpf, the
211 caller should set *xpf to NULL beforehand. XP's cannot use a background texture since they 206 caller should set *xpf to NULL beforehand. XferProcessors cannot use a b ackground texture.
212 have no coord transforms.
213 */ 207 */
214 virtual bool asXPFactory(GrXPFactory** xpf) const; 208 virtual bool asXPFactory(GrXPFactory** xpf) const;
215 209
216 /** Returns true if the xfermode can be expressed as an xfer processor facto ry (xpFactory), 210 /** Returns true if the xfermode can be expressed as an xfer processor facto ry (xpFactory),
217 or a fragment processor. This helper calls the asCoeff(), asXPFactory(), 211 or a fragment processor. This helper calls the asCoeff(), asXPFactory(),
218 and asFragmentProcessor() virtuals. If the xfermode is NULL, it is treat ed as kSrcOver_Mode. 212 and asFragmentProcessor() virtuals. If the xfermode is NULL, it is treat ed as kSrcOver_Mode.
219 It is legal to call this with all params NULL to simply test the return value. 213 It is legal to call this with all params NULL to simply test the return value.
220 fp and xpf must both be NULL or all non-NULL. 214 fp and xpf must both be NULL or all non-NULL.
221 */ 215 */
222 static bool AsFragmentProcessorOrXPFactory(SkXfermode*, GrFragmentProcessor* *, 216 static bool AsFragmentProcessorOrXPFactory(SkXfermode*, GrFragmentProcessor* *,
(...skipping 17 matching lines...) Expand all
240 234
241 private: 235 private:
242 enum { 236 enum {
243 kModeCount = kLastMode + 1 237 kModeCount = kLastMode + 1
244 }; 238 };
245 239
246 typedef SkFlattenable INHERITED; 240 typedef SkFlattenable INHERITED;
247 }; 241 };
248 242
249 #endif 243 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkXfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698