diff options
author | Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com> | 2018-05-16 09:48:31 +0000 |
---|---|---|
committer | Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com> | 2018-05-18 15:57:15 +0900 |
commit | 443b9523b2e82352be9261d65f55bff9b0a5e4de (patch) | |
tree | 0966db2fe6dd8bae5b8f74df24e362d3b92eb0cf /src/app.cpp | |
parent | 33ee7d8a99c540749dd9691362f109c5b884e588 (diff) |
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 <tanikawa.tadao@jp.panasonic.com>
Diffstat (limited to 'src/app.cpp')
-rw-r--r-- | src/app.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/app.cpp b/src/app.cpp index e9d79f5..575ab85 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -58,7 +58,6 @@ const char kKeyHeightPixel[] = "height_pixel"; const char kKeyWidthMm[] = "width_mm"; const char kKeyHeightMm[] = "height_mm"; - namespace { using nlohmann::json; @@ -114,6 +113,10 @@ App::App(wl::display *d) } else { HMI_ERROR("wm", "%s", l.err().value()); } + + if (this->config.get_string("scaling_ignore_aspect")) { + this->layers.scaling_keep_aspect =false; + } } } catch (std::exception &e) { HMI_ERROR("wm", "Loading of configuration failed: %s", e.what()); @@ -237,11 +240,22 @@ int App::init_layers() { // Clear screen s->clear(); + int width = this->layers.main_surface_width; + int height = this->layers.main_surface_height; + + rectangle rect(width, height); // 1080x1920 by default + rect.scale(o->width, o->height, this->layers.scaling_keep_aspect); + rect.center(o->width, o->height); + + HMI_DEBUG("wm", "Main surface (0,0),%dx%d to (%d,%d),%dx%d", + width, height, rect.left(), rect.top(), rect.width(), rect.height()); + // Quick and dirty setup of layers for (auto const &i : this->layers.mapping) { - c->layer_create(i.second.layer_id, o->width, o->height); + c->layer_create(i.second.layer_id, rect.width(), rect.height()); auto &l = layers[i.second.layer_id]; - l->set_destination_rectangle(0, 0, o->width, o->height); + l->set_source_rectangle(0, 0, width, height); + l->set_destination_rectangle(rect.left(), rect.top(), rect.width(), rect.height()); l->set_visibility(1); HMI_DEBUG("wm", "Setting up layer %s (%d) for surface role match \"%s\"", i.second.name.c_str(), i.second.layer_id, i.second.role.c_str()); @@ -282,10 +296,10 @@ void App::surface_set_layout(int surface_id, optional<int> sub_surface_id) { // less-than-0 values refer to MAX + 1 - $VALUE // e.g. MAX is either screen width or height if (w < 0) { - w = this->controller->output_size.w + 1 + w; + w = this->layers.main_surface_width + 1 + w; } if (h < 0) { - h = this->controller->output_size.h + 1 + h; + h = this->layers.main_surface_height + 1 + h; } if (sub_surface_id) { |