From 0a414d1909a0f356e195d81593eb6b50d470daab Mon Sep 17 00:00:00 2001 From: Kazumasa Mitsunari Date: Mon, 27 Aug 2018 14:36:41 +0900 Subject: Implement setup/getArea Move from layers.cpp Change-Id: I3fba732b09272b45d1cb7ca7f9457777dd53fdad Signed-off-by: Kazumasa Mitsunari --- src/wm_layer_control.cpp | 30 ++++++++++++++++++++++++++++++ src/wm_layer_control.hpp | 16 ++++++++++++++-- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/src/wm_layer_control.cpp b/src/wm_layer_control.cpp index 72a3a19..0e72fab 100644 --- a/src/wm_layer_control.cpp +++ b/src/wm_layer_control.cpp @@ -126,6 +126,36 @@ unsigned LayerControl::getNewLayerID(const string& role) return ret; } +struct rect LayerControl::getAreaSize(const std::string& area) +{ + return area2size[area]; +} + +void LayerControl::setupArea(double scaling) +{ + struct rect rct; + + rct = this->area2size["normal.full"]; + this->area2size["normalfull"] = rct; + this->area2size["normal"] = rct; + + for (auto &i : this->area2size) + { + i.second.x = static_cast(scaling * i.second.x + 0.5); + i.second.y = static_cast(scaling * i.second.y + 0.5); + i.second.w = static_cast(scaling * i.second.w + 0.5); + i.second.h = static_cast(scaling * i.second.h + 0.5); + + HMI_DEBUG("wm:lm", "area:%s size(after) : x:%d y:%d w:%d h:%d", + i.first.c_str(), i.second.x, i.second.y, i.second.w, i.second.h); + } +} + +Screen LayerControl::getScreenInfo() +{ + return Screen(this->screen_prop.screenWidth, this->screen_prop.screenHeight); +} + WMError LayerControl::updateLayer(LayerState& layer_state) { return WMError::SUCCESS; diff --git a/src/wm_layer_control.hpp b/src/wm_layer_control.hpp index ad6bf53..647a5c7 100644 --- a/src/wm_layer_control.hpp +++ b/src/wm_layer_control.hpp @@ -25,8 +25,17 @@ namespace wm { -class Screen : public rectangle { - +class Screen { + public: + Screen(unsigned w, unsigned h); + ~Screen(); + unsigned width() { return _width; } + unsigned height() { return _height; } + private: + unsigned _width; + unsigned _height; + unsigned _pysical_width = 0; + unsigned _pysical_height = 0; }; class LayerControlCallbacks { @@ -52,6 +61,9 @@ class LayerControl ~LayerControl() = default; WMError init(const LayerControlCallbacks& cb); unsigned getNewLayerID(const std::string& role); + struct rect getAreaSize(const std::string& area); + void setupArea(double scaling); + Screen getScreenInfo(); // void setRenderOrder(const std::vector layer_render_order); // std::vector getAllRenderOrder(); // std::vector>& getAllLayers(); -- cgit 1.2.3-korg