The YV12 image isn't w*h*2, it's actually w*h + w*h/4 + w*h/4

This commit is contained in:
Sam Lantinga 2011-02-12 10:13:53 -08:00
parent ba0ff6d7c8
commit 5fc9a80e24

View file

@ -1127,7 +1127,8 @@ SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
("YV12 and IYUV textures only support full surface updates"); ("YV12 and IYUV textures only support full surface updates");
return -1; 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; break;
case SDL_PIXELFORMAT_YUY2: case SDL_PIXELFORMAT_YUY2:
case SDL_PIXELFORMAT_UYVY: case SDL_PIXELFORMAT_UYVY: