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 <stdint.h>
21
22#include <vector>
23
24#include <ui/GraphicTypes.h>
25#include <utils/Flattenable.h>
26
27namespace android {
28
29class HdrCapabilities : public LightFlattenable<HdrCapabilities>
30{
31public:
32    HdrCapabilities(const std::vector<ui::Hdr>& types,
33            float maxLuminance, float maxAverageLuminance, float minLuminance)
34      : mSupportedHdrTypes(types),
35        mMaxLuminance(maxLuminance),
36        mMaxAverageLuminance(maxAverageLuminance),
37        mMinLuminance(minLuminance) {}
38
39    // Make this move-constructable and move-assignable
40    HdrCapabilities(HdrCapabilities&& other);
41    HdrCapabilities& operator=(HdrCapabilities&& other);
42
43    HdrCapabilities()
44      : mSupportedHdrTypes(),
45        mMaxLuminance(-1.0f),
46        mMaxAverageLuminance(-1.0f),
47        mMinLuminance(-1.0f) {}
48
49    ~HdrCapabilities();
50
51    const std::vector<ui::Hdr>& getSupportedHdrTypes() const {
52        return mSupportedHdrTypes;
53    }
54    float getDesiredMaxLuminance() const { return mMaxLuminance; }
55    float getDesiredMaxAverageLuminance() const { return mMaxAverageLuminance; }
56    float getDesiredMinLuminance() const { return mMinLuminance; }
57
58    // Flattenable protocol
59    bool isFixedSize() const { return false; }
60    size_t getFlattenedSize() const;
61    status_t flatten(void* buffer, size_t size) const;
62    status_t unflatten(void const* buffer, size_t size);
63
64private:
65    std::vector<ui::Hdr> mSupportedHdrTypes;
66    float mMaxLuminance;
67    float mMaxAverageLuminance;
68    float mMinLuminance;
69};
70
71} // namespace android
72
73#endif
74