Only offset the rect if it's not empty, otherwise we might return negative
[reactos.git] / reactos / subsys / win32k / ntuser / painting.c
index 0f8d1c9..575dc4e 100644 (file)
@@ -769,9 +769,12 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* UnsafePs)
          UnsafeIntGetRgnBox(Rgn, &Ps.rcPaint);
          RGNDATA_UnlockRgn(Rgn);
          IntGdiIntersectRect(&Ps.rcPaint, &Ps.rcPaint, &Window->ClientRect);
          UnsafeIntGetRgnBox(Rgn, &Ps.rcPaint);
          RGNDATA_UnlockRgn(Rgn);
          IntGdiIntersectRect(&Ps.rcPaint, &Ps.rcPaint, &Window->ClientRect);
-         IntGdiOffsetRect(&Ps.rcPaint,
-                          -Window->ClientRect.left,
-                          -Window->ClientRect.top);
+         if (! IntGdiIsEmptyRect(&Ps.rcPaint))
+         {
+            IntGdiOffsetRect(&Ps.rcPaint,
+                             -Window->ClientRect.left,
+                             -Window->ClientRect.top);
+         }
       }
       else
       {
       }
       else
       {