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

Unified Diff: include/core/SkXfermode.h

Issue 1674673002: Alter SkXfermode's asFragmentProcessor & asXPFactory contracts (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix unit test bug Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/client/android/SkPixelXorXfermode.h ('k') | include/effects/SkXfermodeImageFilter.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 f2d8d578659bc8838420913e34d96c4e94c82e75..11d39cabf797b0417a223141e7d71f3610cc4fc0 100644
--- a/include/core/SkXfermode.h
+++ b/include/core/SkXfermode.h
@@ -193,37 +193,22 @@ public:
*/
static bool IsOpaque(const SkXfermode* xfer, SrcColorOpacity opacityType);
- /** Used to do in-shader blending between two colors computed in the shader via a
- GrFragmentProcessor. The input to the returned FP is the src color. The dst color is
- provided by the dst param which becomes a child FP of the returned FP. If the params are
- null then this is just a query of whether the SkXfermode could support this functionality.
- It is legal for the function to succeed but return a null output. This indicates that
+#if SK_SUPPORT_GPU
+ /** Used by the SkXfermodeImageFilter to blend two colors via a GrFragmentProcessor.
+ The input to the returned FP is the src color. The dst color is
+ provided by the dst param which becomes a child FP of the returned FP.
+ It is legal for the function to return a null output. This indicates that
the output of the blend is simply the src color.
*/
- virtual bool asFragmentProcessor(const GrFragmentProcessor** output,
- 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.
- */
- virtual bool asXPFactory(GrXPFactory** xpf) const;
+ virtual const GrFragmentProcessor* getFragmentProcessorForImageFilter(
+ const GrFragmentProcessor* dst) 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.
+ /** A subclass must implement this factory function to work with the GPU backend.
+ The xfermode will return a factory for which the caller will get a ref. It is up
+ to the caller to install it. XferProcessors cannot use a background texture.
*/
- static inline bool AsXPFactory(SkXfermode* xfermode, GrXPFactory** xpf) {
- if (nullptr == xfermode) {
- if (xpf) {
- *xpf = nullptr;
- }
- return true;
- }
- return xfermode->asXPFactory(xpf);
- }
+ virtual GrXPFactory* asXPFactory() const;
+#endif
SK_TO_STRING_PUREVIRT()
SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
« no previous file with comments | « include/client/android/SkPixelXorXfermode.h ('k') | include/effects/SkXfermodeImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698