1 /* 2 * Copyright (c) 2022 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 OHOS_ROSEN_DISPLAY_GROUP_INFO_H 17 #define OHOS_ROSEN_DISPLAY_GROUP_INFO_H 18 19 #include <map> 20 #include <refbase.h> 21 22 #include "display_info.h" 23 #include "wm_common.h" 24 25 namespace OHOS { 26 namespace Rosen { 27 class DisplayGroupInfo : public RefBase { 28 public: 29 DisplayGroupInfo(ScreenId displayGroupId, const sptr<DisplayInfo>& displayInfo); 30 ~DisplayGroupInfo() = default; 31 void AddDisplayInfo(const sptr<DisplayInfo>& displayInfo); 32 void RemoveDisplayInfo(DisplayId displayId); 33 void UpdateLeftAndRightDisplayId(); 34 35 void SetDisplayRotation(DisplayId displayId, Rotation rotation); 36 void SetDisplayVirtualPixelRatio(DisplayId displayId, float vpr); 37 void SetDisplayRect(DisplayId displayId, Rect displayRect); 38 39 Rotation GetDisplayRotation(DisplayId displayId) const; 40 float GetDisplayVirtualPixelRatio(DisplayId displayId) const; 41 std::map<DisplayId, Rect> GetAllDisplayRects() const; 42 Rect GetDisplayRect(DisplayId displayId) const; 43 sptr<DisplayInfo> GetDisplayInfo(DisplayId displayId) const; 44 void UpdateDisplayInfo(sptr<DisplayInfo> displayInfo) const; 45 std::vector<sptr<DisplayInfo>> GetAllDisplayInfo() const; 46 DisplayId GetLeftDisplayId() const; 47 DisplayId GetRightDisplayId() const; 48 49 private: 50 ScreenId displayGroupId_; 51 DisplayId leftDisplayId_ { 0 }; 52 DisplayId rightDisplayId_ { 0 }; 53 mutable std::map<DisplayId, sptr<DisplayInfo>> displayInfosMap_; 54 }; 55 } // namespace Rosen 56 } // namespace OHOS 57 #endif // OHOS_ROSEN_DISPLAY_GROUP_INFO_H 58 59