changeset 21585:e54f539c9b5d

Align image data pointer, this is also in preparation of an upcoming patch
author reimar
date Tue, 12 Dec 2006 19:03:57 +0000
parents 3ddf91e141a3
children 5a1e078720e7
files libvo/vo_x11.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_x11.c	Tue Dec 12 18:43:10 2006 +0000
+++ b/libvo/vo_x11.c	Tue Dec 12 19:03:57 2006 +0000
@@ -67,6 +67,8 @@
 
 /* local data */
 static unsigned char *ImageData;
+//! original unaligned pointer for free
+static unsigned char *ImageDataOrig;
 
 /* X11 related variables */
 static XImage *myximage = NULL;
@@ -231,7 +233,8 @@
 #endif
         myximage = XCreateImage(mDisplay, vinfo.visual, depth, ZPixmap,
                              0, NULL, image_width, image_height, 8, 0);
-        myximage->data = malloc(myximage->bytes_per_line * image_height);
+        ImageDataOrig = malloc(myximage->bytes_per_line * image_height + 32);
+        myximage->data = ImageDataOrig + 16 - ((long)ImageDataOrig & 15);
         memset(myximage->data, 0, myximage->bytes_per_line * image_height);
         ImageData = myximage->data;
 #ifdef HAVE_SHM
@@ -250,7 +253,9 @@
     } else
 #endif
     {
+        myximage->data = ImageDataOrig;
         XDestroyImage(myximage);
+        ImageDataOrig = NULL;
     }
     myximage = NULL;
     ImageData = NULL;