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_PIPELINE_RS_CANVAS_RENDER_NODE_H 16 #define RENDER_SERVICE_CLIENT_CORE_PIPELINE_RS_CANVAS_RENDER_NODE_H 17 18 #include <memory> 19 20 #include "pipeline/rs_render_node.h" 21 22 namespace OHOS { 23 namespace Rosen { 24 class DrawCmdList; 25 class RSPaintFilterCanvas; 26 27 class RSCanvasRenderNode : public RSRenderNode { 28 public: 29 using WeakPtr = std::weak_ptr<RSCanvasRenderNode>; 30 using SharedPtr = std::shared_ptr<RSCanvasRenderNode>; 31 static inline constexpr RSRenderNodeType Type = RSRenderNodeType::CANVAS_NODE; 32 33 explicit RSCanvasRenderNode(NodeId id, std::weak_ptr<RSContext> context = {}); 34 virtual ~RSCanvasRenderNode(); 35 36 void UpdateRecording(std::shared_ptr<DrawCmdList> drawCmds, bool drawContentLast); 37 38 void ProcessRenderBeforeChildren(RSPaintFilterCanvas& canvas) override; 39 void ProcessRenderContents(RSPaintFilterCanvas& canvas) override; 40 void ProcessRenderAfterChildren(RSPaintFilterCanvas& canvas) override; 41 42 void Prepare(const std::shared_ptr<RSNodeVisitor>& visitor) override; 43 void Process(const std::shared_ptr<RSNodeVisitor>& visitor) override; 44 GetType()45 RSRenderNodeType GetType() const override 46 { 47 return RSRenderNodeType::CANVAS_NODE; 48 } 49 50 private: 51 std::shared_ptr<DrawCmdList> drawCmdList_ { nullptr }; 52 bool drawContentLast_ = false; 53 54 friend class RSRenderTransition; 55 }; 56 } // namespace Rosen 57 } // namespace OHOS 58 59 #endif // RENDER_SERVICE_CLIENT_CORE_PIPELINE_RS_CANVAS_RENDER_NODE_H 60