diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-08-17 22:17:41 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-08-17 23:43:26 +0100 |
commit | 94815189a42e52a82c602e8f23e69e1826f51ce7 (patch) | |
tree | 539aeacce3494b35cacf1e3098f0c0faff2404a7 /src/cairo-xlib-surface-shm.c | |
parent | c068691ff57c2f6cd750a54db17393c0e132cb00 (diff) |
xlib/shm: Clear the similar image surface
The upper layers check that the surface returned to userspace is
cleared; make it so.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-xlib-surface-shm.c')
-rw-r--r-- | src/cairo-xlib-surface-shm.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/cairo-xlib-surface-shm.c b/src/cairo-xlib-surface-shm.c index c8a8ebd4f..5932defe7 100644 --- a/src/cairo-xlib-surface-shm.c +++ b/src/cairo-xlib-surface-shm.c @@ -776,6 +776,7 @@ _cairo_xlib_surface_clear_shm (cairo_xlib_surface_t *surface) surface->base.damage = _cairo_damage_create(); memset (shm->image.data, 0, shm->image.stride * shm->image.height); + shm->image.base.is_clear = TRUE; } static void inc_idle (cairo_surface_t *surface) @@ -977,7 +978,14 @@ _cairo_xlib_surface_create_similar_shm (void *other, surface = _cairo_xlib_surface_create_shm (other, _cairo_format_to_pixman_format_code (format), width, height); - if (surface == NULL) + if (surface) { + if (! surface->is_clear) { + cairo_xlib_shm_surface_t *shm = (cairo_xlib_shm_surface_t *) surface; + assert (shm->active == 0); + memset (shm->image.data, 0, shm->image.stride * shm->image.height); + shm->image.base.is_clear = TRUE; + } + } else surface = cairo_image_surface_create (format, width, height); return surface; |