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 
20 #include <binder/Parcelable.h>
21 
22 namespace android {
23 
24 class HdrCapabilities : public Parcelable
25 {
26 public:
HdrCapabilities(const std::vector<int32_t> & types,float maxLuminance,float maxAverageLuminance,float minLuminance)27     HdrCapabilities(const std::vector<int32_t /*android_hdr_t*/>& types,
28             float maxLuminance, float maxAverageLuminance, float minLuminance)
29       : mSupportedHdrTypes(types),
30         mMaxLuminance(maxLuminance),
31         mMaxAverageLuminance(maxAverageLuminance),
32         mMinLuminance(minLuminance) {}
33 
34     // Make this move-constructable and move-assignable
35     HdrCapabilities(HdrCapabilities&& other) = default;
36     HdrCapabilities& operator=(HdrCapabilities&& other) = default;
37 
HdrCapabilities()38     HdrCapabilities()
39       : mSupportedHdrTypes(),
40         mMaxLuminance(-1.0f),
41         mMaxAverageLuminance(-1.0f),
42         mMinLuminance(-1.0f) {}
43 
44     virtual ~HdrCapabilities() = default;
45 
getSupportedHdrTypes()46     const std::vector<int32_t /*android_hdr_t*/>& getSupportedHdrTypes() const {
47         return mSupportedHdrTypes;
48     }
getDesiredMaxLuminance()49     float getDesiredMaxLuminance() const { return mMaxLuminance; }
getDesiredMaxAverageLuminance()50     float getDesiredMaxAverageLuminance() const { return mMaxAverageLuminance; }
getDesiredMinLuminance()51     float getDesiredMinLuminance() const { return mMinLuminance; }
52 
53     // Parcelable interface
54     virtual status_t writeToParcel(Parcel* parcel) const override;
55     virtual status_t readFromParcel(const Parcel* parcel) override;
56 
57 private:
58     std::vector<int32_t /*android_hdr_t*/> mSupportedHdrTypes;
59     float mMaxLuminance;
60     float mMaxAverageLuminance;
61     float mMinLuminance;
62 };
63 
64 } // namespace android
65 
66 #endif
67