1 /*
2  * Copyright (c) 2024 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_BASE_CORE_PIPELINE_RS_RECORD_CMD_UTILS_H
17 #define RENDER_SERVICE_BASE_CORE_PIPELINE_RS_RECORD_CMD_UTILS_H
18 
19 #include <memory>
20 #include "recording/record_cmd.h"
21 
22 namespace OHOS {
23 
24 namespace Rosen {
25 class ExtendRecordingCanvas;
26 class RSB_EXPORT RSRecordCmdUtils {
27 public:
28     RSRecordCmdUtils();
~RSRecordCmdUtils()29     ~RSRecordCmdUtils() {};
30     /**
31      * @brief Returns the canvas that records the drawing commands.
32      * @param bounds the cull rect used when recording this recordcmd. Any drawing the falls outside
33      * of this rect is undefined, and may be drawn or it may not.
34      * @return pointer to ExtendRecordingCanvas, it will be released after FinishRecording is called,
35      * and can't be used any more.
36      */
37     Drawing::Canvas* BeginRecording(Drawing::Rect& bounds);
38 
39     /**
40      * @brief Returns the recordcmd that records the drawing commands.
41      * @return A shared pointer to RecordCmd
42      */
43     std::shared_ptr<Drawing::RecordCmd> FinishRecording();
44 private:
45     std::shared_ptr<ExtendRecordingCanvas> extendRecordingCanvas_;
46     Drawing::Rect cullRect_;
47 };
48 } // namespace Rosen
49 } // namespace OHOS
50 #endif // RENDER_SERVICE_BASE_CORE_PIPELINE_RS_RECORD_CMD_UTILS_H
51