| 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 | 833074a | 2018-08-28 11:53:54 -0700 | [diff] [blame] | 17 | #include <renderengine/private/Description.h> | 
| Peiyong Lin | cbc184f | 2018-08-22 13:24:10 -0700 | [diff] [blame] | 18 |  | 
| Mathias Agopian | 3f84483 | 2013-08-07 21:24:32 -0700 | [diff] [blame] | 19 | #include <stdint.h> | 
| Mathias Agopian | 3f84483 | 2013-08-07 21:24:32 -0700 | [diff] [blame] | 20 |  | 
|  | 21 | #include <utils/TypeHelpers.h> | 
|  | 22 |  | 
| Mathias Agopian | 3f84483 | 2013-08-07 21:24:32 -0700 | [diff] [blame] | 23 | namespace android { | 
| Peiyong Lin | 833074a | 2018-08-28 11:53:54 -0700 | [diff] [blame] | 24 | namespace renderengine { | 
| Mathias Agopian | 3f84483 | 2013-08-07 21:24:32 -0700 | [diff] [blame] | 25 |  | 
| Peiyong Lin | 70b26ce | 2018-09-18 19:02:39 -0700 | [diff] [blame] | 26 | Description::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 Lin | a296b0c | 2018-04-30 16:55:29 -0700 | [diff] [blame] | 38 | } | 
|  | 39 |  | 
|  | 40 | bool Description::hasInputTransformMatrix() const { | 
| Peiyong Lin | 70b26ce | 2018-09-18 19:02:39 -0700 | [diff] [blame] | 41 | const mat4 identity; | 
|  | 42 | return inputTransformMatrix != identity; | 
| Peiyong Lin | a296b0c | 2018-04-30 16:55:29 -0700 | [diff] [blame] | 43 | } | 
|  | 44 |  | 
|  | 45 | bool Description::hasOutputTransformMatrix() const { | 
|  | 46 | const mat4 identity; | 
| Peiyong Lin | 70b26ce | 2018-09-18 19:02:39 -0700 | [diff] [blame] | 47 | return outputTransformMatrix != identity; | 
| Peiyong Lin | a296b0c | 2018-04-30 16:55:29 -0700 | [diff] [blame] | 48 | } | 
|  | 49 |  | 
|  | 50 | bool Description::hasColorMatrix() const { | 
|  | 51 | const mat4 identity; | 
| Peiyong Lin | 70b26ce | 2018-09-18 19:02:39 -0700 | [diff] [blame] | 52 | return colorMatrix != identity; | 
| Peiyong Lin | fb06930 | 2018-04-25 14:34:31 -0700 | [diff] [blame] | 53 | } | 
|  | 54 |  | 
| Peiyong Lin | 833074a | 2018-08-28 11:53:54 -0700 | [diff] [blame] | 55 | }  // namespace renderengine | 
|  | 56 | }  // namespace android |