# HG changeset patch # User Sam Lantinga # Date 1325287122 18000 # Node ID b052a5882a478c0060898dd7bea7c1ecbb2bf02a # Parent 2804d71badce5b98cd239d2ecbacbad2e2c45495 Fixed bug 1315 - Greenish video when video size smaller than texture The incoming pixels are contiguous for the update rectangle. diff -r 2804d71badce -r b052a5882a47 src/render/opengl/SDL_render_gl.c --- a/src/render/opengl/SDL_render_gl.c Fri Dec 30 06:41:41 2011 -0500 +++ b/src/render/opengl/SDL_render_gl.c Fri Dec 30 18:18:42 2011 -0500 @@ -569,15 +569,10 @@ 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 */ - 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); + pixels = (const void*)((const Uint8*)pixels + rect->h * pitch); if (texture->format == SDL_PIXELFORMAT_YV12) { renderdata->glBindTexture(data->type, data->vtexture); } else { @@ -587,11 +582,8 @@ rect->w/2, rect->h/2, data->format, data->formattype, pixels); - /* Skip to the top of the next texture */ - top = (const void*)((const Uint8*)top + (texture->h * pitch)/4); - /* Skip to the correct offset into the next texture */ - pixels = (const void*)((const Uint8*)top + (rect->y / 2) * pitch + rect->x / 2); + pixels = (const void*)((const Uint8*)pixels + (rect->h * pitch)/4); if (texture->format == SDL_PIXELFORMAT_YV12) { renderdata->glBindTexture(data->type, data->utexture); } else {