1 /* 2 * Copyright (c) 2021 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 #ifndef RENDER_SERVICE_CLIENT_CORE_UI_RS_ROOT_NODE_H 16 #define RENDER_SERVICE_CLIENT_CORE_UI_RS_ROOT_NODE_H 17 18 #include "platform/drawing/rs_surface.h" 19 #include "ui/rs_canvas_node.h" 20 21 namespace OHOS { 22 namespace Rosen { 23 class RSSurfaceNode; 24 class RS_EXPORT RSRootNode : public RSCanvasNode { 25 public: 26 using WeakPtr = std::weak_ptr<RSRootNode>; 27 using SharedPtr = std::shared_ptr<RSRootNode>; 28 static inline constexpr RSUINodeType Type = RSUINodeType::ROOT_NODE; 29 ~RSRootNode()30 virtual ~RSRootNode() {} 31 32 static std::shared_ptr<RSNode> Create(bool isRenderServiceNode = false); 33 GetType()34 RSUINodeType GetType() const override 35 { 36 return RSUINodeType::ROOT_NODE; 37 } 38 39 protected: 40 void AttachRSSurfaceNode(std::shared_ptr<RSSurfaceNode> surfaceNode) const; 41 42 RSRootNode(bool isRenderServiceNode); 43 RSRootNode(const RSRootNode&) = delete; 44 RSRootNode(const RSRootNode&&) = delete; 45 RSRootNode& operator=(const RSRootNode&) = delete; 46 RSRootNode& operator=(const RSRootNode&&) = delete; 47 48 friend class RSUIDirector; 49 }; 50 } // namespace Rosen 51 } // namespace OHOS 52 53 #endif // RENDER_SERVICE_CLIENT_CORE_UI_RS_ROOT_NODE_H