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
11#include "include/core/SkBlendMode.h"
12
13class GrGLSLShaderBuilder;
14
15namespace GrGLSLBlend {
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 */
22const 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 */
28void AppendMode(GrGLSLShaderBuilder* fsBuilder,
29 const char* srcColor,
30 const char* dstColor,
31 const char* outColor,
32 SkBlendMode mode);
33} // namespace GrGLSLBlend
34
35#endif
36