1 /* 2 * Copyright (c) 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 ROSEN_RENDER_SERVICE_BASE_RS_HGM_CONFIG_DATA_H 17 #define ROSEN_RENDER_SERVICE_BASE_RS_HGM_CONFIG_DATA_H 18 19 #include <vector> 20 #include <parcel.h> 21 22 #include "common/rs_macros.h" 23 24 namespace OHOS { 25 namespace Rosen { 26 struct AnimDynamicItem { 27 std::string animType = ""; 28 std::string animName = ""; 29 int32_t minSpeed = 0; 30 int32_t maxSpeed = 0; 31 int32_t preferredFps = 0; 32 }; 33 34 class RSB_EXPORT RSHgmConfigData : public Parcelable { 35 public: 36 RSHgmConfigData() = default; RSHgmConfigData(RSHgmConfigData && other)37 RSHgmConfigData(RSHgmConfigData&& other) : configData_(std::move(other.configData_)) {} 38 ~RSHgmConfigData() noexcept; 39 40 [[nodiscard]] static RSHgmConfigData* Unmarshalling(Parcel& parcel); 41 bool Marshalling(Parcel& parcel) const override; 42 AddAnimDynamicItem(AnimDynamicItem item)43 void AddAnimDynamicItem(AnimDynamicItem item) 44 { 45 configData_.emplace_back(item); 46 } 47 GetConfigData()48 const std::vector<AnimDynamicItem>& GetConfigData() const 49 { 50 return configData_; 51 } 52 GetPpi()53 float GetPpi() const 54 { 55 return ppi_; 56 } 57 GetXDpi()58 float GetXDpi() const 59 { 60 return xDpi_; 61 } 62 GetYDpi()63 float GetYDpi() const 64 { 65 return yDpi_; 66 } 67 SetPpi(float ppi)68 void SetPpi(float ppi) 69 { 70 ppi_ = ppi; 71 } 72 SetXDpi(float xDpi)73 void SetXDpi(float xDpi) 74 { 75 xDpi_ = xDpi; 76 } 77 SetYDpi(float yDpi)78 void SetYDpi(float yDpi) 79 { 80 yDpi_ = yDpi; 81 } 82 83 private: 84 std::vector<AnimDynamicItem> configData_; 85 float ppi_ = 1.0f; 86 float xDpi_ = 1.0f; 87 float yDpi_ = 1.0f; 88 }; 89 } // namespace Rosen 90 } // namespace OHOS 91 92 #endif 93