gui: don't truncate values to 0 after scaling
Avoids invisible lines (e.g. input cursor) when scaling down.
Change-Id: I595e8bdb2fa468c30f104867ad77be2423ec287f
diff --git a/gui/gui.cpp b/gui/gui.cpp
index 35b33b1..f3d31d7 100644
--- a/gui/gui.cpp
+++ b/gui/gui.cpp
@@ -990,7 +990,10 @@
extern "C" int scale_theme_x(int initial_x)
{
if (scale_theme_w != 1) {
- return (int) ((float)initial_x * scale_theme_w);
+ int scaled = (float)initial_x * scale_theme_w;
+ if (scaled == 0 && initial_x > 0)
+ return 1;
+ return scaled;
}
return initial_x;
}
@@ -998,7 +1001,10 @@
extern "C" int scale_theme_y(int initial_y)
{
if (scale_theme_h != 1) {
- return (int) ((float)initial_y * scale_theme_h);
+ int scaled = (float)initial_y * scale_theme_h;
+ if (scaled == 0 && initial_y > 0)
+ return 1;
+ return scaled;
}
return initial_y;
}