Mathias Agopian | 3f84483 | 2013-08-07 21:24:32 -0700 | [diff] [blame] | 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 | |
Peiyong Lin | cbc184f | 2018-08-22 13:24:10 -0700 | [diff] [blame] | 17 | #include <renderengine/Description.h> |
| 18 | |
Mathias Agopian | 3f84483 | 2013-08-07 21:24:32 -0700 | [diff] [blame] | 19 | #include <stdint.h> |
| 20 | #include <string.h> |
| 21 | |
| 22 | #include <utils/TypeHelpers.h> |
| 23 | |
Mathias Agopian | 3f84483 | 2013-08-07 21:24:32 -0700 | [diff] [blame] | 24 | namespace android { |
| 25 | |
Mathias Agopian | 3f84483 | 2013-08-07 21:24:32 -0700 | [diff] [blame] | 26 | void Description::setPremultipliedAlpha(bool premultipliedAlpha) { |
Romain Guy | 88d37dd | 2017-05-26 17:57:05 -0700 | [diff] [blame] | 27 | mPremultipliedAlpha = premultipliedAlpha; |
Mathias Agopian | 3f84483 | 2013-08-07 21:24:32 -0700 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | void Description::setOpaque(bool opaque) { |
Romain Guy | 88d37dd | 2017-05-26 17:57:05 -0700 | [diff] [blame] | 31 | mOpaque = opaque; |
Mathias Agopian | 3f84483 | 2013-08-07 21:24:32 -0700 | [diff] [blame] | 32 | } |
| 33 | |
Mathias Agopian | 49457ac | 2013-08-14 18:20:17 -0700 | [diff] [blame] | 34 | void Description::setTexture(const Texture& texture) { |
| 35 | mTexture = texture; |
| 36 | mTextureEnabled = true; |
Mathias Agopian | 3f84483 | 2013-08-07 21:24:32 -0700 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | void Description::disableTexture() { |
Mathias Agopian | 49457ac | 2013-08-14 18:20:17 -0700 | [diff] [blame] | 40 | mTextureEnabled = false; |
Mathias Agopian | 3f84483 | 2013-08-07 21:24:32 -0700 | [diff] [blame] | 41 | } |
| 42 | |
chaviw | 13fdc49 | 2017-06-27 12:40:18 -0700 | [diff] [blame] | 43 | void Description::setColor(const half4& color) { |
| 44 | mColor = color; |
Mathias Agopian | 3f84483 | 2013-08-07 21:24:32 -0700 | [diff] [blame] | 45 | } |
| 46 | |
Mathias Agopian | a8c386f | 2013-08-26 20:42:07 -0700 | [diff] [blame] | 47 | void Description::setProjectionMatrix(const mat4& mtx) { |
| 48 | mProjectionMatrix = mtx; |
Mathias Agopian | 3f84483 | 2013-08-07 21:24:32 -0700 | [diff] [blame] | 49 | } |
| 50 | |
Mathias Agopian | ff2ed70 | 2013-09-01 21:36:12 -0700 | [diff] [blame] | 51 | void Description::setColorMatrix(const mat4& mtx) { |
Mathias Agopian | ff2ed70 | 2013-09-01 21:36:12 -0700 | [diff] [blame] | 52 | mColorMatrix = mtx; |
Peiyong Lin | a296b0c | 2018-04-30 16:55:29 -0700 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | void Description::setInputTransformMatrix(const mat3& matrix) { |
| 56 | mInputTransformMatrix = matrix; |
| 57 | } |
| 58 | |
| 59 | void Description::setOutputTransformMatrix(const mat4& matrix) { |
| 60 | mOutputTransformMatrix = matrix; |
| 61 | } |
| 62 | |
| 63 | bool Description::hasInputTransformMatrix() const { |
| 64 | const mat3 identity; |
| 65 | return mInputTransformMatrix != identity; |
| 66 | } |
| 67 | |
| 68 | bool Description::hasOutputTransformMatrix() const { |
| 69 | const mat4 identity; |
| 70 | return mOutputTransformMatrix != identity; |
| 71 | } |
| 72 | |
| 73 | bool Description::hasColorMatrix() const { |
| 74 | const mat4 identity; |
| 75 | return mColorMatrix != identity; |
Mathias Agopian | ff2ed70 | 2013-09-01 21:36:12 -0700 | [diff] [blame] | 76 | } |
| 77 | |
Dan Stoza | f008799 | 2014-10-20 15:46:09 -0700 | [diff] [blame] | 78 | const mat4& Description::getColorMatrix() const { |
| 79 | return mColorMatrix; |
| 80 | } |
| 81 | |
Chia-I Wu | 131d376 | 2018-01-11 14:35:27 -0800 | [diff] [blame] | 82 | void Description::setY410BT2020(bool enable) { |
| 83 | mY410BT2020 = enable; |
| 84 | } |
| 85 | |
Chia-I Wu | 7e65bc0 | 2018-01-11 14:31:38 -0800 | [diff] [blame] | 86 | void Description::setInputTransferFunction(TransferFunction transferFunction) { |
| 87 | mInputTransferFunction = transferFunction; |
| 88 | } |
| 89 | |
| 90 | void Description::setOutputTransferFunction(TransferFunction transferFunction) { |
| 91 | mOutputTransferFunction = transferFunction; |
Romain Guy | 88d37dd | 2017-05-26 17:57:05 -0700 | [diff] [blame] | 92 | } |
Mathias Agopian | ff2ed70 | 2013-09-01 21:36:12 -0700 | [diff] [blame] | 93 | |
Peiyong Lin | fb06930 | 2018-04-25 14:34:31 -0700 | [diff] [blame] | 94 | void Description::setDisplayMaxLuminance(const float maxLuminance) { |
| 95 | mDisplayMaxLuminance = maxLuminance; |
| 96 | } |
| 97 | |
Mathias Agopian | 3f84483 | 2013-08-07 21:24:32 -0700 | [diff] [blame] | 98 | } /* namespace android */ |