compositor: weston_surface_assign_output() to use bounding box
Use the bounding box to compute an approximation of which output contains most of the surface. Move the region32 init outside the loop, and fini it, too. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This commit is contained in:
+6
-5
@@ -1037,14 +1037,14 @@ weston_surface_assign_output(struct weston_surface *es)
|
||||
uint32_t max, area;
|
||||
pixman_box32_t *e;
|
||||
|
||||
weston_surface_update_transform(es);
|
||||
|
||||
new_output = NULL;
|
||||
max = 0;
|
||||
pixman_region32_init(®ion);
|
||||
wl_list_for_each(output, &ec->output_list, link) {
|
||||
pixman_region32_init_rect(®ion,
|
||||
es->geometry.x, es->geometry.y,
|
||||
es->geometry.width,
|
||||
es->geometry.height);
|
||||
pixman_region32_intersect(®ion, ®ion, &output->region);
|
||||
pixman_region32_intersect(®ion, &es->transform.boundingbox,
|
||||
&output->region);
|
||||
|
||||
e = pixman_region32_extents(®ion);
|
||||
area = (e->x2 - e->x1) * (e->y2 - e->y1);
|
||||
@@ -1054,6 +1054,7 @@ weston_surface_assign_output(struct weston_surface *es)
|
||||
max = area;
|
||||
}
|
||||
}
|
||||
pixman_region32_fini(®ion);
|
||||
|
||||
es->output = new_output;
|
||||
if (!wl_list_empty(&es->frame_callback_list)) {
|
||||
|
||||
Reference in New Issue
Block a user