diff --git a/interfaces/kits/include/misc_info/misc_info.h b/interfaces/kits/include/misc_info/misc_info.h index 8b260fcaa90b53737c65521daf8b234490981b10..38f781fd0587162ee6c24bec5f31138cee882cbe 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]; diff --git a/services/ui/progress_bar.cpp b/services/ui/progress_bar.cpp index 37109d840f4116732626f98a6af706b5ddafc16a..4b8f044d4228a2c35edcd9c0bee731dcc42260d3 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 100139718ed003cf0f2c1884d53078a6eed2ebc4..e0edd9e7cd04e6f7b9e083187d3d987e885614d7 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(); + void DrawBackground(); BRGA888Pixel progressColor_ {}; BRGA888Pixel normalColor_ {}; int pValue_ { 0 };