blob: b9cea1071f29679b6ee174ef6f5f138f2d8ed24d [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
Peiyong Lin833074a2018-08-28 11:53:54 -070017#include <renderengine/private/Description.h>
Peiyong Lincbc184f2018-08-22 13:24:10 -070018
Mathias Agopian3f844832013-08-07 21:24:32 -070019#include <stdint.h>
Mathias Agopian3f844832013-08-07 21:24:32 -070020
21#include <utils/TypeHelpers.h>
22
Mathias Agopian3f844832013-08-07 21:24:32 -070023namespace android {
Peiyong Lin833074a2018-08-28 11:53:54 -070024namespace renderengine {
Mathias Agopian3f844832013-08-07 21:24:32 -070025
Peiyong Lin70b26ce2018-09-18 19:02:39 -070026Description::TransferFunction Description::dataSpaceToTransferFunction(ui::Dataspace dataSpace) {
27 ui::Dataspace transfer = static_cast<ui::Dataspace>(dataSpace & ui::Dataspace::TRANSFER_MASK);
28 switch (transfer) {
29 case ui::Dataspace::TRANSFER_ST2084:
30 return Description::TransferFunction::ST2084;
31 case ui::Dataspace::TRANSFER_HLG:
32 return Description::TransferFunction::HLG;
33 case ui::Dataspace::TRANSFER_LINEAR:
34 return Description::TransferFunction::LINEAR;
35 default:
36 return Description::TransferFunction::SRGB;
37 }
Peiyong Lina296b0c2018-04-30 16:55:29 -070038}
39
40bool Description::hasInputTransformMatrix() const {
Peiyong Lin70b26ce2018-09-18 19:02:39 -070041 const mat4 identity;
42 return inputTransformMatrix != identity;
Peiyong Lina296b0c2018-04-30 16:55:29 -070043}
44
45bool Description::hasOutputTransformMatrix() const {
46 const mat4 identity;
Peiyong Lin70b26ce2018-09-18 19:02:39 -070047 return outputTransformMatrix != identity;
Peiyong Lina296b0c2018-04-30 16:55:29 -070048}
49
50bool Description::hasColorMatrix() const {
51 const mat4 identity;
Peiyong Lin70b26ce2018-09-18 19:02:39 -070052 return colorMatrix != identity;
Peiyong Linfb069302018-04-25 14:34:31 -070053}
54
Peiyong Lin46080ef2018-10-26 18:43:14 -070055} // namespace renderengine
56} // namespace android