summaryrefslogtreecommitdiff
path: root/src/cairo-xcb-surface.c
diff options
context:
space:
mode:
authorUli Schlachter <psychon@znc.in>2012-10-06 15:00:51 +0200
committerUli Schlachter <psychon@znc.in>2012-10-06 15:00:51 +0200
commit0251f0951d8dcdd198912326c11489823989a3eb (patch)
tree2a14ebf3ad0decfd06256fd19c5d3fca2f28c3e4 /src/cairo-xcb-surface.c
parent15ef4a3248bbf32d05da7ed2480a2ce58c26d9bc (diff)
downloadcairo-0251f0951d8dcdd198912326c11489823989a3eb.tar.gz
xcb: Clear the result of create_similar_image
The documentation of cairo_surface_create_similar_image() states that the image's contents are initially all 0. However, the implementation didn't live up to the documentation. This was found via the corresponding assert in cairo_surface_create_similar_image(). There are some cairo-xcb-internal users of this function which cleared the image right after creating it. Obviously, this isn't needed anymore. Fixes: Nothing. The existing call in the testsuite to cairo_surface_create_similar_image() doesn't hit this issue, since it creates a too small image to hit the SHM-case. Signed-off-by: Uli Schlachter <psychon@znc.in>
Diffstat (limited to 'src/cairo-xcb-surface.c')
-rw-r--r--src/cairo-xcb-surface.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c
index bde03ffd0..746fb4534 100644
--- a/src/cairo-xcb-surface.c
+++ b/src/cairo-xcb-surface.c
@@ -190,6 +190,11 @@ _cairo_xcb_surface_create_similar_image (void *abstract_other,
if (unlikely (status))
return _cairo_surface_create_in_error (status);
+ if (! image->base.is_clear) {
+ memset (image->data, 0, image->stride * image->height);
+ image->base.is_clear = TRUE;
+ }
+
return &image->base;
}