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

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

Issue 1471053002: Don't create a GXPFactory when blend is SrcOver (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix compile Created 5 years 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 | « gm/yuvtorgbeffect.cpp ('k') | include/gpu/GrPaint.h » ('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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 GrFragmentProcessor. The input to the returned FP is the src color. The dst color is 197 GrFragmentProcessor. The input to the returned FP is the src color. The dst color is
198 provided by the dst param which becomes a child FP of the returned FP. I f the params are 198 provided by the dst param which becomes a child FP of the returned FP. I f the params are
199 null then this is just a query of whether the SkXfermode could support t his functionality. 199 null then this is just a query of whether the SkXfermode could support t his functionality.
200 It is legal for the function to succeed but return a null output. This i ndicates that 200 It is legal for the function to succeed but return a null output. This i ndicates that
201 the output of the blend is simply the src color. 201 the output of the blend is simply the src color.
202 */ 202 */
203 virtual bool asFragmentProcessor(const GrFragmentProcessor** output, 203 virtual bool asFragmentProcessor(const GrFragmentProcessor** output,
204 const GrFragmentProcessor* dst) const; 204 const GrFragmentProcessor* dst) const;
205 205
206 /** A subclass may implement this factory function to work with the GPU back end. It is legal 206 /** A subclass may implement this factory function to work with the GPU back end. It is legal
207 to call this with xpf NULL to simply test the return value. If xpf is no n-NULL then the 207 to call this with xpf NULL to simply test the return value. If xpf is non- NULL then the
208 xfermode may optionally allocate a factory to return to the caller as *x pf. The caller 208 xfermode may optionally allocate a factory to return to the caller as *xpf . The caller
209 will install it and own a ref to it. Since the xfermode may or may not a ssign *xpf, the 209 will install it and own a ref to it. Since the xfermode may or may not ass ign *xpf, the
210 caller should set *xpf to NULL beforehand. XferProcessors cannot use a b ackground texture. 210 caller should set *xpf to NULL beforehand. XferProcessors cannot use a bac kground texture.
211 */ 211 */
212 virtual bool asXPFactory(GrXPFactory** xpf) const; 212 virtual bool asXPFactory(GrXPFactory** xpf) const;
213 213
214 /** Returns true if the xfermode can be expressed as an xfer processor facto ry (xpFactory). 214 /** Returns true if the xfermode can be expressed as an xfer processor facto ry (xpFactory).
215 This helper calls the asXPFactory() virtual. If the xfermode is NULL, it is treated as 215 This helper calls the asXPFactory() virtual. If the xfermode is NULL, it i s treated as
216 kSrcOver_Mode. It is legal to call this with xpf param NULL to simply te st the return value. 216 kSrcOver_Mode. It is legal to call this with xpf param NULL to simply test the return value.
217 */ 217 */
218 static bool AsXPFactory(SkXfermode*, GrXPFactory**); 218 static inline bool AsXPFactory(SkXfermode* xfermode, GrXPFactory** xpf) {
219 if (nullptr == xfermode) {
220 if (xpf) {
221 *xpf = nullptr;
222 }
223 return true;
224 }
225 return xfermode->asXPFactory(xpf);
226 }
219 227
220 SK_TO_STRING_PUREVIRT() 228 SK_TO_STRING_PUREVIRT()
221 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() 229 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
222 SK_DEFINE_FLATTENABLE_TYPE(SkXfermode) 230 SK_DEFINE_FLATTENABLE_TYPE(SkXfermode)
223 231
224 protected: 232 protected:
225 SkXfermode() {} 233 SkXfermode() {}
226 /** The default implementation of xfer32/xfer16/xferA8 in turn call this 234 /** The default implementation of xfer32/xfer16/xferA8 in turn call this
227 method, 1 color at a time (upscaled to a SkPMColor). The default 235 method, 1 color at a time (upscaled to a SkPMColor). The default
228 implementation of this method just returns dst. If performance is 236 implementation of this method just returns dst. If performance is
229 important, your subclass should override xfer32/xfer16/xferA8 directly. 237 important, your subclass should override xfer32/xfer16/xferA8 directly.
230 238
231 This method will not be called directly by the client, so it need not 239 This method will not be called directly by the client, so it need not
232 be implemented if your subclass has overridden xfer32/xfer16/xferA8 240 be implemented if your subclass has overridden xfer32/xfer16/xferA8
233 */ 241 */
234 virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst) const; 242 virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst) const;
235 243
236 private: 244 private:
237 enum { 245 enum {
238 kModeCount = kLastMode + 1 246 kModeCount = kLastMode + 1
239 }; 247 };
240 248
241 typedef SkFlattenable INHERITED; 249 typedef SkFlattenable INHERITED;
242 }; 250 };
243 251
244 #endif 252 #endif
OLDNEW
« no previous file with comments | « gm/yuvtorgbeffect.cpp ('k') | include/gpu/GrPaint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698