From e2db86d345768e7226ee6f4b4dc3a9ad6a6a2235 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 12 Feb 2011 00:42:39 -0800 Subject: [PATCH] Ah there, that fixed it. :) --- src/render/opengl/SDL_render_gl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index 3368d8942..327c41354 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -553,8 +553,12 @@ GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, rect->h, data->format, data->formattype, pixels); if (data->yuv) { + const void *top; + + renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, (pitch / 2)); + /* Skip to the top of the next texture */ - const void *top = (const void*)((const Uint8*)pixels + (texture->h-rect->y) * pitch - rect->x); + top = (const void*)((const Uint8*)pixels + (texture->h-rect->y) * pitch - rect->x); /* Skip to the correct offset into the next texture */ pixels = (const void*)((const Uint8*)top + (rect->y / 2) * pitch + rect->x / 2);