提交 f7cabbf8 编写于 作者: S Simon Fels

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.
上级 3d051a40
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册