changeset 5274:11bd1585efb5

The YV12 image isn't w*h*2, it's actually w*h + w*h/4 + w*h/4
author Sam Lantinga <slouken@libsdl.org>
date Sat, 12 Feb 2011 10:13:53 -0800
parents c5a04f3c3908
children 7aba0406c273
files src/render/SDL_yuv_sw.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/render/SDL_yuv_sw.c	Sat Feb 12 08:17:58 2011 -0800
+++ b/src/render/SDL_yuv_sw.c	Sat Feb 12 10:13:53 2011 -0800
@@ -1127,7 +1127,8 @@
                 ("YV12 and IYUV textures only support full surface updates");
             return -1;
         }
-        SDL_memcpy(swdata->pixels, pixels, swdata->h * swdata->w * 2);
+        SDL_memcpy(swdata->pixels, pixels,
+                   (swdata->h * swdata->w) + (swdata->h * swdata->w) / 2);
         break;
     case SDL_PIXELFORMAT_YUY2:
     case SDL_PIXELFORMAT_UYVY: