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