Use largest layer of a window to calculate relative layer positions

As a window can be built out of multiple layers we need to take one as
the primary one which covers the entire window area. As it is not
guranteed that the layer size will match the actual window size cause
of synchronizaton delays with the Android side window manager we take
the layer as primary which covers the largest screen area. This should
solve most issues.
This commit is contained in:
Simon Fels 2016-12-23 15:35:29 +01:00
commit f7cabbf8ff

View file

@ -56,12 +56,15 @@ void LayerComposer::submit_layers(const RenderableList &renderables) {
const auto &renderables = w.second;
RenderableList final_renderables;
auto new_window_frame = Rect::Invalid;
auto max_layer_area = -1;
for (auto &r : renderables) {
if (new_window_frame == Rect::Invalid)
new_window_frame = r.screen_position();
else
new_window_frame.merge(r.screen_position());
const auto layer_area = r.screen_position().width() * r.screen_position().height();
if (layer_area < max_layer_area)
continue;
max_layer_area = layer_area;
new_window_frame = r.screen_position();
}
for (auto &r : renderables) {