blob: d44288d15394ed78ad3991fc5ffa863ea77b4b62 [file] [log] [blame]
Mathias Agopian3f844832013-08-07 21:24:32 -07001/*
2 * Copyright 2013 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
17#include <stdint.h>
18#include <string.h>
19
20#include <utils/TypeHelpers.h>
21
22#include <GLES2/gl2.h>
23#include <GLES2/gl2ext.h>
24
25#include "Description.h"
26
27namespace android {
28
Romain Guy88d37dd2017-05-26 17:57:05 -070029Description::Description() {
Mathias Agopian3f844832013-08-07 21:24:32 -070030 mPlaneAlpha = 1.0f;
Mathias Agopianff2ed702013-09-01 21:36:12 -070031 mPremultipliedAlpha = false;
Mathias Agopian3f844832013-08-07 21:24:32 -070032 mOpaque = true;
Mathias Agopian49457ac2013-08-14 18:20:17 -070033 mTextureEnabled = false;
Mathias Agopianff2ed702013-09-01 21:36:12 -070034 mColorMatrixEnabled = false;
Greg Kaiser4ca7a3f2018-01-05 13:44:44 -080035 mIsWideGamut = false;
Mathias Agopian3f844832013-08-07 21:24:32 -070036
Mathias Agopian3f844832013-08-07 21:24:32 -070037 memset(mColor, 0, sizeof(mColor));
Mathias Agopian3f844832013-08-07 21:24:32 -070038}
39
40Description::~Description() {
41}
42
43void Description::setPlaneAlpha(GLclampf planeAlpha) {
Romain Guy88d37dd2017-05-26 17:57:05 -070044 mPlaneAlpha = planeAlpha;
Mathias Agopian3f844832013-08-07 21:24:32 -070045}
46
47void Description::setPremultipliedAlpha(bool premultipliedAlpha) {
Romain Guy88d37dd2017-05-26 17:57:05 -070048 mPremultipliedAlpha = premultipliedAlpha;
Mathias Agopian3f844832013-08-07 21:24:32 -070049}
50
51void Description::setOpaque(bool opaque) {
Romain Guy88d37dd2017-05-26 17:57:05 -070052 mOpaque = opaque;
Mathias Agopian3f844832013-08-07 21:24:32 -070053}
54
Mathias Agopian49457ac2013-08-14 18:20:17 -070055void Description::setTexture(const Texture& texture) {
56 mTexture = texture;
57 mTextureEnabled = true;
Mathias Agopian3f844832013-08-07 21:24:32 -070058}
59
60void Description::disableTexture() {
Mathias Agopian49457ac2013-08-14 18:20:17 -070061 mTextureEnabled = false;
Mathias Agopian3f844832013-08-07 21:24:32 -070062}
63
64void Description::setColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
65 mColor[0] = red;
66 mColor[1] = green;
67 mColor[2] = blue;
68 mColor[3] = alpha;
Mathias Agopian3f844832013-08-07 21:24:32 -070069}
70
Mathias Agopiana8c386f2013-08-26 20:42:07 -070071void Description::setProjectionMatrix(const mat4& mtx) {
72 mProjectionMatrix = mtx;
Mathias Agopian3f844832013-08-07 21:24:32 -070073}
74
Mathias Agopianff2ed702013-09-01 21:36:12 -070075void Description::setColorMatrix(const mat4& mtx) {
76 const mat4 identity;
77 mColorMatrix = mtx;
78 mColorMatrixEnabled = (mtx != identity);
79}
80
Dan Stozaf0087992014-10-20 15:46:09 -070081const mat4& Description::getColorMatrix() const {
82 return mColorMatrix;
83}
84
Romain Guy88d37dd2017-05-26 17:57:05 -070085void Description::setWideGamut(bool wideGamut) {
86 mIsWideGamut = wideGamut;
87}
Mathias Agopianff2ed702013-09-01 21:36:12 -070088
Mathias Agopian3f844832013-08-07 21:24:32 -070089} /* namespace android */