summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Lantinga <slouken@libsdl.org>2011-12-30 18:18:42 -0500
committerSam Lantinga <slouken@libsdl.org>2011-12-30 18:18:42 -0500
commit7329a9b6276bde03ce6659db4e2645db36b4b3ec (patch)
tree6dfc945df5fe71c16b4ba1c5c43963efd62b2516 /src
parent8674032f61462f990f7fee9b69628faa4c137811 (diff)
Fixed bug 1315 - Greenish video when video size smaller than texture
The incoming pixels are contiguous for the update rectangle.
Diffstat (limited to 'src')
-rw-r--r--src/render/opengl/SDL_render_gl.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c
index 32004464..560d88b1 100644
--- a/src/render/opengl/SDL_render_gl.c
+++ b/src/render/opengl/SDL_render_gl.c
@@ -569,15 +569,10 @@ 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 */
- 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 @@ GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
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 {