Mesa (intel-2008-q4): mesa: Correct _mesa_clip_to_region() off-by-one.
Eric Anholt
anholt at kemper.freedesktop.org
Tue Dec 23 23:05:43 UTC 2008
Module: Mesa
Branch: intel-2008-q4
Commit: c563c5b0b38199eea3f9665d8aa8f3b32da63dcf
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c563c5b0b38199eea3f9665d8aa8f3b32da63dcf
Author: Eric Anholt <eric at anholt.net>
Date: Thu Dec 18 18:23:51 2008 -0800
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.
(cherry picked from commit aa09e0a1d532d0de2e094957d0509a7f60ebeafa)
---
src/mesa/main/image.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index 4551b4a..6b19fc8 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;
More information about the mesa-commit
mailing list