From 869bcc09b70f18c31bbd3371c84b05b3dac36540 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Sat, 19 Jun 2021 17:05:55 +0200 Subject: [PATCH] Fix displaying ModelBmp on small surfaces Resolves #269 --- radio/src/gui/colorlcd/widgets/modelbmp.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/radio/src/gui/colorlcd/widgets/modelbmp.cpp b/radio/src/gui/colorlcd/widgets/modelbmp.cpp index daf5977f7..3eee954d0 100644 --- a/radio/src/gui/colorlcd/widgets/modelbmp.cpp +++ b/radio/src/gui/colorlcd/widgets/modelbmp.cpp @@ -97,7 +97,12 @@ class ModelBitmapWidget: public Widget TRACE("could not load bitmap '%s'", filename.c_str()); return; } - buffer->drawScaledBitmap(bitmap.get(), 0, 38, width(), height() - 38); + + if (rect.h >= 96 && rect.w >= 120) { + buffer->drawScaledBitmap(bitmap.get(), 0, 38, width(), height() - 38); + } else { + buffer->drawScaledBitmap(bitmap.get(), 0, 0, width(), height()); + } } } };