compositor: Store the output rectangle in a region

dev
Kristian Høgsberg 14 years ago
parent ef04414f39
commit e75cb7f64b
  1. 29
      compositor/compositor.c
  2. 1
      compositor/compositor.h

@ -634,11 +634,8 @@ wlsc_output_damage(struct wlsc_output *output)
{ {
struct wlsc_compositor *compositor = output->compositor; struct wlsc_compositor *compositor = output->compositor;
pixman_region32_union_rect(&compositor->damage_region, pixman_region32_union(&compositor->damage_region,
&compositor->damage_region, &compositor->damage_region, &output->region);
output->x, output->y,
output->current->width,
output->current->height);
wlsc_compositor_schedule_repaint(compositor); wlsc_compositor_schedule_repaint(compositor);
} }
@ -713,11 +710,8 @@ wlsc_output_repaint(struct wlsc_output *output)
pixman_region32_init(&new_damage); pixman_region32_init(&new_damage);
pixman_region32_init(&total_damage); pixman_region32_init(&total_damage);
pixman_region32_intersect_rect(&new_damage, pixman_region32_intersect(&new_damage,
&ec->damage_region, &ec->damage_region, &output->region);
output->x, output->y,
output->current->width,
output->current->height);
pixman_region32_subtract(&ec->damage_region, pixman_region32_subtract(&ec->damage_region,
&ec->damage_region, &new_damage); &ec->damage_region, &new_damage);
pixman_region32_union(&total_damage, &new_damage, pixman_region32_union(&total_damage, &new_damage,
@ -891,8 +885,8 @@ wlsc_surface_assign_output(struct wlsc_surface *es)
es->output = NULL; es->output = NULL;
wl_list_for_each(output, &ec->output_list, link) { wl_list_for_each(output, &ec->output_list, link) {
if (output->x < es->x && es->x < output->x + output->current->width && if (pixman_region32_contains_point(&output->region,
output->y < es->y && es->y < output->y + output->current->height) { es->x, es->y, NULL)) {
if (output != tmp) if (output != tmp)
printf("assiging surface %p to output %p\n", printf("assiging surface %p to output %p\n",
es, output); es, output);
@ -1655,6 +1649,7 @@ init_solid_shader(struct wlsc_shader *shader,
WL_EXPORT void WL_EXPORT void
wlsc_output_destroy(struct wlsc_output *output) wlsc_output_destroy(struct wlsc_output *output)
{ {
pixman_region32_fini(&output->region);
destroy_surface(&output->background->surface.resource, NULL); destroy_surface(&output->background->surface.resource, NULL);
} }
@ -1673,6 +1668,9 @@ wlsc_output_move(struct wlsc_output *output, int x, int y)
} }
pixman_region32_init(&output->previous_damage_region); pixman_region32_init(&output->previous_damage_region);
pixman_region32_init_rect(&output->region, x, y,
output->current->width,
output->current->height);
wlsc_matrix_init(&output->matrix); wlsc_matrix_init(&output->matrix);
wlsc_matrix_translate(&output->matrix, wlsc_matrix_translate(&output->matrix,
@ -1684,11 +1682,8 @@ wlsc_output_move(struct wlsc_output *output, int x, int y)
2.0 / output->current->width, 2.0 / output->current->width,
flip * 2.0 / output->current->height, 1); flip * 2.0 / output->current->height, 1);
pixman_region32_union_rect(&c->damage_region, pixman_region32_union(&c->damage_region,
&c->damage_region, &c->damage_region, &output->region);
x, y,
output->current->width,
output->current->height);
} }
WL_EXPORT void WL_EXPORT void

@ -67,6 +67,7 @@ struct wlsc_output {
struct wlsc_surface *background; struct wlsc_surface *background;
struct wlsc_matrix matrix; struct wlsc_matrix matrix;
int32_t x, y, mm_width, mm_height; int32_t x, y, mm_width, mm_height;
pixman_region32_t region;
pixman_region32_t previous_damage_region; pixman_region32_t previous_damage_region;
uint32_t flags; uint32_t flags;
int repaint_needed; int repaint_needed;

Loading…
Cancel
Save