1 /* 2 * Copyright (c) 2021-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 FOUNDATION_DMSERVER_SCREEN_INFO_H 17 #define FOUNDATION_DMSERVER_SCREEN_INFO_H 18 19 #include <parcel.h> 20 21 #include "class_var_definition.h" 22 #include "dm_common.h" 23 #include "noncopyable.h" 24 25 namespace OHOS::Rosen { 26 enum class ScreenType : uint32_t { 27 UNDEFINED, 28 REAL, 29 VIRTUAL 30 }; 31 class ScreenInfo : public Parcelable { 32 friend class AbstractScreen; 33 friend class ScreenSession; 34 public: 35 ScreenInfo() = default; 36 ~ScreenInfo() = default; 37 WM_DISALLOW_COPY_AND_MOVE(ScreenInfo); 38 39 virtual bool Marshalling(Parcel& parcel) const override; 40 static ScreenInfo* Unmarshalling(Parcel& parcel); 41 42 DEFINE_VAR_DEFAULT_FUNC_GET_SET(std::string, Name, name, ""); 43 DEFINE_VAR_DEFAULT_FUNC_GET_SET(ScreenId, ScreenId, id, SCREEN_ID_INVALID); 44 DEFINE_VAR_DEFAULT_FUNC_GET_SET(uint32_t, VirtualWidth, virtualWidth, 0); 45 DEFINE_VAR_DEFAULT_FUNC_GET_SET(uint32_t, VirtualHeight, virtualHeight, 0); 46 DEFINE_VAR_DEFAULT_FUNC_GET_SET(float, VirtualPixelRatio, virtualPixelRatio, 1.0f); 47 DEFINE_VAR_DEFAULT_FUNC_GET_SET(ScreenId, LastParentId, lastParent, SCREEN_ID_INVALID); 48 DEFINE_VAR_DEFAULT_FUNC_GET_SET(ScreenId, ParentId, parent, SCREEN_ID_INVALID); 49 DEFINE_VAR_DEFAULT_FUNC_GET_SET(bool, IsScreenGroup, isScreenGroup, false); 50 DEFINE_VAR_DEFAULT_FUNC_GET_SET(Rotation, Rotation, rotation, Rotation::ROTATION_0); 51 DEFINE_VAR_DEFAULT_FUNC_GET_SET(Orientation, Orientation, orientation, Orientation::UNSPECIFIED); 52 DEFINE_VAR_DEFAULT_FUNC_GET_SET(ScreenSourceMode, SourceMode, sourceMode, ScreenSourceMode::SCREEN_ALONE); 53 DEFINE_VAR_DEFAULT_FUNC_GET_SET(ScreenType, Type, type, ScreenType::UNDEFINED); 54 DEFINE_VAR_DEFAULT_FUNC_GET_SET(uint32_t, ModeId, modeId, 0); 55 DEFINE_VAR_FUNC_GET(std::vector<sptr<SupportedScreenModes>>, Modes, modes); 56 protected: 57 const static uint32_t MAX_SUPPORTED_SCREEN_MODES_SIZE = 20; 58 bool InnerUnmarshalling(Parcel& parcel); 59 }; 60 } // namespace OHOS::Rosen 61 #endif // FOUNDATION_DMSERVER_DISPLAY_INFO_H 62