From 2b8dfeef59ffa7cc0fa5bc62ae95a24139f9fedb Mon Sep 17 00:00:00 2001 From: runsys Date: Sun, 24 Oct 2021 01:58:30 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20PNG=20transparency=20not=20working=20?= =?UTF-8?q?=F0=9F=99=82=20(#878)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Force BitmapBuffer format for widget ModelBmp and the file viewer This patch run with the patch fix-transpareny in libopenui * Bump libopenui Co-authored-by: Runsys16 --- radio/src/gui/colorlcd/file_preview.h | 1 + radio/src/gui/colorlcd/widgets/modelbmp.cpp | 5 +++-- radio/src/thirdparty/libopenui | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/radio/src/gui/colorlcd/file_preview.h b/radio/src/gui/colorlcd/file_preview.h index 04202b755..56188c1e3 100644 --- a/radio/src/gui/colorlcd/file_preview.h +++ b/radio/src/gui/colorlcd/file_preview.h @@ -51,6 +51,7 @@ class FilePreview : public Window void paint(BitmapBuffer *dc) override { + dc->setFormat(BMP_RGB565); coord_t y = parent->getScrollPositionY() + 2; coord_t h = MENU_BODY_HEIGHT - 4; if (bitmap) { diff --git a/radio/src/gui/colorlcd/widgets/modelbmp.cpp b/radio/src/gui/colorlcd/widgets/modelbmp.cpp index 4942a52bf..976478a5b 100644 --- a/radio/src/gui/colorlcd/widgets/modelbmp.cpp +++ b/radio/src/gui/colorlcd/widgets/modelbmp.cpp @@ -35,6 +35,7 @@ class ModelBitmapWidget: public Widget void refresh(BitmapBuffer * dc) override { + dc->setFormat(BMP_ARGB4444); if (buffer && ((buffer->width() != width()) || (buffer->height() != height()) || (deps_hash != getHash()))) { @@ -88,10 +89,10 @@ class ModelBitmapWidget: public Widget std::string fullpath = std::string(BITMAPS_PATH PATH_SEPARATOR) + filename; if (!buffer || (buffer->width() != width()) || (buffer->height() != height())) { - buffer.reset(new BitmapBuffer(BMP_RGB565, width(), height())); + buffer.reset(new BitmapBuffer(BMP_ARGB4444, width(), height())); } - buffer->clear(COLOR_THEME_SECONDARY3); + buffer->clear(); if (!filename.empty()) { std::unique_ptr bitmap(BitmapBuffer::loadBitmap(fullpath.c_str())); if (!bitmap) { diff --git a/radio/src/thirdparty/libopenui b/radio/src/thirdparty/libopenui index 6d620a285..25e60eac2 160000 --- a/radio/src/thirdparty/libopenui +++ b/radio/src/thirdparty/libopenui @@ -1 +1 @@ -Subproject commit 6d620a2853496a9fbb459e6b7d55c74c15743852 +Subproject commit 25e60eac200b0dbc7a9c28bf496081a50bd58637