additional clipping/viewport fixes (Martijn van Oosterhout)
authorBrian Paul <brian.paul@tungstengraphics.com>
Mon, 3 Jul 2006 23:08:33 +0000 (23:08 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Mon, 3 Jul 2006 23:08:33 +0000 (23:08 +0000)
src/mesa/drivers/dri/r128/r128_state.c

index 05ab3890d2cbd5eb5e3f02f184d16e92a627b215..491f288ffb242a9fa47758c4aa0c6da3903c187c 100644 (file)
@@ -608,6 +608,14 @@ static void r128UpdateClipping( GLcontext *ctx )
          y1 = 0;
       else if ( y1 >= rmesa->driScreen->fbHeight )
          y1 = rmesa->driScreen->fbHeight - 1;
+      if ( x2 < 0 )
+         x2 = 0;
+      else if ( x2 >= rmesa->driScreen->fbWidth )
+         x2 = rmesa->driScreen->fbWidth - 1;
+      if ( y2 < 0 )
+         y2 = 0;
+      else if ( y2 >= rmesa->driScreen->fbHeight )
+         y2 = rmesa->driScreen->fbHeight - 1;
 
       rmesa->setup.sc_top_left_c     = (((y1 & 0x3FFF) << 16) | (x1 & 0x3FFF));
       rmesa->setup.sc_bottom_right_c = (((y2 & 0x3FFF) << 16) | (x2 & 0x3FFF));
@@ -1226,7 +1234,10 @@ void r128DDUpdateHWState( GLcontext *ctx )
         r128UpdateMasks( ctx );
 
       if ( new_state & R128_NEW_WINDOW )
+      {
         r128UpdateWindow( ctx );
+        r128CalcViewport( ctx );
+      }
 
       if ( rmesa->NewGLState & _NEW_TEXTURE ) {
         r128UpdateTextureState( ctx );