Files
window_window_manager/utils/include/dm_rs_surface_node.h
T
2025-05-15 22:52:55 +08:00

55 lines
1.6 KiB
C++

/*
* Copyright (c) 2025 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OHOS_ROSEN_DM_RS_SURFACE_NODE_H
#define OHOS_ROSEN_DM_RS_SURFACE_NODE_H
#include <parcel.h>
#include <ui/rs_surface_node.h>
namespace OHOS::Rosen {
class DmRsSurfaceNode : public Parcelable {
public:
DmRsSurfaceNode() = default;
explicit DmRsSurfaceNode(const std::shared_ptr<RSSurfaceNode>& surfaceNode) : surfaceNode_(surfaceNode)
{}
bool Marshalling(Parcel& parcel) const override
{
if (surfaceNode_) {
return surfaceNode_->Marshalling(parcel);
}
return false;
}
static DmRsSurfaceNode* Unmarshalling(Parcel& parcel)
{
std::shared_ptr<RSSurfaceNode> surfaceNode = RSSurfaceNode::Unmarshalling(parcel);
return new DmRsSurfaceNode(surfaceNode);
}
std::shared_ptr<RSSurfaceNode> GetSurfaceNode() const
{
return surfaceNode_;
}
private:
std::shared_ptr<RSSurfaceNode> surfaceNode_;
};
} // namespace OHOS::Rosen
#endif /* OHOS_ROSEN_DM_RS_SURFACE_NODE_H */