From 6609d9c6a413ba1c5c005b663d737acf49b40780 Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Mon, 12 Jan 2015 21:26:27 +0100 Subject: [PATCH] iconcache: Fix icon data copy into cairo surface The stride is in bytes but we're copying ints. https://bugzilla.gnome.org/show_bug.cgi?id=742825 --- src/x11/iconcache.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/x11/iconcache.c b/src/x11/iconcache.c index 932af7b19..b205ab6c3 100644 --- a/src/x11/iconcache.c +++ b/src/x11/iconcache.c @@ -163,18 +163,18 @@ argbdata_to_surface (gulong *argb_data, int w, int h) { cairo_surface_t *surface; int y, x, stride; - uint8_t *data; + uint32_t *data; surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, w, h); - stride = cairo_image_surface_get_stride (surface); - data = cairo_image_surface_get_data (surface); + stride = cairo_image_surface_get_stride (surface) / sizeof (uint32_t); + data = (uint32_t *) cairo_image_surface_get_data (surface); /* One could speed this up a lot. */ for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { - uint32_t *p = (uint32_t *) &data[y * stride + x]; + uint32_t *p = &data[y * stride + x]; gulong *d = &argb_data[y * w + x]; *p = *d; }