blob: 925aa1b7b3acfa2566ee31411bed5d70ab799f64 [file] [log] [blame]
Dan Stoza7d7ae732016-03-16 12:23:40 -07001/*
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 Agopiane1f5e6f2017-02-06 16:34:41 -080020#include <stdint.h>
21
22#include <vector>
23
24#include <utils/Flattenable.h>
Dan Stoza7d7ae732016-03-16 12:23:40 -070025
26namespace android {
27
Mathias Agopiane1f5e6f2017-02-06 16:34:41 -080028class HdrCapabilities : public LightFlattenable<HdrCapabilities>
Dan Stoza7d7ae732016-03-16 12:23:40 -070029{
30public:
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 Agopiane1f5e6f2017-02-06 16:34:41 -080039 HdrCapabilities(HdrCapabilities&& other);
40 HdrCapabilities& operator=(HdrCapabilities&& other);
Dan Stoza7d7ae732016-03-16 12:23:40 -070041
42 HdrCapabilities()
43 : mSupportedHdrTypes(),
44 mMaxLuminance(-1.0f),
45 mMaxAverageLuminance(-1.0f),
46 mMinLuminance(-1.0f) {}
47
Mathias Agopiane1f5e6f2017-02-06 16:34:41 -080048 ~HdrCapabilities();
Dan Stoza7d7ae732016-03-16 12:23:40 -070049
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 Agopiane1f5e6f2017-02-06 16:34:41 -080057 // 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 Stoza7d7ae732016-03-16 12:23:40 -070062
63private:
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