1 /* 2 * Copyright (c) 2020-2021 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 GRAPHIC_LITE_MONITOR_H 17 #define GRAPHIC_LITE_MONITOR_H 18 19 #include <QtCore/qobject.h> 20 21 #include "engines/gfx/gfx_engine_manager.h" 22 #include "font/ui_font_header.h" 23 24 namespace OHOS { 25 class Monitor : public QObject, public BaseGfxEngine { 26 Q_OBJECT 27 public: Monitor()28 Monitor() : defaultColor_ (0x44) {} ~Monitor()29 virtual ~Monitor() {} 30 static Monitor* GetInstance(); 31 void InitHal(); 32 void InitFontEngine(); 33 void InitImageDecodeAbility(); 34 void InitGUI(); 35 void GUILoopStart() const; 36 void GUIRefresh(); 37 void GUILoopQuit() const; 38 void Flush() override; 39 BufferInfo* GetFBBufferInfo() override; 40 signals: 41 void UpdatePaintSignal(uint32_t* tftFb, uint32_t imgWidth, uint32_t imgHeight); 42 43 protected: UpdatePaint(uint32_t * tftFb,uint32_t imgWidth,uint32_t imgHeight)44 void UpdatePaint(uint32_t* tftFb, uint32_t imgWidth, uint32_t imgHeight) 45 { 46 emit UpdatePaintSignal(tftFb, imgWidth, imgHeight); 47 } 48 49 private: 50 static constexpr uint32_t GUI_REFR_PERIOD = 50; /* ms */ 51 uint8_t fontPsramBaseAddr_[MIN_FONT_PSRAM_LENGTH]; 52 uint32_t tftFb_[HORIZONTAL_RESOLUTION * VERTICAL_RESOLUTION]; 53 uint32_t animaterBuffer_[HORIZONTAL_RESOLUTION * VERTICAL_RESOLUTION]; 54 uint32_t defaultColor_; 55 static bool isRegister_; 56 }; 57 } // namespace OHOS 58 59 #endif // GRAPHIC_LITE_MONITOR_H 60