1 /* 2 * Copyright (c) 2021-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 #ifndef RENDER_SERVICE_CLIENT_CORE_RENDER_RS_NODE_VISITOR_H 17 #define RENDER_SERVICE_CLIENT_CORE_RENDER_RS_NODE_VISITOR_H 18 19 #include <memory> 20 21 namespace OHOS { 22 namespace Rosen { 23 class RSRenderNode; 24 class RSCanvasRenderNode; 25 class RSDisplayRenderNode; 26 class RSProxyRenderNode; 27 class RSRootRenderNode; 28 class RSSurfaceRenderNode; 29 class RSEffectRenderNode; 30 31 class RSNodeVisitor : public std::enable_shared_from_this<RSNodeVisitor> { 32 public: 33 RSNodeVisitor() = default; 34 RSNodeVisitor(const RSNodeVisitor&) = delete; 35 RSNodeVisitor(const RSNodeVisitor&&) = delete; 36 RSNodeVisitor& operator=(const RSNodeVisitor&) = delete; 37 RSNodeVisitor& operator=(const RSNodeVisitor&&) = delete; 38 virtual ~RSNodeVisitor() = default; 39 40 virtual void PrepareChildren(RSRenderNode& node) = 0; 41 virtual void PrepareCanvasRenderNode(RSCanvasRenderNode& node) = 0; 42 virtual void PrepareDisplayRenderNode(RSDisplayRenderNode& node) = 0; 43 virtual void PrepareProxyRenderNode(RSProxyRenderNode& node) = 0; 44 virtual void PrepareRootRenderNode(RSRootRenderNode& node) = 0; 45 virtual void PrepareSurfaceRenderNode(RSSurfaceRenderNode& node) = 0; 46 virtual void PrepareEffectRenderNode(RSEffectRenderNode& node) = 0; 47 48 virtual void ProcessChildren(RSRenderNode& node) = 0; 49 virtual void ProcessCanvasRenderNode(RSCanvasRenderNode& node) = 0; 50 virtual void ProcessDisplayRenderNode(RSDisplayRenderNode& node) = 0; 51 virtual void ProcessProxyRenderNode(RSProxyRenderNode& node) = 0; 52 virtual void ProcessRootRenderNode(RSRootRenderNode& node) = 0; 53 virtual void ProcessSurfaceRenderNode(RSSurfaceRenderNode& node) = 0; 54 virtual void ProcessEffectRenderNode(RSEffectRenderNode& node) = 0; 55 AddSurfaceChangedCallBack(uint64_t id,const std::function<void (float,float,float,float)> & callback)56 virtual void AddSurfaceChangedCallBack(uint64_t id, 57 const std::function<void(float, float, float, float)>& callback) {}; RemoveSurfaceChangedCallBack(uint64_t id)58 virtual void RemoveSurfaceChangedCallBack(uint64_t id) {}; 59 }; 60 61 } // namespace Rosen 62 } // namespace OHOS 63 64 #endif // RENDER_SERVICE_CLIENT_CORE_RENDER_RS_NODE_VISITOR_H 65