• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 "window_manager.h"
17 
18 namespace OHOS {
19 namespace Rosen {
Marshalling(Parcel & parcel) const20 bool UnreliableWindowInfo::Marshalling(Parcel& parcel) const
21 {
22     return parcel.WriteInt32(windowId_) && parcel.WriteUint32(windowRect_.width_) &&
23         parcel.WriteUint32(windowRect_.height_) && parcel.WriteInt32(windowRect_.posX_) &&
24         parcel.WriteInt32(windowRect_.posY_) && parcel.WriteUint32(zOrder_) &&
25         parcel.WriteFloat(floatingScale_) && parcel.WriteFloat(scaleX_) && parcel.WriteFloat(scaleY_);
26 }
27 
Unmarshalling(Parcel & parcel)28 UnreliableWindowInfo* UnreliableWindowInfo::Unmarshalling(Parcel& parcel)
29 {
30     auto info = new (std::nothrow) UnreliableWindowInfo();
31     if (info == nullptr) {
32         return nullptr;
33     }
34     bool res = parcel.ReadInt32(info->windowId_) && parcel.ReadUint32(info->windowRect_.width_) &&
35         parcel.ReadUint32(info->windowRect_.height_) && parcel.ReadInt32(info->windowRect_.posX_) &&
36         parcel.ReadInt32(info->windowRect_.posY_) && parcel.ReadUint32(info->zOrder_) &&
37         parcel.ReadFloat(info->floatingScale_) && parcel.ReadFloat(info->scaleX_) && parcel.ReadFloat(info->scaleY_);
38     if (!res) {
39         delete info;
40         return nullptr;
41     }
42     return info;
43 }
44 }
45 }