From 125ef4c1e21f0c15be63eaf06fd5780a1f9f643d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=82=AC?= Date: Tue, 25 Feb 2025 08:32:40 +0000 Subject: [PATCH] =?UTF-8?q?updater=E7=95=8C=E9=9D=A2=E5=85=B3=E6=9C=BA?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E8=AE=BE=E7=BD=AE=E4=BA=AE=E5=BA=A6=E6=98=AF?= =?UTF-8?q?0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 黄悬 --- services/ui/driver/graphic_engine.cpp | 22 ++++++++++++++++++---- services/ui/driver/graphic_engine.h | 3 +++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/services/ui/driver/graphic_engine.cpp b/services/ui/driver/graphic_engine.cpp index 58fa48b5..a2a05d7f 100644 --- a/services/ui/driver/graphic_engine.cpp +++ b/services/ui/driver/graphic_engine.cpp @@ -102,6 +102,11 @@ __attribute__((weak)) void InitFlushBatteryStatusExt(void) { } +__attribute__((weak)) void SetBrightness(int value) +{ + LOG(INFO) << "not pc, not set backlight"; +} + void GraphicEngine::FlushThreadLoop() const { while (!flushStop_) { @@ -110,14 +115,23 @@ void GraphicEngine::FlushThreadLoop() const Utils::UsSleep(sleepTime_); } // clear screen after stop - UiRotation::GetInstance().SetDegree(UI_ROTATION_DEGREE::UI_ROTATION_0); - uint8_t pixelBytes = OHOS::DrawUtils::GetByteSizeByColorMode(colorMode_); - (void)memset_s(buffInfo_->virAddr, width_ * height_ * pixelBytes, 0, width_ * height_ * pixelBytes); - sfDev_->Flip(reinterpret_cast(buffInfo_->virAddr)); + LOG(INFO) << "disable clear stop stopClear_ = " << stopClear_; + if (stopClear_) { + UiRotation::GetInstance().SetDegree(UI_ROTATION_DEGREE::UI_ROTATION_0); + uint8_t pixelBytes = OHOS::DrawUtils::GetByteSizeByColorMode(colorMode_); + (void)memset_s(buffInfo_->virAddr, width_ * height_ * pixelBytes, 0, width_ * height_ * pixelBytes); + sfDev_->Flip(reinterpret_cast(buffInfo_->virAddr)); + } +} + +void GraphicEngine::DisableClearStop(void) +{ + stopClear_ = false; } void GraphicEngine::StopEngine(void) { + SetBrightness(0); flushStop_ = true; Utils::UsSleep(THREAD_USLEEP_TIME * 10); // 10: wait for stop 100ms } diff --git a/services/ui/driver/graphic_engine.h b/services/ui/driver/graphic_engine.h index 523425d7..9a7ba6e0 100644 --- a/services/ui/driver/graphic_engine.h +++ b/services/ui/driver/graphic_engine.h @@ -38,6 +38,7 @@ public: uint16_t GetScreenHeight() override; void StopEngine(void); void SetSleepTime(uint32_t sleepTime); + void DisableClearStop(void); private: void FlushThreadLoop() const; void InitFontEngine(const char *fontPath) const; @@ -52,6 +53,7 @@ private: uint16_t width_ = 0; uint8_t colorMode_ = 0; bool flushStop_ = true; + bool stopClear_ = true; uint32_t sleepTime_ = THREAD_USLEEP_TIME; std::mutex mtx_ {}; }; @@ -63,6 +65,7 @@ extern "C" { #endif /* __cplusplus */ void InitFlushBatteryStatusExt(void); void PostInitSurfDev(std::unique_ptr &surfDev, GrSurface &surface); +void SetBrightness(int value); #ifdef __cplusplus #if __cplusplus } -- Gitee