From 443b9523b2e82352be9261d65f55bff9b0a5e4de Mon Sep 17 00:00:00 2001 From: Tadao Tanikawa Date: Wed, 16 May 2018 09:48:31 +0000 Subject: Enable scaling to fit various screen resolutions Since the AGL HomeScreen of CES2018 assumes that the screen resolution is 1080x1920px, the graphics of it partially corrupted with others. To fix this issue, now the AGL window manager automatically scales size of HomeScreen to fit the resolution of the display. By default, this scaling keeps HomeScreen's original aspect rate (9:16). To ignore it, set the environment variable, 'HMI_SCALING_IGNORE_ASPECT'. (E.g. set it in any file under /etc/afm/unit.env.d/) Bug-AGL: SPEC-1138 Change-Id: Id11a07560fe254712aaab42018bfb4d1d87ad1df Signed-off-by: Tadao Tanikawa --- src/util.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/util.hpp') diff --git a/src/util.hpp b/src/util.hpp index f4e6e5f..6c6d0b9 100644 --- a/src/util.hpp +++ b/src/util.hpp @@ -103,4 +103,22 @@ struct unique_fd { } }; +class rectangle +{ +public: + explicit rectangle(int wd, int ht) : w(wd), h(ht) {}; + void scale(int to_w, int to_h, bool keep_aspect); + void center(int outer_w, int outer_h); + int left() { return x; }; + int top() { return y; }; + int width() { return w; }; + int height() { return h; }; + +private: + int x = 0; + int y = 0; + int w; + int h; +}; + #endif // !WM_UTIL_HPP -- cgit 1.2.3-korg