Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrGLSLBlend.h
Go to the documentation of this file.
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
12
13#include <string>
14
16class GrProcessor;
17enum class SkBlendMode;
18
19namespace GrGLSLBlend {
20
21/**
22 * Returns an SkSL expression that blends the passed-in srcColor and dstColor values.
23 * Matching calls to SetBlendModeUniformData and BlendKey must be made from your GrProcessor.
24 */
25std::string BlendExpression(const GrProcessor* processor,
26 GrGLSLUniformHandler* uniformHandler,
27 GrGLSLProgramDataManager::UniformHandle* uniform,
28 const char* srcColor,
29 const char* dstColor,
30 SkBlendMode mode);
31
32/**
33 * Returns a key, for use in onAddToKey from any GrProcessor. You must pass the same blend mode that
34 * was passed to BlendExpression
35 */
36int BlendKey(SkBlendMode mode);
37
38/**
39 * Sets up uniforms, for use in onSetData from any GrProcessor. You must pass the same uniform and
40 * blend mode that were passed to BlendExpression.
41 */
43 GrGLSLProgramDataManager::UniformHandle uniform,
44 SkBlendMode mode);
45
46} // namespace GrGLSLBlend
47
48#endif
SkBlendMode
Definition SkBlendMode.h:38
std::string BlendExpression(const GrProcessor *processor, GrGLSLUniformHandler *uniformHandler, GrGLSLProgramDataManager::UniformHandle *blendUniform, const char *srcColor, const char *dstColor, SkBlendMode mode)
int BlendKey(SkBlendMode mode)
void SetBlendModeUniformData(const GrGLSLProgramDataManager &pdman, GrGLSLProgramDataManager::UniformHandle blendUniform, SkBlendMode mode)