[MPlayer-cvslog] r21601 - trunk/libvo/vo_x11.c

reimar subversion at mplayerhq.hu
Tue Dec 12 20:03:58 CET 2006


Author: reimar
Date: Tue Dec 12 20:03:57 2006
New Revision: 21601

Modified:
   trunk/libvo/vo_x11.c

Log:
Align image data pointer, this is also in preparation of an upcoming patch


Modified: trunk/libvo/vo_x11.c
==============================================================================
--- trunk/libvo/vo_x11.c	(original)
+++ trunk/libvo/vo_x11.c	Tue Dec 12 20:03:57 2006
@@ -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;



More information about the MPlayer-cvslog mailing list