1 /* 2 * Copyright 2015 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef GrXfermodeFragmentProcessor_DEFINED 9 #define GrXfermodeFragmentProcessor_DEFINED 10 11 #include "SkXfermode.h" 12 13 class GrFragmentProcessor; 14 15 namespace GrXfermodeFragmentProcessor { 16 /** The color input to the returned processor is treated as the src and the passed in processor 17 is the dst. */ 18 const GrFragmentProcessor* CreateFromDstProcessor(const GrFragmentProcessor* dst, 19 SkXfermode::Mode mode); 20 21 /** The color input to the returned processor is treated as the dst and the passed in processor 22 is the src. */ 23 const GrFragmentProcessor* CreateFromSrcProcessor(const GrFragmentProcessor* src, 24 SkXfermode::Mode mode); 25 26 /** Takes the input color, which is assumed to be unpremultiplied, passes it as an opaque color 27 to both src and dst. The outputs of a src and dst are blended using mode and the original 28 input's alpha is applied to the blended color to produce a premul output. */ 29 const GrFragmentProcessor* CreateFromTwoProcessors(const GrFragmentProcessor* src, 30 const GrFragmentProcessor* dst, 31 SkXfermode::Mode mode); 32 }; 33 34 #endif 35