Implement setup/getArea
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Mon, 27 Aug 2018 05:36:41 +0000 (14:36 +0900)
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Mon, 27 Aug 2018 10:16:52 +0000 (19:16 +0900)
Move from layers.cpp

Change-Id: I3fba732b09272b45d1cb7ca7f9457777dd53fdad
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
src/wm_layer_control.cpp
src/wm_layer_control.hpp

index 72a3a19..0e72fab 100644 (file)
@@ -126,6 +126,36 @@ unsigned LayerControl::getNewLayerID(const string& role)
     return ret;\r
 }\r
 \r
+struct rect LayerControl::getAreaSize(const std::string& area)\r
+{\r
+    return area2size[area];\r
+}\r
+\r
+void LayerControl::setupArea(double scaling)\r
+{\r
+    struct rect rct;\r
+\r
+    rct = this->area2size["normal.full"];\r
+    this->area2size["normalfull"] = rct;\r
+    this->area2size["normal"] = rct;\r
+\r
+    for (auto &i : this->area2size)\r
+    {\r
+        i.second.x = static_cast<int>(scaling * i.second.x + 0.5);\r
+        i.second.y = static_cast<int>(scaling * i.second.y + 0.5);\r
+        i.second.w = static_cast<int>(scaling * i.second.w + 0.5);\r
+        i.second.h = static_cast<int>(scaling * i.second.h + 0.5);\r
+\r
+        HMI_DEBUG("wm:lm", "area:%s size(after) : x:%d y:%d w:%d h:%d",\r
+            i.first.c_str(), i.second.x, i.second.y, i.second.w, i.second.h);\r
+    }\r
+}\r
+\r
+Screen LayerControl::getScreenInfo()\r
+{\r
+    return Screen(this->screen_prop.screenWidth, this->screen_prop.screenHeight);\r
+}\r
+\r
 WMError LayerControl::updateLayer(LayerState& layer_state)\r
 {\r
     return WMError::SUCCESS;\r
index ad6bf53..647a5c7 100644 (file)
 \r
 namespace wm {\r
 \r
-class Screen : public rectangle {\r
-\r
+class Screen {\r
+  public:\r
+    Screen(unsigned w, unsigned h);\r
+    ~Screen();\r
+    unsigned width() { return _width; }\r
+    unsigned height() { return _height; }\r
+  private:\r
+    unsigned _width;\r
+    unsigned _height;\r
+    unsigned _pysical_width = 0;\r
+    unsigned _pysical_height = 0;\r
 };\r
 \r
 class LayerControlCallbacks {\r
@@ -52,6 +61,9 @@ class LayerControl
     ~LayerControl() = default;\r
     WMError init(const LayerControlCallbacks& cb);\r
     unsigned getNewLayerID(const std::string& role);\r
+    struct rect getAreaSize(const std::string& area);\r
+    void setupArea(double scaling);\r
+    Screen getScreenInfo();\r
     // void setRenderOrder(const std::vector<unsigned> layer_render_order);\r
     // std::vector<unsigned> getAllRenderOrder();\r
     // std::vector<std::shared_ptr<WMLayer>>& getAllLayers();\r