From aa09e0a1d532d0de2e094957d0509a7f60ebeafa Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 18 Dec 2008 18:23:51 -0800 Subject: mesa: Correct _mesa_clip_to_region() off-by-one. Note how if: x + width == xmax + 0: width -= 0 x + width == xmax + 1: width -= 0 x + width == xmax + 2: width -= 1 So, the function was clipping to [xmin, xmax+1), not [xmin, xmax) like it was supposed to. Same for ymax. --- src/mesa/main/image.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/main/image.c') diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 4551b4a3b5..6b19fc8454 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -5152,7 +5152,7 @@ _mesa_clip_to_region(GLint xmin, GLint ymin, /* right clipping */ if (*x + *width > xmax) - *width -= (*x + *width - xmax - 1); + *width -= (*x + *width - xmax); if (*width <= 0) return GL_FALSE; @@ -5165,7 +5165,7 @@ _mesa_clip_to_region(GLint xmin, GLint ymin, /* top (or bottom) clipping */ if (*y + *height > ymax) - *height -= (*y + *height - ymax - 1); + *height -= (*y + *height - ymax); if (*height <= 0) return GL_FALSE; -- cgit v1.2.3 From d01c44aacaeabe1dd187163f9e204f40401698bc Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 18 Dec 2008 18:31:25 -0800 Subject: mesa: Clip copytexsubimage to read framebuffer bounds, not scissor region. --- src/mesa/main/image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/main/image.c') diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 6b19fc8454..c205b4b766 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -5119,7 +5119,7 @@ _mesa_clip_copytexsubimage(const GLcontext *ctx, const struct gl_framebuffer *fb = ctx->ReadBuffer; const GLint srcX0 = *srcX, srcY0 = *srcY; - if (_mesa_clip_to_region(fb->_Xmin, fb->_Ymin, fb->_Xmax, fb->_Ymax, + if (_mesa_clip_to_region(0, 0, fb->Width, fb->Height, srcX, srcY, width, height)) { *destX = *destX + *srcX - srcX0; *destY = *destY + *srcY - srcY0; -- cgit v1.2.3