blob: effd3191c82a56a28f2ec454a2a95361c5d1ec48 [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;
Mathias Agopian3f844832013-08-07 21:24:32 -070035
Mathias Agopian3f844832013-08-07 21:24:32 -070036 memset(mColor, 0, sizeof(mColor));
Mathias Agopian3f844832013-08-07 21:24:32 -070037}
38
39Description::~Description() {
40}
41
42void Description::setPlaneAlpha(GLclampf planeAlpha) {
Romain Guy88d37dd2017-05-26 17:57:05 -070043 mPlaneAlpha = planeAlpha;
Mathias Agopian3f844832013-08-07 21:24:32 -070044}
45
46void Description::setPremultipliedAlpha(bool premultipliedAlpha) {
Romain Guy88d37dd2017-05-26 17:57:05 -070047 mPremultipliedAlpha = premultipliedAlpha;
Mathias Agopian3f844832013-08-07 21:24:32 -070048}
49
50void Description::setOpaque(bool opaque) {
Romain Guy88d37dd2017-05-26 17:57:05 -070051 mOpaque = opaque;
Mathias Agopian3f844832013-08-07 21:24:32 -070052}
53
Mathias Agopian49457ac2013-08-14 18:20:17 -070054void Description::setTexture(const Texture& texture) {
55 mTexture = texture;
56 mTextureEnabled = true;
Mathias Agopian3f844832013-08-07 21:24:32 -070057}
58
59void Description::disableTexture() {
Mathias Agopian49457ac2013-08-14 18:20:17 -070060 mTextureEnabled = false;
Mathias Agopian3f844832013-08-07 21:24:32 -070061}
62
63void Description::setColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
64 mColor[0] = red;
65 mColor[1] = green;
66 mColor[2] = blue;
67 mColor[3] = alpha;
Mathias Agopian3f844832013-08-07 21:24:32 -070068}
69
Mathias Agopiana8c386f2013-08-26 20:42:07 -070070void Description::setProjectionMatrix(const mat4& mtx) {
71 mProjectionMatrix = mtx;
Mathias Agopian3f844832013-08-07 21:24:32 -070072}
73
Mathias Agopianff2ed702013-09-01 21:36:12 -070074void Description::setColorMatrix(const mat4& mtx) {
75 const mat4 identity;
76 mColorMatrix = mtx;
77 mColorMatrixEnabled = (mtx != identity);
78}
79
Dan Stozaf0087992014-10-20 15:46:09 -070080const mat4& Description::getColorMatrix() const {
81 return mColorMatrix;
82}
83
Romain Guy88d37dd2017-05-26 17:57:05 -070084void Description::setWideGamut(bool wideGamut) {
85 mIsWideGamut = wideGamut;
86}
Mathias Agopianff2ed702013-09-01 21:36:12 -070087
Mathias Agopian3f844832013-08-07 21:24:32 -070088} /* namespace android */