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_DISPLAY_INFO_H 17 #define FOUNDATION_DMSERVER_DISPLAY_INFO_H 18 19 #include <cstdint> 20 #include <parcel.h> 21 22 #include "class_var_definition.h" 23 #include "display.h" 24 #include "dm_common.h" 25 #include "noncopyable.h" 26 27 namespace OHOS::Rosen { 28 class DisplayInfo : public Parcelable { 29 friend class AbstractDisplay; 30 friend class ScreenSession; 31 public: 32 DisplayInfo() = default; 33 ~DisplayInfo() = default; 34 WM_DISALLOW_COPY_AND_MOVE(DisplayInfo); 35 36 virtual bool Marshalling(Parcel& parcel) const override; 37 static DisplayInfo *Unmarshalling(Parcel& parcel); 38 39 DEFINE_VAR_DEFAULT_FUNC_GET(std::string, Name, name, ""); 40 DEFINE_VAR_DEFAULT_FUNC_GET_SET(DisplayId, DisplayId, id, DISPLAY_ID_INVALID); 41 DEFINE_VAR_DEFAULT_FUNC_GET_SET(DisplayType, DisplayType, type, DisplayType::DEFAULT); 42 DEFINE_VAR_DEFAULT_FUNC_GET_SET(int32_t, Width, width, 0); 43 DEFINE_VAR_DEFAULT_FUNC_GET_SET(int32_t, Height, height, 0); 44 DEFINE_VAR_DEFAULT_FUNC_GET_SET(int32_t, PhysicalWidth, physicalWidth, 0); 45 DEFINE_VAR_DEFAULT_FUNC_GET_SET(int32_t, PhysicalHeight, physicalHeight, 0); 46 DEFINE_VAR_DEFAULT_FUNC_GET_SET(uint32_t, RefreshRate, refreshRate, 0); 47 DEFINE_VAR_DEFAULT_FUNC_GET_SET(ScreenId, ScreenId, screenId, SCREEN_ID_INVALID); 48 DEFINE_VAR_DEFAULT_FUNC_GET_SET(ScreenId, ScreenGroupId, screenGroupId, SCREEN_ID_INVALID); 49 DEFINE_VAR_DEFAULT_FUNC_GET_SET(float, VirtualPixelRatio, virtualPixelRatio, 1.0f); 50 DEFINE_VAR_DEFAULT_FUNC_GET_SET(float, DensityInCurResolution, densityInCurResolution, 1.0f); 51 DEFINE_VAR_DEFAULT_FUNC_GET_SET(float, DefaultVirtualPixelRatio, defaultVirtualPixelRatio, 1.0f); 52 DEFINE_VAR_DEFAULT_FUNC_GET_SET(float, XDpi, xDpi, 0.0f); 53 DEFINE_VAR_DEFAULT_FUNC_GET_SET(float, YDpi, yDpi, 0.0f); 54 DEFINE_VAR_DEFAULT_FUNC_GET_SET(int32_t, Dpi, dpi, 320); 55 DEFINE_VAR_DEFAULT_FUNC_GET_SET(Rotation, Rotation, rotation, Rotation::ROTATION_0); 56 DEFINE_VAR_DEFAULT_FUNC_GET_SET(Orientation, Orientation, orientation, Orientation::UNSPECIFIED); 57 DEFINE_VAR_DEFAULT_FUNC_GET_SET(int32_t, OffsetX, offsetX, 0); 58 DEFINE_VAR_DEFAULT_FUNC_GET_SET(int32_t, OffsetY, offsetY, 0); 59 DEFINE_VAR_DEFAULT_FUNC_GET_SET(DisplayState, DisplayState, displayState, DisplayState::UNKNOWN); 60 DEFINE_VAR_DEFAULT_FUNC_GET_SET(bool, WaterfallDisplayCompressionStatus, waterfallDisplayCompressionStatus, false); 61 DEFINE_VAR_DEFAULT_FUNC_GET_SET(DisplayOrientation, DisplayOrientation, displayOrientation, 62 DisplayOrientation::UNKNOWN); 63 DEFINE_VAR_DEFAULT_FUNC_GET_SET(DisplayStateChangeType, DisplayStateChangeType, displayStateChangeType, 64 DisplayStateChangeType::UNKNOWN); 65 DEFINE_VAR_DEFAULT_FUNC_GET_SET(bool, IsDefaultVertical, isDefaultVertical, true); 66 DEFINE_VAR_DEFAULT_FUNC_GET_SET(bool, AliveStatus, alive, true); 67 DEFINE_VAR_DEFAULT_FUNC_GET_SET(std::vector<uint32_t>, ColorSpaces, colorSpaces, std::vector<uint32_t>()); 68 DEFINE_VAR_DEFAULT_FUNC_GET_SET(std::vector<uint32_t>, HdrFormats, hdrFormats, std::vector<uint32_t>()); 69 DEFINE_VAR_DEFAULT_FUNC_GET_SET(uint32_t, DefaultDeviceRotationOffset, defaultDeviceRotationOffset, 0); 70 DEFINE_VAR_DEFAULT_FUNC_GET_SET(uint32_t, AvailableWidth, availableWidth, 0); 71 DEFINE_VAR_DEFAULT_FUNC_GET_SET(uint32_t, AvailableHeight, availableHeight, 0); 72 DEFINE_VAR_DEFAULT_FUNC_GET_SET(float, ScaleX, scaleX, 1.0f); 73 DEFINE_VAR_DEFAULT_FUNC_GET_SET(float, ScaleY, scaleY, 1.0f); 74 DEFINE_VAR_DEFAULT_FUNC_GET_SET(float, PivotX, pivotX, 0.5f); 75 DEFINE_VAR_DEFAULT_FUNC_GET_SET(float, PivotY, pivotY, 0.5f); 76 DEFINE_VAR_DEFAULT_FUNC_GET_SET(float, TranslateX, translateX, 0.0f); 77 DEFINE_VAR_DEFAULT_FUNC_GET_SET(float, TranslateY, translateY, 0.0f); 78 }; 79 } // namespace OHOS::Rosen 80 #endif // FOUNDATION_DMSERVER_DISPLAY_INFO_H