• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_ROOT_RENDER_NODE_H
16 #define RENDER_SERVICE_CLIENT_CORE_PIPELINE_RS_ROOT_RENDER_NODE_H
17 
18 #include "pipeline/rs_canvas_render_node.h"
19 
20 namespace OHOS {
21 namespace Rosen {
22 class RSSurface;
23 class RSRootRenderNode : public RSCanvasRenderNode {
24 public:
25     static inline constexpr RSRenderNodeType Type = RSRenderNodeType::ROOT_NODE;
26     explicit RSRootRenderNode(NodeId id, std::weak_ptr<RSContext> context = {});
27     ~RSRootRenderNode() override;
28 
29     virtual void Prepare(const std::shared_ptr<RSNodeVisitor>& visitor) override;
30     virtual void Process(const std::shared_ptr<RSNodeVisitor>& visitor) override;
31 
32     void AttachRSSurfaceNode(NodeId SurfaceNodeId);
33 
GetType()34     RSRenderNodeType GetType() const override
35     {
36         return RSRenderNodeType::ROOT_NODE;
37     }
38 
39     std::shared_ptr<RSSurface> GetSurface();
40     NodeId GetRSSurfaceNodeId();
41     int32_t GetSurfaceWidth() const;
42     int32_t GetSurfaceHeight() const;
43 
44     void AddSurfaceRenderNode(NodeId id);
45     void ClearSurfaceNodeInRS();
46 
47     static void MarkForceRaster(bool flag = true);
48     static bool NeedForceRaster();
49 
50 private:
51     std::shared_ptr<RSSurface> rsSurface_ = nullptr;
52     NodeId surfaceNodeId_ = 0;
53     std::vector<NodeId> childSurfaceNodeId_;
54 
55     static bool forceRaster_;
56 };
57 } // namespace Rosen
58 } // namespace OHOS
59 
60 #endif // RENDER_SERVICE_CLIENT_CORE_PIPELINE_RS_ROOT_RENDER_NODE_H