Vincent Povirk : winex11.drv: Clip rectangle values to 16-bit limits.

Alexandre Julliard julliard at winehq.org
Fri Apr 2 10:17:12 CDT 2010


Module: wine
Branch: master
Commit: 986a534ebed82a8b99a182ecfb2790bf00eee6be
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=986a534ebed82a8b99a182ecfb2790bf00eee6be

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Thu Apr  1 16:57:14 2010 -0500

winex11.drv: Clip rectangle values to 16-bit limits.

---

 dlls/winex11.drv/graphics.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/dlls/winex11.drv/graphics.c b/dlls/winex11.drv/graphics.c
index bc00e85..53cbab4 100644
--- a/dlls/winex11.drv/graphics.c
+++ b/dlls/winex11.drv/graphics.c
@@ -36,6 +36,7 @@
 #define PI M_PI
 #endif
 #include <string.h>
+#include <limits.h>
 
 #include "windef.h"
 #include "winbase.h"
@@ -131,10 +132,10 @@ RGNDATA *X11DRV_GetRegionData( HRGN hrgn, HDC hdc_lptodp )
         for (j = data->rdh.nCount-1; j >= 0; j--)
         {
             tmp = rect[j];
-            xrect[j].x      = tmp.left;
-            xrect[j].y      = tmp.top;
-            xrect[j].width  = tmp.right - tmp.left;
-            xrect[j].height = tmp.bottom - tmp.top;
+            xrect[j].x      = max( min( tmp.left, SHRT_MAX), SHRT_MIN);
+            xrect[j].y      = max( min( tmp.top, SHRT_MAX), SHRT_MIN);
+            xrect[j].width  = max( min( tmp.right - xrect[j].x, USHRT_MAX), 0);
+            xrect[j].height = max( min( tmp.bottom - xrect[j].y, USHRT_MAX), 0);
         }
     }
     else
@@ -142,10 +143,10 @@ RGNDATA *X11DRV_GetRegionData( HRGN hrgn, HDC hdc_lptodp )
         for (i = 0; i < data->rdh.nCount; i++)
         {
             tmp = rect[i];
-            xrect[i].x      = tmp.left;
-            xrect[i].y      = tmp.top;
-            xrect[i].width  = tmp.right - tmp.left;
-            xrect[i].height = tmp.bottom - tmp.top;
+            xrect[i].x      = max( min( tmp.left, SHRT_MAX), SHRT_MIN);
+            xrect[i].y      = max( min( tmp.top, SHRT_MAX), SHRT_MIN);
+            xrect[i].width  = max( min( tmp.right - xrect[i].x, USHRT_MAX), 0);
+            xrect[i].height = max( min( tmp.bottom - xrect[i].y, USHRT_MAX), 0);
         }
     }
     return data;




More information about the wine-cvs mailing list