• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
27 namespace android {
28 
Description()29 Description::Description() {
30     mPlaneAlpha = 1.0f;
31     mPremultipliedAlpha = false;
32     mOpaque = true;
33     mTextureEnabled = false;
34     mColorMatrixEnabled = false;
35 
36     memset(mColor, 0, sizeof(mColor));
37 }
38 
~Description()39 Description::~Description() {
40 }
41 
setPlaneAlpha(GLclampf planeAlpha)42 void Description::setPlaneAlpha(GLclampf planeAlpha) {
43     mPlaneAlpha = planeAlpha;
44 }
45 
setPremultipliedAlpha(bool premultipliedAlpha)46 void Description::setPremultipliedAlpha(bool premultipliedAlpha) {
47     mPremultipliedAlpha = premultipliedAlpha;
48 }
49 
setOpaque(bool opaque)50 void Description::setOpaque(bool opaque) {
51     mOpaque = opaque;
52 }
53 
setTexture(const Texture & texture)54 void Description::setTexture(const Texture& texture) {
55     mTexture = texture;
56     mTextureEnabled = true;
57 }
58 
disableTexture()59 void Description::disableTexture() {
60     mTextureEnabled = false;
61 }
62 
setColor(GLclampf red,GLclampf green,GLclampf blue,GLclampf alpha)63 void 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;
68 }
69 
setProjectionMatrix(const mat4 & mtx)70 void Description::setProjectionMatrix(const mat4& mtx) {
71     mProjectionMatrix = mtx;
72 }
73 
setColorMatrix(const mat4 & mtx)74 void Description::setColorMatrix(const mat4& mtx) {
75     const mat4 identity;
76     mColorMatrix = mtx;
77     mColorMatrixEnabled = (mtx != identity);
78 }
79 
getColorMatrix() const80 const mat4& Description::getColorMatrix() const {
81     return mColorMatrix;
82 }
83 
setWideGamut(bool wideGamut)84 void Description::setWideGamut(bool wideGamut) {
85     mIsWideGamut = wideGamut;
86 }
87 
88 } /* namespace android */
89