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

Unified 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, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/yuvtorgbeffect.cpp ('k') | include/gpu/GrPaint.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkXfermode.h
diff --git a/include/core/SkXfermode.h b/include/core/SkXfermode.h
index cb9557f92c28dec7dd05ac3d3f8b70ef7e4c74e0..91268ab5f127a5ec37cf8102b4c8dafe27706839 100644
--- a/include/core/SkXfermode.h
+++ b/include/core/SkXfermode.h
@@ -204,18 +204,26 @@ public:
const GrFragmentProcessor* dst) const;
/** A subclass may implement this factory function to work with the GPU backend. It is legal
- to call this with xpf NULL to simply test the return value. If xpf is non-NULL then the
- xfermode may optionally allocate a factory to return to the caller as *xpf. The caller
- will install it and own a ref to it. Since the xfermode may or may not assign *xpf, the
- caller should set *xpf to NULL beforehand. XferProcessors cannot use a background texture.
- */
+ to call this with xpf NULL to simply test the return value. If xpf is non-NULL then the
+ xfermode may optionally allocate a factory to return to the caller as *xpf. The caller
+ will install it and own a ref to it. Since the xfermode may or may not assign *xpf, the
+ caller should set *xpf to NULL beforehand. XferProcessors cannot use a background texture.
+ */
virtual bool asXPFactory(GrXPFactory** xpf) const;
/** Returns true if the xfermode can be expressed as an xfer processor factory (xpFactory).
- This helper calls the asXPFactory() virtual. If the xfermode is NULL, it is treated as
- kSrcOver_Mode. It is legal to call this with xpf param NULL to simply test the return value.
- */
- static bool AsXPFactory(SkXfermode*, GrXPFactory**);
+ This helper calls the asXPFactory() virtual. If the xfermode is NULL, it is treated as
+ kSrcOver_Mode. It is legal to call this with xpf param NULL to simply test the return value.
+ */
+ static inline bool AsXPFactory(SkXfermode* xfermode, GrXPFactory** xpf) {
+ if (nullptr == xfermode) {
+ if (xpf) {
+ *xpf = nullptr;
+ }
+ return true;
+ }
+ return xfermode->asXPFactory(xpf);
+ }
SK_TO_STRING_PUREVIRT()
SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
« 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