monitor.h 1.8 KB
Newer Older
M
mamingshuai 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/*
 * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef GRAPHIC_LITE_MONITOR_H
#define GRAPHIC_LITE_MONITOR_H

W
wangtiantian 已提交
19 20
#include <QtCore/qobject.h>

N
niulihua 已提交
21
#include "engines/gfx/gfx_engine_manager.h"
M
mamingshuai 已提交
22 23 24
#include "font/ui_font_header.h"

namespace OHOS {
N
niulihua 已提交
25
class Monitor : public QObject, public BaseGfxEngine {
M
mamingshuai 已提交
26
    Q_OBJECT
27

M
mamingshuai 已提交
28 29 30
public:
    Monitor() : defaultColor_ (0x44) {}
    virtual ~Monitor() {}
Z
zhdengc 已提交
31
    static Monitor* GetInstance();
M
mamingshuai 已提交
32 33 34 35 36 37 38
    void InitHal();
    void InitFontEngine();
    void InitImageDecodeAbility();
    void InitGUI();
    void GUILoopStart() const;
    void GUIRefresh();
    void GUILoopQuit() const;
N
niulihua 已提交
39
    void Flush() override;
N
niulihua 已提交
40
    BufferInfo* GetFBBufferInfo() override;
M
mamingshuai 已提交
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
signals:
    void UpdatePaintSignal(uint32_t* tftFb, uint32_t imgWidth, uint32_t imgHeight);

protected:
    void UpdatePaint(uint32_t* tftFb, uint32_t imgWidth, uint32_t imgHeight)
    {
        emit UpdatePaintSignal(tftFb, imgWidth, imgHeight);
    }

private:
    static constexpr uint32_t GUI_REFR_PERIOD  = 50; /* ms */
    uint8_t fontPsramBaseAddr_[MIN_FONT_PSRAM_LENGTH];
    uint32_t tftFb_[HORIZONTAL_RESOLUTION * VERTICAL_RESOLUTION];
    uint32_t animaterBuffer_[HORIZONTAL_RESOLUTION * VERTICAL_RESOLUTION];
    uint32_t defaultColor_;
N
niulihua 已提交
56
    static bool isRegister_;
M
mamingshuai 已提交
57 58 59 60
};
} // namespace OHOS

#endif // GRAPHIC_LITE_MONITOR_H