diff options
author | 2018-08-27 14:36:41 +0900 | |
---|---|---|
committer | 2018-08-27 19:16:52 +0900 | |
commit | 0a414d1909a0f356e195d81593eb6b50d470daab (patch) | |
tree | 3e53d30aeb098a8f404da735b55ba85464a8b2ca /src | |
parent | 0b011c00b0c8aa847a4d0aa460a335c5eae8f010 (diff) |
Implement setup/getArea
Move from layers.cpp
Change-Id: I3fba732b09272b45d1cb7ca7f9457777dd53fdad
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
Diffstat (limited to 'src')
-rw-r--r-- | src/wm_layer_control.cpp | 30 | ||||
-rw-r--r-- | 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<int>(scaling * i.second.x + 0.5);
+ i.second.y = static_cast<int>(scaling * i.second.y + 0.5);
+ i.second.w = static_cast<int>(scaling * i.second.w + 0.5);
+ i.second.h = static_cast<int>(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<unsigned> layer_render_order);
// std::vector<unsigned> getAllRenderOrder();
// std::vector<std::shared_ptr<WMLayer>>& getAllLayers();
|