[mutter] iconcache: Fix icon data copy into cairo surface



commit 6609d9c6a413ba1c5c005b663d737acf49b40780
Author: Rui Matos <tiagomatos gmail com>
Date:   Mon Jan 12 21:26:27 2015 +0100

    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 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/x11/iconcache.c b/src/x11/iconcache.c
index 932af7b..b205ab6 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;
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]