• 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 
24 namespace OHOS {
25 namespace Rosen {
26 
27 enum RSCanvasNodeCommandType : uint16_t {
28     CANVAS_NODE_CREATE,
29     CANVAS_NODE_UPDATE_RECORDING,
30     CANVAS_NODE_CLEAR_RECORDING,
31 };
32 
33 #ifndef USE_ROSEN_DRAWING
34 class DrawCmdList;
35 #else
36 namespace Drawing {
37 class DrawCmdList;
38 }
39 #endif
40 
41 class RSB_EXPORT RSCanvasNodeCommandHelper {
42 public:
43     static void Create(RSContext& context, NodeId id);
44 #ifndef USE_ROSEN_DRAWING
45     static void UpdateRecording(
46         RSContext& context, NodeId id, std::shared_ptr<DrawCmdList> drawCmds, uint16_t modifierType);
47 #else
48     static void UpdateRecording(
49         RSContext& context, NodeId id, std::shared_ptr<Drawing::DrawCmdList> drawCmds, uint16_t modifierType);
50 #endif
51     static void ClearRecording(RSContext& context, NodeId id);
52 };
53 
54 ADD_COMMAND(RSCanvasNodeCreate, ARG(CANVAS_NODE, CANVAS_NODE_CREATE, RSCanvasNodeCommandHelper::Create, NodeId))
55 #ifndef USE_ROSEN_DRAWING
56 ADD_COMMAND(RSCanvasNodeUpdateRecording,
57     ARG(CANVAS_NODE, CANVAS_NODE_UPDATE_RECORDING, RSCanvasNodeCommandHelper::UpdateRecording, NodeId,
58         std::shared_ptr<DrawCmdList>, uint16_t))
59 #else
60 ADD_COMMAND(RSCanvasNodeUpdateRecording,
61     ARG(CANVAS_NODE, CANVAS_NODE_UPDATE_RECORDING, RSCanvasNodeCommandHelper::UpdateRecording, NodeId,
62         std::shared_ptr<Drawing::DrawCmdList>, uint16_t))
63 #endif
64 ADD_COMMAND(RSCanvasNodeClearRecording,
65     ARG(CANVAS_NODE, CANVAS_NODE_CLEAR_RECORDING, RSCanvasNodeCommandHelper::ClearRecording, NodeId))
66 
67 } // namespace Rosen
68 } // namespace OHOS
69 
70 #endif // ROSEN_RENDER_SERVICE_BASE_COMMAND_RS_CANVAS_NODE_COMMAND_H
71