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 <utils/Flattenable.h> 25 26namespace android { 27 28class HdrCapabilities : public LightFlattenable<HdrCapabilities> 29{ 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 39 HdrCapabilities(HdrCapabilities&& other); 40 HdrCapabilities& operator=(HdrCapabilities&& other); 41 42 HdrCapabilities() 43 : mSupportedHdrTypes(), 44 mMaxLuminance(-1.0f), 45 mMaxAverageLuminance(-1.0f), 46 mMinLuminance(-1.0f) {} 47 48 ~HdrCapabilities(); 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 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); 62 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 73