summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-12-12 19:03:57 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-12-12 19:03:57 +0000
commitba288eb9b0db20c58681d36d85f805de455688da (patch)
tree558067d04068069d0d1aab3fe7354478d979145e /libvo
parentfa9a9cb0e353c54c31887842c353df96e120fee3 (diff)
downloadmpv-ba288eb9b0db20c58681d36d85f805de455688da.tar.bz2
mpv-ba288eb9b0db20c58681d36d85f805de455688da.tar.xz
Align image data pointer, this is also in preparation of an upcoming patch
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21601 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/vo_x11.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libvo/vo_x11.c b/libvo/vo_x11.c
index 09e491c613..b53751e0fc 100644
--- a/libvo/vo_x11.c
+++ b/libvo/vo_x11.c
@@ -67,6 +67,8 @@ static void (*draw_alpha_fnc) (int x0, int y0, int w, int h,
/* 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 @@ static void getMyXImage(void)
#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 @@ static void freeMyXImage(void)
} else
#endif
{
+ myximage->data = ImageDataOrig;
XDestroyImage(myximage);
+ ImageDataOrig = NULL;
}
myximage = NULL;
ImageData = NULL;