compositor: use bounding box for damage regions

Change weston_surface_damage*() functions to use the full surface
bounding box or call surface_compute_bbox() to find the bounding box for
an arbitrary rectangle.

This should fix all rendering artifacts for non-opaque (i.e. ARGB)
transformed surfaces.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
dev
Pekka Paalanen 13 years ago
parent 45f3e405c6
commit 2267d45f7c
  1. 42
      src/compositor.c

@ -384,25 +384,36 @@ weston_surface_from_global(struct weston_surface *surface,
WL_EXPORT void WL_EXPORT void
weston_surface_damage_rectangle(struct weston_surface *surface, weston_surface_damage_rectangle(struct weston_surface *surface,
int32_t x, int32_t y, int32_t sx, int32_t sy,
int32_t width, int32_t height) int32_t width, int32_t height)
{ {
struct weston_compositor *compositor = surface->compositor; weston_surface_update_transform(surface);
pixman_region32_union_rect(&surface->damage, if (surface->transform.enabled) {
&surface->damage, pixman_region32_t box;
surface->geometry.x + x, surface_compute_bbox(surface, sx, sy, width, height, &box);
surface->geometry.y + y, pixman_region32_union(&surface->damage, &surface->damage,
width, height); &box);
weston_compositor_schedule_repaint(compositor); pixman_region32_fini(&box);
} else {
int32_t x, y;
weston_surface_to_global(surface, sx, sy, &x, &y);
pixman_region32_union_rect(&surface->damage, &surface->damage,
x, y, width, height);
}
weston_compositor_schedule_repaint(surface->compositor);
} }
WL_EXPORT void WL_EXPORT void
weston_surface_damage(struct weston_surface *surface) weston_surface_damage(struct weston_surface *surface)
{ {
weston_surface_damage_rectangle(surface, 0, 0, weston_surface_update_transform(surface);
surface->geometry.width,
surface->geometry.height); pixman_region32_union(&surface->damage, &surface->damage,
&surface->transform.boundingbox);
weston_compositor_schedule_repaint(surface->compositor);
} }
WL_EXPORT void WL_EXPORT void
@ -418,11 +429,10 @@ weston_surface_damage_below(struct weston_surface *surface)
below = container_of(surface->link.next, struct weston_surface, link); below = container_of(surface->link.next, struct weston_surface, link);
pixman_region32_union_rect(&below->damage, weston_surface_update_transform(surface);
&below->damage, pixman_region32_union(&below->damage, &below->damage,
surface->geometry.x, surface->geometry.y, &surface->transform.boundingbox);
surface->geometry.width,
surface->geometry.height);
weston_compositor_schedule_repaint(surface->compositor); weston_compositor_schedule_repaint(surface->compositor);
} }

Loading…
Cancel
Save