1 /*
2  * Copyright (c) 2022-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 SKIACANVAS_OP_H
17 #define SKIACANVAS_OP_H
18 
19 #include "include/utils/SkNWayCanvas.h"
20 #include "include/core/SkCanvasVirtualEnforcer.h"
21 
22 namespace OHOS {
23 namespace Rosen {
24 namespace Drawing {
25 class SkiaCanvasOp : public SkCanvasVirtualEnforcer<SkNWayCanvas> {
26 public:
SkiaCanvasOp(SkCanvas * canvas)27     explicit SkiaCanvasOp(SkCanvas* canvas)
28         : SkCanvasVirtualEnforcer<SkNWayCanvas>(canvas->imageInfo().width(),
29         canvas->imageInfo().height()) {}
30 
31     virtual ~SkiaCanvasOp() = default;
32 
OpCanCache(const SkRect & bound)33     virtual bool OpCanCache(const SkRect& bound)
34     {
35         return false;
36     }
37 
GetOpListDrawArea()38     virtual std::vector<SkRect>& GetOpListDrawArea()
39     {
40         static std::vector<SkRect> defaultRects;
41         return defaultRects;
42     }
43 
GetOpUnionRect()44     virtual SkRect& GetOpUnionRect()
45     {
46         static SkRect defaultRect;
47         return defaultRect;
48     }
49 
GetOpsNum()50     virtual int GetOpsNum()
51     {
52         return 0;
53     }
54 
GetOpsPercent()55     virtual int GetOpsPercent()
56     {
57         return 0;
58     }
59 };
60 } // namespace Drawing
61 } // namespace Rosen
62 } // namespace OHOS
63 #endif
64