From 6335b55cdd7fd46ceac08581ea92a95f12141d74 Mon Sep 17 00:00:00 2001 From: zhong_ning Date: Tue, 19 Oct 2021 15:20:03 +0800 Subject: [PATCH 1/3] add init logo to misc Signed-off-by: zhong_ning --- interfaces/kits/include/misc_info/misc_info.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/interfaces/kits/include/misc_info/misc_info.h b/interfaces/kits/include/misc_info/misc_info.h index 8b260fca..38f781fd 100755 --- a/interfaces/kits/include/misc_info/misc_info.h +++ b/interfaces/kits/include/misc_info/misc_info.h @@ -23,9 +23,9 @@ namespace updater { constexpr int MAX_COMMAND_SIZE = 20; constexpr int MAX_UPDATE_SIZE = 100; +constexpr int MAX_LOGO_SIZE = 1024 * 2038; - -// misc partition offset definition. max size of misc is 1MB, do not overflow. +// misc partition offset definition. max size of misc is 2MB, do not overflow. constexpr off_t MISC_BASE_OFFSET = 0; constexpr off_t MISC_UPDATE_MESSAGE_OFFSET = MISC_BASE_OFFSET; @@ -37,6 +37,9 @@ constexpr off_t MISC_PARTITION_RECORD_SIZE = 1024; constexpr off_t MISC_RECORD_UPDATE_PARTITIONS_OFFSET = MISC_PARTITION_RECORD_OFFSET + MISC_PARTITION_RECORD_SIZE; constexpr off_t MISC_RECORD_UPDATE_PARTITIONS_SIZE = 256; +constexpr off_t MISC_RECORD_MISC_PARTITIONS_OFFSET = 1536; +constexpr off_t MISC_RECORD_MISC_PARTITIONS_SIZE = 1024 * 2038; + struct UpdateMessage { char command[MAX_COMMAND_SIZE]; char update[MAX_UPDATE_SIZE]; -- Gitee From efc5f9bf74dcbb6071066f50872d3aa05ba02679 Mon Sep 17 00:00:00 2001 From: sun_fan Date: Tue, 19 Oct 2021 17:59:34 +0800 Subject: [PATCH 2/3] updater: fix background colour Signed-off-by: sun_fan --- services/ui/progress_bar.cpp | 28 ++++++++++++++++++++++++---- services/ui/progress_bar.h | 1 + 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/services/ui/progress_bar.cpp b/services/ui/progress_bar.cpp index 37109d84..4b8f044d 100644 --- a/services/ui/progress_bar.cpp +++ b/services/ui/progress_bar.cpp @@ -20,7 +20,6 @@ #include "securec.h" namespace updater { -constexpr int DEFAULT_PROGRESS_COLOR_A = 0xCC; constexpr int DEFAULT_NORMAL_COLOR = 0xFF; constexpr int MAX_PROGRESS_VALUE = 100; constexpr uint32_t DEFAULT_PROGRESS_COLOR = 0x00; @@ -39,8 +38,9 @@ ProgressBar::ProgressBar(const int mStartX, const int mStartY, const int w, cons progressColor_.a = DEFAULT_NORMAL_COLOR; normalColor_.r = DEFAULT_PROGRESS_COLOR; normalColor_.g = DEFAULT_PROGRESS_COLOR; - normalColor_.b = DEFAULT_PROGRESS_COLOR; - normalColor_.a = DEFAULT_PROGRESS_COLOR_A; + normalColor_.b = DEFAULT_NORMAL_COLOR; + normalColor_.a = DEFAULT_NORMAL_COLOR; + DrawBackground(); } void ProgressBar::SetProgressValue(int value) @@ -82,6 +82,7 @@ void ProgressBar::DrawProgress() void ProgressBar::OnDraw() { SyncBuffer(); + DrawBackground(); DrawProgress(); if (parent_ != nullptr) { parent_->OnDraw(); @@ -90,4 +91,23 @@ void ProgressBar::OnDraw() } return; } -} // namespace updater \ No newline at end of file + +void ProgressBar::DrawBackground() +{ + int ret = 0; + char *tmpBuf = static_cast(GetBuffer()); + BRGA888Pixel pixBuf[viewWidth_]; + for (int a = 0; a < viewWidth_; a++) { + pixBuf[a].r = normalColor_.r; + pixBuf[a].g = normalColor_.g; + pixBuf[a].b = normalColor_.b; + pixBuf[a].a = normalColor_.a; + } + for (int i = 0; i < viewHeight_; i++) { + ret = memcpy_s(tmpBuf + i * viewWidth_ * sizeof(BRGA888Pixel), viewWidth_ * sizeof(BRGA888Pixel) + 1, + reinterpret_cast(pixBuf), viewWidth_ * sizeof(BRGA888Pixel)); + UPDATER_ERROR_CHECK(ret == 0, "memcpy_s error", break); + } + return; +} +} // namespace updater diff --git a/services/ui/progress_bar.h b/services/ui/progress_bar.h index 10013971..e1f18e28 100644 --- a/services/ui/progress_bar.h +++ b/services/ui/progress_bar.h @@ -27,6 +27,7 @@ public: void SetProgressValue(int value); private: void DrawProgress(); + DrawBackground(); BRGA888Pixel progressColor_ {}; BRGA888Pixel normalColor_ {}; int pValue_ { 0 }; -- Gitee From cada48212afdf2f57f6a137d0faf3e2725e04ddf Mon Sep 17 00:00:00 2001 From: sun_fan Date: Tue, 19 Oct 2021 18:12:26 +0800 Subject: [PATCH 3/3] updater: fix bugs Signed-off-by: sun_fan --- services/ui/progress_bar.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/ui/progress_bar.h b/services/ui/progress_bar.h index e1f18e28..e0edd9e7 100644 --- a/services/ui/progress_bar.h +++ b/services/ui/progress_bar.h @@ -27,7 +27,7 @@ public: void SetProgressValue(int value); private: void DrawProgress(); - DrawBackground(); + void DrawBackground(); BRGA888Pixel progressColor_ {}; BRGA888Pixel normalColor_ {}; int pValue_ { 0 }; -- Gitee