---
src/compositor.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/src/compositor.c b/src/compositor.c
index 7370435..26c57b9 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -928,6 +928,9 @@ weston_surface_draw(struct weston_surface *es, struct
weston_output *output,
if (!pixman_region32_not_empty(&repaint))
goto out;
+ pixman_region32_subtract(&ec->primary_plane.damage,
+ &ec->primary_plane.damage, &repaint);
+
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
if (es->blend || es->alpha < 1.0)
glEnable(GL_BLEND);
@@ -1095,7 +1098,8 @@ update_shm_texture(struct weston_surface *surface)
static void
surface_accumulate_damage(struct weston_surface *surface,
- pixman_region32_t *opaque)
+ pixman_region32_t *opaque,
+ pixman_region32_t *exclude)
{
if (surface->buffer && wl_buffer_is_shm(surface->buffer))
update_shm_texture(surface);
@@ -1121,9 +1125,8 @@ surface_accumulate_damage(struct weston_surface *surface,
pixman_region32_union(&surface->plane->damage,
&surface->plane->damage, &surface->damage);
empty_region(&surface->damage);
- pixman_region32_copy(&surface->clip, opaque);
- if (surface->plane == &surface->compositor->primary_plane)
- pixman_region32_union(opaque, opaque,
&surface->transform.opaque);
+ pixman_region32_subtract(&surface->clip, opaque, exclude);
+ pixman_region32_union(opaque, opaque, &surface->transform.opaque);
}
static void
@@ -1135,7 +1138,7 @@ weston_output_repaint(struct weston_output *output,
uint32_t msecs)
struct weston_animation *animation, *next;
struct weston_frame_callback *cb, *cnext;
struct wl_list frame_callback_list;
- pixman_region32_t opaque, output_damage;
+ pixman_region32_t opaque, output_damage, previous;
int32_t width, height;
weston_compositor_update_drag_surfaces(ec);
@@ -1170,8 +1173,16 @@ weston_output_repaint(struct weston_output *output,
uint32_t msecs)
pixman_region32_init(&opaque);
+ /* Once we draw something on one of the back buffers it needs to be
+ * drawn on the other one, otherwise we might endup with artifacts.
+ * Make sure we draw any previous damage that would be lost otherwise
+ */
+ pixman_region32_init(&previous);
+ pixman_region32_subtract(&previous, &output->previous_damage,
+ &ec->primary_plane.damage);
+
wl_list_for_each(es, &ec->surface_list, link)
- surface_accumulate_damage(es, &opaque);
+ surface_accumulate_damage(es, &opaque, &previous);
pixman_region32_init(&output_damage);
pixman_region32_union(&output_damage, &ec->primary_plane.damage,
@@ -1180,10 +1191,9 @@ weston_output_repaint(struct weston_output *output,
uint32_t msecs)
&ec->primary_plane.damage);
pixman_region32_intersect(&output_damage,
&output_damage, &output->region);
- pixman_region32_subtract(&ec->primary_plane.damage,
- &ec->primary_plane.damage, &output->region);
pixman_region32_fini(&opaque);
+ pixman_region32_fini(&previous);
if (output->dirty)
weston_output_update_matrix(output);
--
1.7.9.5
_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel