The YV12 image isn't w*h*2, it's actually w*h + w*h/4 + w*h/4
authorSam Lantinga <slouken@libsdl.org>
Sat, 12 Feb 2011 10:13:53 -0800
changeset 5269 11bd1585efb5
parent 5268 c5a04f3c3908
child 5270 7aba0406c273
The YV12 image isn't w*h*2, it's actually w*h + w*h/4 + w*h/4
src/render/SDL_yuv_sw.c
--- 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: