• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2023 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 ROSEN_RENDER_SERVICE_BASE_COMMAND_RS_CANVAS_NODE_COMMAND_H
17 #define ROSEN_RENDER_SERVICE_BASE_COMMAND_RS_CANVAS_NODE_COMMAND_H
18 
19 
20 #include "command/rs_command_templates.h"
21 #include "common/rs_macros.h"
22 #include "modifier/rs_modifier_type.h"
23 #include "pipeline/rs_canvas_render_node.h"
24 
25 namespace OHOS {
26 namespace Rosen {
27 
28 enum RSCanvasNodeCommandType : uint16_t {
29     CANVAS_NODE_CREATE,
30     CANVAS_NODE_UPDATE_RECORDING,
31     CANVAS_NODE_CLEAR_RECORDING,
32 };
33 
34 namespace Drawing {
35 class DrawCmdList;
36 }
37 
38 class RSB_EXPORT RSCanvasNodeCommandHelper {
39 public:
40     static void Create(RSContext& context, NodeId id, bool isTextureExportNode = false);
41     static void UpdateRecording(
42         RSContext& context, NodeId id, std::shared_ptr<Drawing::DrawCmdList> drawCmds, uint16_t modifierType);
43     static void ClearRecording(RSContext& context, NodeId id);
44 private:
45     static bool AddCmdToSingleFrameComposer(std::shared_ptr<RSCanvasRenderNode> node,
46         std::shared_ptr<Drawing::DrawCmdList> drawCmds, RSModifierType type);
47 };
48 
49 ADD_COMMAND(RSCanvasNodeCreate, ARG(CANVAS_NODE, CANVAS_NODE_CREATE, RSCanvasNodeCommandHelper::Create, NodeId, bool))
50 ADD_COMMAND(RSCanvasNodeUpdateRecording,
51     ARG(CANVAS_NODE, CANVAS_NODE_UPDATE_RECORDING, RSCanvasNodeCommandHelper::UpdateRecording, NodeId,
52         std::shared_ptr<Drawing::DrawCmdList>, uint16_t))
53 ADD_COMMAND(RSCanvasNodeClearRecording,
54     ARG(CANVAS_NODE, CANVAS_NODE_CLEAR_RECORDING, RSCanvasNodeCommandHelper::ClearRecording, NodeId))
55 
56 } // namespace Rosen
57 } // namespace OHOS
58 
59 #endif // ROSEN_RENDER_SERVICE_BASE_COMMAND_RS_CANVAS_NODE_COMMAND_H
60