wangyix | cef14bf | 2015-07-24 13:48:26 -0700 | [diff] [blame] | 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 GrGLBlend_DEFINED |
| 9 | #define GrGLBlend_DEFINED |
| 10 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "include/core/SkBlendMode.h" |
wangyix | cef14bf | 2015-07-24 13:48:26 -0700 | [diff] [blame] | 12 | |
Brian Salomon | ffd15ea | 2020-07-01 16:48:20 -0400 | [diff] [blame] | 13 | class GrGLSLShaderBuilder; |
wangyix | cef14bf | 2015-07-24 13:48:26 -0700 | [diff] [blame] | 14 | |
bsalomon | ae4738f | 2015-09-15 15:33:27 -0700 | [diff] [blame] | 15 | namespace GrGLSLBlend { |
Brian Salomon | 87e9ddb | 2019-12-19 14:50:22 -0500 | [diff] [blame] | 16 | /* |
| 17 | * Returns the name of the built in blend function for a SkBlendMode. |
| 18 | * When and if the SkSL compiler supports inlining it'd be simpler to just call |
| 19 | * blend(mode, src, dst) where mode is a literal when the desired blend mode is |
| 20 | * not variable. |
| 21 | */ |
| 22 | const char* BlendFuncName(SkBlendMode mode); |
| 23 | |
| 24 | /* |
| 25 | * Appends GLSL code to fsBuilder that assigns a specified blend of the srcColor and dstColor |
| 26 | * variables to the outColor variable. |
| 27 | */ |
Brian Salomon | ffd15ea | 2020-07-01 16:48:20 -0400 | [diff] [blame] | 28 | void AppendMode(GrGLSLShaderBuilder* fsBuilder, |
Brian Salomon | 87e9ddb | 2019-12-19 14:50:22 -0500 | [diff] [blame] | 29 | const char* srcColor, |
| 30 | const char* dstColor, |
| 31 | const char* outColor, |
| 32 | SkBlendMode mode); |
John Stiles | a6841be | 2020-08-06 14:11:56 -0400 | [diff] [blame^] | 33 | } // namespace GrGLSLBlend |
wangyix | cef14bf | 2015-07-24 13:48:26 -0700 | [diff] [blame] | 34 | |
| 35 | #endif |