• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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 HDI_COMPOSITION_CHECK_H
17 #define HDI_COMPOSITION_CHECK_H
18 #include "display_type.h"
19 #include "hdi_device_test.h"
20 
21 namespace OHOS {
22 namespace HDI {
23 namespace DISPLAY {
24 namespace TEST {
25 struct Point {
26     int32_t x = 0;
27     int32_t y = 0;
28 };
29 
30 class HdiCompositionCheck {
31 public:
GetInstance()32     static HdiCompositionCheck &GetInstance()
33     {
34         static HdiCompositionCheck instace = HdiCompositionCheck();
35         return instace;
36     }
Init(uint32_t w,uint32_t h)37     void Init(uint32_t w, uint32_t h)
38     {
39         mDispW = w;
40         mDispH = h;
41     }
42     enum Check{
43         CHECK_CENTER,
44         CHECK_VERTEX
45     };
46     int32_t Check(std::vector<LayerSettings> &layers, BufferHandle &clientBuffer, uint32_t checkType = CHECK_VERTEX);
47 
48 private:
49     static void GetCheckPoints(Point center, std::vector<Point> &points);
50     static void SimpleHandleAlpha(const LayerSettings &layers, uint32_t &color);
51     std::vector<uint32_t> GetCheckColors(std::vector<LayerSettings> &layers, const std::vector<Point> &points);
HdiCompositionCheck()52     HdiCompositionCheck() {}
~HdiCompositionCheck()53     ~HdiCompositionCheck() {}
54     uint32_t mDispW = 0;
55     uint32_t mDispH = 0;
56 };
57 } // OHOS
58 } // HDI
59 } // DISPLAY
60 } // TEST
61 
62 #endif // HDI_COMPOSITION_CHECK_H