blob: 31d7dde23ba156318cfed3d3fabdf59775d89e53 [file] [log] [blame]
Chris Craik44eb2c02015-01-29 09:45:09 -08001/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef RENDERSTATE_BLEND_H
17#define RENDERSTATE_BLEND_H
18
19#include "Vertex.h"
20
21#include <GLES2/gl2.h>
22#include <GLES2/gl2ext.h>
23#include <SkXfermode.h>
24#include <memory>
25
26namespace android {
27namespace uirenderer {
28
29class Blend {
30 friend class RenderState;
31public:
32 void enable(SkXfermode::Mode mode, bool swapSrcDst);
33 void disable();
34 void syncEnabled();
Chris Craik03188872015-02-02 18:39:33 -080035
36 static void getFactors(SkXfermode::Mode mode, bool swapSrcDst, GLenum* outSrc, GLenum* outDst);
37 void setFactors(GLenum src, GLenum dst);
Chris Craik44eb2c02015-01-29 09:45:09 -080038private:
39 Blend();
40 void invalidate();
41 bool mEnabled;
42 GLenum mSrcMode;
43 GLenum mDstMode;
44};
45
46} /* namespace uirenderer */
47} /* namespace android */
48
49#endif // RENDERSTATE_BLEND_H