From 7d879f7cbde8cd6aac77f513cba7bf2b803ba652 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 12 Feb 2011 10:13:53 -0800 Subject: [PATCH] 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/render/SDL_yuv_sw.c b/src/render/SDL_yuv_sw.c index 40eaed3ed..43fbfc840 100644 --- a/src/render/SDL_yuv_sw.c +++ b/src/render/SDL_yuv_sw.c @@ -1127,7 +1127,8 @@ SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, ("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: