From ba75a0e73bf23261b16abf858853578ea65576f8 Mon Sep 17 00:00:00 2001 From: that Date: Sat, 14 Feb 2015 21:20:10 +0100 Subject: gui: don't truncate values to 0 after scaling Avoids invisible lines (e.g. input cursor) when scaling down. Change-Id: I595e8bdb2fa468c30f104867ad77be2423ec287f --- gui/gui.cpp | 10 ++++++++-- gui/gui.h | 1 - gui/objects.hpp | 1 - 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gui/gui.cpp b/gui/gui.cpp index 35b33b10c..f3d31d7b3 100644 --- a/gui/gui.cpp +++ b/gui/gui.cpp @@ -990,7 +990,10 @@ extern "C" void set_scale_values(float w, float h) 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_x(int initial_x) 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; } diff --git a/gui/gui.h b/gui/gui.h index 37d205408..f6f0483a4 100644 --- a/gui/gui.h +++ b/gui/gui.h @@ -37,7 +37,6 @@ int scale_theme_y(int initial_y); int scale_theme_min(int initial_value); float get_scale_w(); float get_scale_h(); -float get_scale_h(); #endif // _GUI_HEADER diff --git a/gui/objects.hpp b/gui/objects.hpp index 00770b378..0f853ac59 100644 --- a/gui/objects.hpp +++ b/gui/objects.hpp @@ -893,7 +893,6 @@ protected: class GUIInput : public GUIObject, public RenderObject, public ActionObject, public InputObject { public: - // w and h may be ignored, in which case, no bounding box is applied GUIInput(xml_node<>* node); virtual ~GUIInput(); -- cgit v1.2.3