• 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 
16 #ifndef RENDER_SERVICE_CLIENT_CORE_PIPELINE_RS_DRAW_CMD_LIST_H
17 #define RENDER_SERVICE_CLIENT_CORE_PIPELINE_RS_DRAW_CMD_LIST_H
18 
19 #include <memory>
20 #include <mutex>
21 #include <vector>
22 
23 #include "common/rs_common_def.h"
24 
25 class SkCanvas;
26 struct SkRect;
27 namespace OHOS {
28 namespace Rosen {
29 class OpItem;
30 class RSPaintFilterCanvas;
31 
32 class DrawCmdList {
33 public:
34     DrawCmdList(int w, int h);
35     DrawCmdList& operator=(DrawCmdList&& that);
36     virtual ~DrawCmdList();
37 
38     void AddOp(std::unique_ptr<OpItem>&& op);
39     void ClearOp();
40 
41     void Playback(SkCanvas& canvas, const SkRect* rect = nullptr) const;
42     void Playback(RSPaintFilterCanvas& canvas, const SkRect* rect = nullptr) const;
43 
44     int GetSize() const;
45     int GetWidth() const;
46     int GetHeight() const;
47 
48 private:
49     std::vector<std::unique_ptr<OpItem>> ops_;
50     std::recursive_mutex mutex_;
51     int width_;
52     int height_;
53 };
54 } // namespace Rosen
55 } // namespace OHOS
56 
57 #endif // RENDER_SERVICE_CLIENT_CORE_PIPELINE_RS_DRAW_CMD_LIST_H
58