Mesa (mesa_7_5_branch): mesa: fix incorrect viewport clamping in _mesa_set_viewport()

Brian Paul brianp at kemper.freedesktop.org
Tue Jun 16 15:36:45 UTC 2009


Module: Mesa
Branch: mesa_7_5_branch
Commit: 3e48dd04456aaf2d42dfa7f3a3c99a95a5986eb6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3e48dd04456aaf2d42dfa7f3a3c99a95a5986eb6

Author: Brian Paul <brianp at vmware.com>
Date:   Tue Jun 16 09:34:35 2009 -0600

mesa: fix incorrect viewport clamping in _mesa_set_viewport()

A 0 by 0 viewport size is legal.  Don't clamp against lower bound of one.
The error checking earlier in the function prevents negative values.

---

 src/mesa/main/viewport.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c
index ead856d..50e0402 100644
--- a/src/mesa/main/viewport.c
+++ b/src/mesa/main/viewport.c
@@ -73,8 +73,8 @@ _mesa_set_viewport(GLcontext *ctx, GLint x, GLint y,
    }
 
    /* clamp width and height to the implementation dependent range */
-   width  = CLAMP(width,  1, (GLsizei) ctx->Const.MaxViewportWidth);
-   height = CLAMP(height, 1, (GLsizei) ctx->Const.MaxViewportHeight);
+   width  = MIN2(width, (GLsizei) ctx->Const.MaxViewportWidth);
+   height = MIN2(height, (GLsizei) ctx->Const.MaxViewportHeight);
 
    ctx->Viewport.X = x;
    ctx->Viewport.Width = width;




More information about the mesa-commit mailing list