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:
parent
3d051a4056
commit
f7cabbf8ff
1 changed files with 7 additions and 4 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue