blob: e0144063f32d48d382ce4b392b78396dbfab8609 [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 Agopianff2ed702013-09-01 21:36:12 -070030 mPremultipliedAlpha = false;
Mathias Agopian3f844832013-08-07 21:24:32 -070031 mOpaque = true;
Mathias Agopian49457ac2013-08-14 18:20:17 -070032 mTextureEnabled = false;
Mathias Agopianff2ed702013-09-01 21:36:12 -070033 mColorMatrixEnabled = false;
Mathias Agopian3f844832013-08-07 21:24:32 -070034}
35
Chia-I Wub027f802017-11-29 14:00:52 -080036Description::~Description() {}
Mathias Agopian3f844832013-08-07 21:24:32 -070037
Mathias Agopian3f844832013-08-07 21:24:32 -070038void Description::setPremultipliedAlpha(bool premultipliedAlpha) {
Romain Guy88d37dd2017-05-26 17:57:05 -070039 mPremultipliedAlpha = premultipliedAlpha;
Mathias Agopian3f844832013-08-07 21:24:32 -070040}
41
42void Description::setOpaque(bool opaque) {
Romain Guy88d37dd2017-05-26 17:57:05 -070043 mOpaque = opaque;
Mathias Agopian3f844832013-08-07 21:24:32 -070044}
45
Mathias Agopian49457ac2013-08-14 18:20:17 -070046void Description::setTexture(const Texture& texture) {
47 mTexture = texture;
48 mTextureEnabled = true;
Mathias Agopian3f844832013-08-07 21:24:32 -070049}
50
51void Description::disableTexture() {
Mathias Agopian49457ac2013-08-14 18:20:17 -070052 mTextureEnabled = false;
Mathias Agopian3f844832013-08-07 21:24:32 -070053}
54
chaviw13fdc492017-06-27 12:40:18 -070055void Description::setColor(const half4& color) {
56 mColor = color;
Mathias Agopian3f844832013-08-07 21:24:32 -070057}
58
Mathias Agopiana8c386f2013-08-26 20:42:07 -070059void Description::setProjectionMatrix(const mat4& mtx) {
60 mProjectionMatrix = mtx;
Mathias Agopian3f844832013-08-07 21:24:32 -070061}
62
Mathias Agopianff2ed702013-09-01 21:36:12 -070063void Description::setColorMatrix(const mat4& mtx) {
64 const mat4 identity;
65 mColorMatrix = mtx;
66 mColorMatrixEnabled = (mtx != identity);
67}
68
Dan Stozaf0087992014-10-20 15:46:09 -070069const mat4& Description::getColorMatrix() const {
70 return mColorMatrix;
71}
72
Romain Guy88d37dd2017-05-26 17:57:05 -070073void Description::setWideGamut(bool wideGamut) {
74 mIsWideGamut = wideGamut;
75}
Mathias Agopianff2ed702013-09-01 21:36:12 -070076
Mathias Agopian3f844832013-08-07 21:24:32 -070077} /* namespace android */