• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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_DM_RS_SURFACE_NODE_H
17 #define OHOS_ROSEN_DM_RS_SURFACE_NODE_H
18 
19 #include <parcel.h>
20 #include <ui/rs_surface_node.h>
21 #include "window_manager_hilog.h"
22 
23 namespace OHOS::Rosen {
24 class DmRsSurfaceNode : public Parcelable {
25 public:
26     DmRsSurfaceNode() = default;
27 
DmRsSurfaceNode(const std::shared_ptr<RSSurfaceNode> & surfaceNode)28     explicit DmRsSurfaceNode(const std::shared_ptr<RSSurfaceNode>& surfaceNode) : surfaceNode_(surfaceNode) {}
29 
Marshalling(Parcel & parcel)30     bool Marshalling(Parcel& parcel) const override
31     {
32         if (surfaceNode_) {
33             return surfaceNode_->Marshalling(parcel);
34         }
35         TLOGE(WmsLogTag::DMS, "surfaceNode_ is null");
36         return false;
37     }
38 
Unmarshalling(Parcel & parcel)39     static DmRsSurfaceNode* Unmarshalling(Parcel& parcel)
40     {
41         std::shared_ptr<RSSurfaceNode> surfaceNode = RSSurfaceNode::Unmarshalling(parcel);
42         return new (std::nothrow) DmRsSurfaceNode(surfaceNode);
43     }
44 
GetSurfaceNode()45     std::shared_ptr<RSSurfaceNode> GetSurfaceNode() const
46     {
47         return surfaceNode_;
48     }
49 
50 private:
51     std::shared_ptr<RSSurfaceNode> surfaceNode_;
52 };
53 } // namespace OHOS::Rosen
54 
55 #endif /* OHOS_ROSEN_DM_RS_SURFACE_NODE_H */
56