X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Flayers.cpp;h=b7a0fa2042ec7280d17c8467396c60b951f52088;hb=e7ba7ca4eae20ab2db682bb780c7a4d5b1d394f5;hp=6ffb4e26075d7f5c83c6c01ed7f6709755301bad;hpb=dd72b1c91895058d14bd13c3aa9a50bd75f633b6;p=apps%2Fagl-service-windowmanager.git diff --git a/src/layers.cpp b/src/layers.cpp index 6ffb4e2..b7a0fa2 100644 --- a/src/layers.cpp +++ b/src/layers.cpp @@ -31,35 +31,7 @@ layer::layer(nlohmann::json const &j) this->name = j["name"]; this->layer_id = j["layer_id"]; - // Init flag of normal layout only - this->is_normal_layout_only = true; - - auto split_layouts = j.find("split_layouts"); - if (split_layouts != j.end()) - { - - // Clear flag of normal layout only - this->is_normal_layout_only = false; - - auto &sls = j["split_layouts"]; - // this->layouts.reserve(sls.size()); - std::transform(std::cbegin(sls), std::cend(sls), - std::back_inserter(this->layouts), [this](json const &sl) { - struct split_layout l - { - sl["name"], sl["main_match"], sl["sub_match"] - }; - HMI_DEBUG("wm", - "layer %d add split_layout \"%s\" (main: \"%s\") (sub: " - "\"%s\")", - this->layer_id, - l.name.c_str(), l.main_match.c_str(), - l.sub_match.c_str()); - return l; - }); - } - HMI_DEBUG("wm", "layer_id:%d is_normal_layout_only:%d\n", - this->layer_id, this->is_normal_layout_only); + HMI_DEBUG("wm", "layer_id:%d name:%s", this->layer_id, this->name.c_str()); } struct result to_layer_map(nlohmann::json const &j) @@ -181,22 +153,9 @@ json layer_map::to_json() const return j; } -void layer_map::setupArea(int output_w, int output_h) +void layer_map::setupArea(double scaling) { compositor::rect rct; - for (auto &i : this->area2size) - { - rct = i.second; - - // less-than-0 values refer to MAX + 1 - $VALUE - // e.g. MAX is either screen width or height - if(rct.w < 0) - rct.w = output_w + 1 + rct.w; - if(rct.h < 0) - rct.h = output_h + 1 + rct.h; - - i.second = rct; - } rct = this->area2size["normal.full"]; this->area2size["normalfull"] = rct; @@ -204,6 +163,11 @@ void layer_map::setupArea(int output_w, int output_h) 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); } @@ -308,8 +272,8 @@ const char* layer_map::kDefaultAreaDb = "{ \ \"rect\": { \ \"x\": 0, \ \"y\": 0, \ - \"w\": -1, \ - \"h\": -1 \ + \"w\": 1080, \ + \"h\": 1920 \ } \ }, \ { \ @@ -317,8 +281,8 @@ const char* layer_map::kDefaultAreaDb = "{ \ \"rect\": { \ \"x\": 0, \ \"y\": 218, \ - \"w\": -1, \ - \"h\": -433 \ + \"w\": 1080, \ + \"h\": 1488 \ } \ }, \ { \ @@ -326,7 +290,7 @@ const char* layer_map::kDefaultAreaDb = "{ \ \"rect\": { \ \"x\": 0, \ \"y\": 218, \ - \"w\": -1, \ + \"w\": 1080, \ \"h\": 744 \ } \ }, \ @@ -335,7 +299,7 @@ const char* layer_map::kDefaultAreaDb = "{ \ \"rect\": { \ \"x\": 0, \ \"y\": 962, \ - \"w\": -1, \ + \"w\": 1080, \ \"h\": 744 \ } \ }, \ @@ -344,7 +308,7 @@ const char* layer_map::kDefaultAreaDb = "{ \ \"rect\": { \ \"x\": 0, \ \"y\": 962, \ - \"w\": -1, \ + \"w\": 1080, \ \"h\": 744 \ } \ }, \ @@ -353,8 +317,8 @@ const char* layer_map::kDefaultAreaDb = "{ \ \"rect\": { \ \"x\": 0, \ \"y\": 218, \ - \"w\": -1, \ - \"h\": -433 \ + \"w\": 1080, \ + \"h\": 1488 \ } \ }, \ { \ @@ -362,7 +326,7 @@ const char* layer_map::kDefaultAreaDb = "{ \ \"rect\": { \ \"x\": 0, \ \"y\": 218, \ - \"w\": -1, \ + \"w\": 1080, \ \"h\": 744 \ } \ }, \ @@ -371,7 +335,7 @@ const char* layer_map::kDefaultAreaDb = "{ \ \"rect\": { \ \"x\": 0, \ \"y\": 962, \ - \"w\": -1, \ + \"w\": 1080, \ \"h\": 744 \ } \ }, \ @@ -380,8 +344,8 @@ const char* layer_map::kDefaultAreaDb = "{ \ \"rect\": { \ \"x\": 0, \ \"y\": 218, \ - \"w\": -1, \ - \"h\": -433 \ + \"w\": 1080, \ + \"h\": 1488 \ } \ } \ ] \