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 INTERFACE_BITMAP_TEST_H
17 #define INTERFACE_BITMAP_TEST_H
18 #include <native_drawing/drawing_canvas.h>
19 #include <native_drawing/drawing_path.h>
20 #include <native_drawing/drawing_rect.h>
21 
22 #include "test_base.h"
23 #include "test_common.h"
24 
25 class ImageBuildFromBitmap : public TestBase {
26 public:
ImageBuildFromBitmap(int type)27     explicit ImageBuildFromBitmap(int type) : TestBase(type)
28     {
29         fileName_ = "ImageBuildFromBitmap";
30     };
~ImageBuildFromBitmap()31     ~ImageBuildFromBitmap() override {};
32 
33 protected:
34     int rectWidth_ = 0;
35     int rectHeight_ = 0;
36     void OnTestPerformance(OH_Drawing_Canvas* canvas) override;
37 };
38 
39 class BitmapReadPixels : public TestBase {
40 public:
BitmapReadPixels(int type,OH_Drawing_ColorFormat ct,OH_Drawing_AlphaFormat at)41     explicit BitmapReadPixels(int type, OH_Drawing_ColorFormat ct, OH_Drawing_AlphaFormat at)
42         : TestBase(type), fCT(ct), fAT(at)
43     {
44         fileName_ = "BitmapReadPixels";
45     };
46     ~BitmapReadPixels() override = default;
47 
48 protected:
49     OH_Drawing_ColorFormat fCT;
50     OH_Drawing_AlphaFormat fAT;
51     void OnTestPerformance(OH_Drawing_Canvas* canvas) override;
52 };
53 
54 class BitmapBuild : public TestBase {
55 public:
BitmapBuild(int type)56     explicit BitmapBuild(int type) : TestBase(type)
57     {
58         fileName_ = "BitmapBuild";
59     };
~BitmapBuild()60     ~BitmapBuild() override {};
61 
62 protected:
63     int rectWidth_ = 0;
64     int rectHeight_ = 0;
65     void OnTestPerformance(OH_Drawing_Canvas* canvas) override;
66 };
67 
68 class BitmapCreateFromPixels : public TestBase {
69 public:
BitmapCreateFromPixels(int type)70     explicit BitmapCreateFromPixels(int type) : TestBase(type)
71     {
72         fileName_ = "BitmapCreateFromPixels";
73     };
~BitmapCreateFromPixels()74     ~BitmapCreateFromPixels() override {};
75 
76 protected:
77     int rectWidth_ = 0;
78     int rectHeight_ = 0;
79     void OnTestPerformance(OH_Drawing_Canvas* canvas) override;
80 };
81 #endif // INTERFACE_BITMAP_TEST_H