1 /* 2 * Copyright (c) 2022-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef RS_SCREEN_HDR_CAPABILITY 17 #define RS_SCREEN_HDR_CAPABILITY 18 19 #include <cstdint> 20 #include <parcel.h> 21 #include <vector> 22 23 #include "common/rs_macros.h" 24 #include "screen_manager/screen_types.h" 25 26 namespace OHOS { 27 namespace Rosen { 28 class RSB_EXPORT RSScreenHDRCapability : public Parcelable { 29 public: 30 RSScreenHDRCapability() = default; 31 RSScreenHDRCapability(float maxLum, float minLum, float maxAverageLum, const std::vector<ScreenHDRFormat>& formats); 32 ~RSScreenHDRCapability() noexcept = default; 33 34 bool Marshalling(Parcel &parcel) const override; 35 static RSScreenHDRCapability *Unmarshalling(Parcel &parcel); 36 37 float GetMaxLum() const; 38 float GetMinLum() const; 39 float GetMaxAverageLum() const; 40 const std::vector<ScreenHDRFormat>& GetHdrFormats() const; 41 42 void SetMaxLum(float maxLum); 43 void SetMinLum(float minLum); 44 void SetMaxAverageLum(float maxAverageLum); 45 void SetHdrFormats(const std::vector<ScreenHDRFormat>& formats); 46 47 private: 48 bool WriteVector(const std::vector<ScreenHDRFormat>& formats, Parcel &parcel) const; 49 static bool ReadVector(std::vector<ScreenHDRFormat>& unmarFormats, Parcel &parcel); 50 float maxLum_ = 0.f; 51 float minLum_ = 0.f; 52 float maxAverageLum_ = 0.f; 53 std::vector<ScreenHDRFormat> hdrFormats_; 54 }; 55 } // namespace Rosen 56 } // namespace OHOS 57 58 #endif // RS_SCREEN_HDR_CAPABILITY 59