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 27 namespace android { 28 29 class HdrCapabilities : public LightFlattenable<HdrCapabilities> 30 { 31 public: HdrCapabilities(const std::vector<ui::Hdr> & types,float maxLuminance,float maxAverageLuminance,float minLuminance)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 HdrCapabilities()39 HdrCapabilities() 40 : mSupportedHdrTypes(), 41 mMaxLuminance(-1.0f), 42 mMaxAverageLuminance(-1.0f), 43 mMinLuminance(-1.0f) {} 44 getSupportedHdrTypes()45 const std::vector<ui::Hdr>& getSupportedHdrTypes() const { 46 return mSupportedHdrTypes; 47 } getDesiredMaxLuminance()48 float getDesiredMaxLuminance() const { return mMaxLuminance; } getDesiredMaxAverageLuminance()49 float getDesiredMaxAverageLuminance() const { return mMaxAverageLuminance; } getDesiredMinLuminance()50 float getDesiredMinLuminance() const { return mMinLuminance; } 51 52 // Flattenable protocol isFixedSize()53 bool isFixedSize() const { return false; } 54 size_t getFlattenedSize() const; 55 status_t flatten(void* buffer, size_t size) const; 56 status_t unflatten(void const* buffer, size_t size); 57 58 private: 59 std::vector<ui::Hdr> mSupportedHdrTypes; 60 float mMaxLuminance; 61 float mMaxAverageLuminance; 62 float mMinLuminance; 63 }; 64 65 } // namespace android 66 67 #endif 68