From 744df8b7c6ccb4e2254e452eec82f5d0703417cf Mon Sep 17 00:00:00 2001 From: Tadao Tanikawa Date: Tue, 31 Jul 2018 01:33:02 +0000 Subject: Add an interface to scalable rendering with multiple resolution To support rendering which fits screen resolution, new class AGLScreenInfo is introduced to get 'scale_factor' from AGL HMI framework. If AGL HMI framework doesn't support multi-resolution, scale is set 1.0 for backward compatibility. Bug-AGL: SPEC-1611 Change-Id: I1dc4dd13c17ae66a706b6fd8ef937fbaab937c9e Signed-off-by: Tadao Tanikawa --- src/qlibwindowmanager.cpp | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'src/qlibwindowmanager.cpp') diff --git a/src/qlibwindowmanager.cpp b/src/qlibwindowmanager.cpp index b264c94..df17f47 100644 --- a/src/qlibwindowmanager.cpp +++ b/src/qlibwindowmanager.cpp @@ -28,7 +28,37 @@ using namespace std; int QLibWindowmanager::init(int port, const QString &token) { string ctoken = token.toStdString(); - return this->wm->init(port, ctoken.c_str()); + int ret_init = this->wm->init(port, ctoken.c_str()); + + // initialize dpyinfo + json_object *obj = json_object_new_object(); + + int ret = this->wm->getDisplayInfo(obj); + + this->screen_info = new AGLScreenInfoPrivate; + + if (!ret) { + json_object *j_val; + if (json_object_object_get_ex(obj, "width_pixel", &j_val)) { + this->screen_info->set_width_dp(json_object_get_double(j_val)); + } + if (json_object_object_get_ex(obj, "height_pixel", &j_val)) { + this->screen_info->set_height_dp(json_object_get_double(j_val)); + } + if (json_object_object_get_ex(obj, "width_mm", &j_val)) { + this->screen_info->set_width_mm(json_object_get_double(j_val)); + } + if (json_object_object_get_ex(obj, "height_mm", &j_val)) { + this->screen_info->set_height_mm(json_object_get_double(j_val)); + } + if (json_object_object_get_ex(obj, "scale", &j_val)) { + this->screen_info->set_scale_factor(json_object_get_double(j_val)); + } + } + + json_object_put(obj); + + return ret_init; } int QLibWindowmanager::requestSurface(const QString &label) { @@ -120,7 +150,7 @@ void QLibWindowmanager::slotActivateSurface(){ } QLibWindowmanager::QLibWindowmanager(QObject *parent) - :QObject(parent), isActive(false) + :QObject(parent), isActive(false), screen_info(nullptr) { wm = new LibWindowmanager(); } -- cgit 1.2.3-korg