• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "ohos_adapter/bridge/ark_display_adapter_wrapper.h"
17 
18 namespace OHOS::ArkWeb {
19 
ArkDisplayAdapterWrapper(ArkWebRefPtr<ArkDisplayAdapter> ref)20 ArkDisplayAdapterWrapper::ArkDisplayAdapterWrapper(ArkWebRefPtr<ArkDisplayAdapter> ref) : ctocpp_(ref) {}
21 
GetId()22 OHOS::NWeb::DisplayId ArkDisplayAdapterWrapper::GetId()
23 {
24     return ctocpp_->GetId();
25 }
26 
GetWidth()27 int32_t ArkDisplayAdapterWrapper::GetWidth()
28 {
29     return ctocpp_->GetWidth();
30 }
31 
GetHeight()32 int32_t ArkDisplayAdapterWrapper::GetHeight()
33 {
34     return ctocpp_->GetHeight();
35 }
36 
GetVirtualPixelRatio()37 float ArkDisplayAdapterWrapper::GetVirtualPixelRatio()
38 {
39     return ctocpp_->GetVirtualPixelRatio();
40 }
41 
GetRotation()42 OHOS::NWeb::RotationType ArkDisplayAdapterWrapper::GetRotation()
43 {
44     uint32_t type = ctocpp_->GetRotation();
45     return (OHOS::NWeb::RotationType)type;
46 }
47 
GetOrientation()48 OHOS::NWeb::OrientationType ArkDisplayAdapterWrapper::GetOrientation()
49 {
50     uint32_t type = ctocpp_->GetOrientation();
51     return (OHOS::NWeb::OrientationType)type;
52 }
53 
GetDpi()54 int32_t ArkDisplayAdapterWrapper::GetDpi()
55 {
56     return ctocpp_->GetDpi();
57 }
58 
GetDisplayOrientation()59 OHOS::NWeb::DisplayOrientation ArkDisplayAdapterWrapper::GetDisplayOrientation()
60 {
61     uint32_t type = ctocpp_->GetDisplayOrientation();
62     return (OHOS::NWeb::DisplayOrientation)type;
63 }
64 
GetFoldStatus()65 OHOS::NWeb::FoldStatus ArkDisplayAdapterWrapper::GetFoldStatus()
66 {
67     uint32_t foldstatus = ctocpp_->GetFoldStatus();
68     return static_cast<OHOS::NWeb::FoldStatus>(foldstatus);
69 }
70 
IsFoldable()71 bool ArkDisplayAdapterWrapper::IsFoldable()
72 {
73     return ctocpp_->IsFoldable();
74 }
75 
GetName()76 std::string ArkDisplayAdapterWrapper::GetName()
77 {
78     ArkWebString str = ctocpp_->GetName();
79     std::string result = ArkWebStringStructToClass(str);
80 
81     ArkWebStringStructRelease(str);
82     return result;
83 }
84 
GetAvailableWidth()85 int32_t ArkDisplayAdapterWrapper::GetAvailableWidth()
86 {
87     return ctocpp_->GetAvailableWidth();
88 }
89 
GetAvailableHeight()90 int32_t ArkDisplayAdapterWrapper::GetAvailableHeight()
91 {
92     return ctocpp_->GetAvailableHeight();
93 }
94 
GetAliveStatus()95 bool ArkDisplayAdapterWrapper::GetAliveStatus()
96 {
97     return ctocpp_->GetAliveStatus();
98 }
99 
GetDisplayState()100 OHOS::NWeb::DisplayState ArkDisplayAdapterWrapper::GetDisplayState()
101 {
102     uint32_t state = ctocpp_->GetDisplayState();
103     return (OHOS::NWeb::DisplayState)state;
104 }
105 
GetDensityDpi()106 int32_t ArkDisplayAdapterWrapper::GetDensityDpi()
107 {
108     return ctocpp_->GetDensityDpi();
109 }
110 
GetX()111 int32_t ArkDisplayAdapterWrapper::GetX()
112 {
113     return ctocpp_->GetX();
114 }
115 
GetY()116 int32_t ArkDisplayAdapterWrapper::GetY()
117 {
118     return ctocpp_->GetY();
119 }
120 
GetDisplaySourceMode()121 OHOS::NWeb::DisplaySourceMode ArkDisplayAdapterWrapper::GetDisplaySourceMode()
122 {
123     uint32_t mode = ctocpp_->GetDisplaySourceMode();
124     return (OHOS::NWeb::DisplaySourceMode)mode;
125 }
126 
GetPhysicalWidth()127 int32_t ArkDisplayAdapterWrapper::GetPhysicalWidth()
128 {
129     return ctocpp_->GetPhysicalWidth();
130 }
131 
GetPhysicalHeight()132 int32_t ArkDisplayAdapterWrapper::GetPhysicalHeight()
133 {
134     return ctocpp_->GetPhysicalHeight();
135 }
136 
GetDefaultVirtualPixelRatio()137 float ArkDisplayAdapterWrapper::GetDefaultVirtualPixelRatio()
138 {
139     return ctocpp_->GetDefaultVirtualPixelRatio();
140 }
141 
142 } // namespace OHOS::ArkWeb
143