• 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 UPDATER_UI_SURFACE_DEV_H
17 #define UPDATER_UI_SURFACE_DEV_H
18 #include <string>
19 #include "macros.h"
20 #include "graphic_drv.h"
21 
22 namespace Updater {
23 enum class DevType {
24     FB_DEVICE = 0,
25     DRM_DEVICE,
26     UNKNOW_DEVICE
27 };
28 
29 class SurfaceDev {
30     DISALLOW_COPY_MOVE(SurfaceDev);
31 public:
32     SurfaceDev() = default;
33     ~SurfaceDev();
34     void Flip(const uint8_t* buf) const;
35     void GetScreenSize(uint16_t &w, uint16_t &h) const;
36     bool Init();
37 private:
38     DevType GetDevType() const;
39     std::unique_ptr<GraphicDrv> MakeDevDrv(DevType devType);
40     std::unique_ptr<GraphicDrv> drv_ {};
41 };
42 } // namespace Updater
43 #endif
44