summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-01-25 14:46:17 -0700
committerBrian Paul <[email protected]>2010-01-25 14:46:17 -0700
commit9b22427911ad27efc1f36faee9462c6082d0417c (patch)
tree12e5a6c336e4ca2a71b754120dfcc183f09ae58c /src/mesa/state_tracker
parent7e7f8815fbfa21ab2397e673fa19c36603bc7a51 (diff)
parent6749310d3f60df70ad8f82db986871ab9496793b (diff)
Merge branch 'mesa_7_7_branch'
Conflicts: src/mesa/drivers/dri/intel/intel_screen.c src/mesa/drivers/dri/intel/intel_swapbuffers.c src/mesa/drivers/dri/r300/r300_emit.c src/mesa/drivers/dri/r300/r300_ioctl.c src/mesa/drivers/dri/r300/r300_tex.c src/mesa/drivers/dri/r300/r300_texstate.c
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_atom_scissor.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/mesa/state_tracker/st_atom_scissor.c b/src/mesa/state_tracker/st_atom_scissor.c
index 3fd59e1945c..5e0c51cff0a 100644
--- a/src/mesa/state_tracker/st_atom_scissor.c
+++ b/src/mesa/state_tracker/st_atom_scissor.c
@@ -31,6 +31,7 @@
*/
+#include "main/macros.h"
#include "st_context.h"
#include "pipe/p_context.h"
#include "st_atom.h"
@@ -52,15 +53,19 @@ update_scissor( struct st_context *st )
scissor.maxy = fb->Height;
if (st->ctx->Scissor.Enabled) {
- if ((GLuint)st->ctx->Scissor.X > scissor.minx)
+ /* need to be careful here with xmax or ymax < 0 */
+ GLint xmax = MAX2(0, st->ctx->Scissor.X + st->ctx->Scissor.Width);
+ GLint ymax = MAX2(0, st->ctx->Scissor.Y + st->ctx->Scissor.Height);
+
+ if (st->ctx->Scissor.X > (GLint)scissor.minx)
scissor.minx = st->ctx->Scissor.X;
- if ((GLuint)st->ctx->Scissor.Y > scissor.miny)
+ if (st->ctx->Scissor.Y > (GLint)scissor.miny)
scissor.miny = st->ctx->Scissor.Y;
- if ((GLuint)st->ctx->Scissor.X + st->ctx->Scissor.Width < scissor.maxx)
- scissor.maxx = st->ctx->Scissor.X + st->ctx->Scissor.Width;
- if ((GLuint)st->ctx->Scissor.Y + st->ctx->Scissor.Height < scissor.maxy)
- scissor.maxy = st->ctx->Scissor.Y + st->ctx->Scissor.Height;
+ if (xmax < (GLint) scissor.maxx)
+ scissor.maxx = xmax;
+ if (ymax < (GLint) scissor.maxy)
+ scissor.maxy = ymax;
/* check for null space */
if (scissor.minx >= scissor.maxx || scissor.miny >= scissor.maxy)