Dan Stoza | 7d7ae73 | 2016-03-16 12:23:40 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 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 | #ifndef ANDROID_UI_HDR_CAPABILTIES_H |
| 18 | #define ANDROID_UI_HDR_CAPABILTIES_H |
| 19 | |
Mathias Agopian | e1f5e6f | 2017-02-06 16:34:41 -0800 | [diff] [blame] | 20 | #include <stdint.h> |
| 21 | |
| 22 | #include <vector> |
| 23 | |
| 24 | #include <utils/Flattenable.h> |
Dan Stoza | 7d7ae73 | 2016-03-16 12:23:40 -0700 | [diff] [blame] | 25 | |
| 26 | namespace android { |
| 27 | |
Mathias Agopian | e1f5e6f | 2017-02-06 16:34:41 -0800 | [diff] [blame] | 28 | class HdrCapabilities : public LightFlattenable<HdrCapabilities> |
Dan Stoza | 7d7ae73 | 2016-03-16 12:23:40 -0700 | [diff] [blame] | 29 | { |
| 30 | public: |
| 31 | HdrCapabilities(const std::vector<int32_t /*android_hdr_t*/>& types, |
| 32 | float maxLuminance, float maxAverageLuminance, float minLuminance) |
| 33 | : mSupportedHdrTypes(types), |
| 34 | mMaxLuminance(maxLuminance), |
| 35 | mMaxAverageLuminance(maxAverageLuminance), |
| 36 | mMinLuminance(minLuminance) {} |
| 37 | |
| 38 | // Make this move-constructable and move-assignable |
Mathias Agopian | e1f5e6f | 2017-02-06 16:34:41 -0800 | [diff] [blame] | 39 | HdrCapabilities(HdrCapabilities&& other); |
| 40 | HdrCapabilities& operator=(HdrCapabilities&& other); |
Dan Stoza | 7d7ae73 | 2016-03-16 12:23:40 -0700 | [diff] [blame] | 41 | |
| 42 | HdrCapabilities() |
| 43 | : mSupportedHdrTypes(), |
| 44 | mMaxLuminance(-1.0f), |
| 45 | mMaxAverageLuminance(-1.0f), |
| 46 | mMinLuminance(-1.0f) {} |
| 47 | |
Mathias Agopian | e1f5e6f | 2017-02-06 16:34:41 -0800 | [diff] [blame] | 48 | ~HdrCapabilities(); |
Dan Stoza | 7d7ae73 | 2016-03-16 12:23:40 -0700 | [diff] [blame] | 49 | |
| 50 | const std::vector<int32_t /*android_hdr_t*/>& getSupportedHdrTypes() const { |
| 51 | return mSupportedHdrTypes; |
| 52 | } |
| 53 | float getDesiredMaxLuminance() const { return mMaxLuminance; } |
| 54 | float getDesiredMaxAverageLuminance() const { return mMaxAverageLuminance; } |
| 55 | float getDesiredMinLuminance() const { return mMinLuminance; } |
| 56 | |
Mathias Agopian | e1f5e6f | 2017-02-06 16:34:41 -0800 | [diff] [blame] | 57 | // Flattenable protocol |
| 58 | bool isFixedSize() const { return false; } |
| 59 | size_t getFlattenedSize() const; |
| 60 | status_t flatten(void* buffer, size_t size) const; |
| 61 | status_t unflatten(void const* buffer, size_t size); |
Dan Stoza | 7d7ae73 | 2016-03-16 12:23:40 -0700 | [diff] [blame] | 62 | |
| 63 | private: |
| 64 | std::vector<int32_t /*android_hdr_t*/> mSupportedHdrTypes; |
| 65 | float mMaxLuminance; |
| 66 | float mMaxAverageLuminance; |
| 67 | float mMinLuminance; |
| 68 | }; |
| 69 | |
| 70 | } // namespace android |
| 71 | |
| 72 | #endif |