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