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

N
niulihua 已提交
19
#include "engines/gfx/gfx_engine_manager.h"
M
mamingshuai 已提交
20
#include "font/ui_font_header.h"
N
niulihua 已提交
21
#include <QtCore/qobject.h>
M
mamingshuai 已提交
22 23

namespace OHOS {
N
niulihua 已提交
24
class Monitor : public QObject, public BaseGfxEngine {
M
mamingshuai 已提交
25 26 27 28
    Q_OBJECT
public:
    Monitor() : defaultColor_ (0x44) {}
    virtual ~Monitor() {}
Z
zhdengc 已提交
29
    static Monitor* GetInstance();
M
mamingshuai 已提交
30 31 32 33 34 35 36
    void InitHal();
    void InitFontEngine();
    void InitImageDecodeAbility();
    void InitGUI();
    void GUILoopStart() const;
    void GUIRefresh();
    void GUILoopQuit() const;
N
niulihua 已提交
37 38
    void Flush() override;
    BufferInfo* GetBufferInfo() override;
M
mamingshuai 已提交
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
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 已提交
54
    static bool isRegister_;
M
mamingshuai 已提交
55 56 57 58
};
} // namespace OHOS

#endif // GRAPHIC_LITE_MONITOR_H