diff --git a/win32ss/gdi/ntgdi/region.c b/win32ss/gdi/ntgdi/region.c
index 79712182c7..22af41402e 100644
--- a/win32ss/gdi/ntgdi/region.c
+++ b/win32ss/gdi/ntgdi/region.c
@@ -402,8 +402,8 @@ typedef struct _SCANLINE_LISTBLOCK
  *
  *************************************************************************/
 
-#define LARGE_COORDINATE  0x7fffffff /* FIXME */
-#define SMALL_COORDINATE  0x80000000
+#define LARGE_COORDINATE  INT_MAX
+#define SMALL_COORDINATE  INT_MIN
 
 static
 BOOL
@@ -3600,8 +3600,9 @@ NtGdiCreateRoundRectRgn(
 {
     PREGION obj;
     HRGN hrgn;
-    INT asq, bsq, d, xd, yd;
-    RECTL rect;
+    int a, b, i, x, y;
+    INT64 asq, bsq, dx, dy, err;
+    RECT *rects;
 
     /* Make the dimensions sensible */
     if (left > right)
@@ -3618,95 +3619,75 @@ NtGdiCreateRoundRectRgn(
         bottom = tmp;
     }
 
-    ellipse_width = abs(ellipse_width);
-    ellipse_height = abs(ellipse_height);
+    /* the region is for the rectangle interior, but only at right and bottom for some reason */
+    right--;
+    bottom--;
 
-    /* Check parameters */
-    if (ellipse_width > right-left)
-        ellipse_width = right-left;
-    if (ellipse_height > bottom-top)
-        ellipse_height = bottom-top;
+    ellipse_width = min( right - left, abs( ellipse_width ));
+    ellipse_height = min( bottom - top, abs( ellipse_height ));
 
     /* Check if we can do a normal rectangle instead */
+
     if ((ellipse_width < 2) || (ellipse_height < 2))
         return NtGdiCreateRectRgn(left, top, right, bottom);
 
-    /* Create region */
-    d = (ellipse_height < 128) ? ((3 * ellipse_height) >> 2) : 64;
-    obj = REGION_AllocUserRgnWithHandle(d);
+    obj = REGION_AllocUserRgnWithHandle( ellipse_height );
     if (obj == NULL)
         return 0;
 
     hrgn = obj->BaseObject.hHmgr;
 
-    /* Ellipse algorithm, based on an article by K. Porter
-       in DDJ Graphics Programming Column, 8/89 */
-    asq = ellipse_width * ellipse_width / 4;        /* a^2 */
-    bsq = ellipse_height * ellipse_height / 4;      /* b^2 */
-    d = bsq - asq * ellipse_height / 2 + asq / 4;   /* b^2 - a^2b + a^2/4 */
-    xd = 0;
-    yd = asq * ellipse_height;                      /* 2a^2b */
+    obj->rdh.rcBound.left   = left;
+    obj->rdh.rcBound.top    = top;
+    obj->rdh.rcBound.right  = right;
+    obj->rdh.rcBound.bottom = bottom;
+    rects = obj->Buffer;
 
-    rect.left   = left + ellipse_width / 2;
-    rect.right  = right - ellipse_width / 2;
+    /* based on an algorithm by Alois Zingl */
 
-    /* Loop to draw first half of quadrant */
-    while (xd < yd)
-    {
-        /* If nearest pixel is toward the center */
-        if (d > 0)
-        {
-            /* Move toward center */
-            rect.top = top++;
-            rect.bottom = rect.top + 1;
-            REGION_UnionRectWithRgn(obj, &rect);
-            rect.top = --bottom;
-            rect.bottom = rect.top + 1;
-            REGION_UnionRectWithRgn(obj, &rect);
-            yd -= 2*asq;
-            d  -= yd;
-        }
+    a = ellipse_width - 1;
+    b = ellipse_height - 1;
+    asq = (INT64)8 * a * a;
+    bsq = (INT64)8 * b * b;
+    dx  = (INT64)4 * b * b * (1 - a);
+    dy  = (INT64)4 * a * a * (1 + (b % 2));
+    err = dx + dy + a * a * (b % 2);
 
-        /* Next horiz point */
-        rect.left--;
-        rect.right++;
-        xd += 2*bsq;
-        d  += bsq + xd;
-    }
+    x = 0;
+    y = ellipse_height / 2;
 
-    /* Loop to draw second half of quadrant */
-    d += (3 * (asq-bsq) / 2 - (xd+yd)) / 2;
-    while (yd >= 0)
-    {
-        /* next vertical point */
-        rect.top = top++;
-        rect.bottom = rect.top + 1;
-        REGION_UnionRectWithRgn(obj, &rect);
-        rect.top = --bottom;
-        rect.bottom = rect.top + 1;
-        REGION_UnionRectWithRgn(obj, &rect);
+    rects[y].left = left;
+    rects[y].right = right;
 
-        /* If nearest pixel is outside ellipse */
-        if (d < 0)
+    while (x <= ellipse_width / 2)
+    {
+        INT64 e2 = 2 * err;
+        if (e2 >= dx)
         {
-            /* Move away from center */
-            rect.left--;
-            rect.right++;
-            xd += 2*bsq;
-            d  += xd;
+            x++;
+            err += dx += bsq;
+        }
+        if (e2 <= dy)
+        {
+            y++;
+            err += dy += asq;
+            rects[y].left = left + x;
+            rects[y].right = right - x;
         }
-
-        yd -= 2*asq;
-        d  += asq - yd;
     }
-
-    /* Add the inside rectangle */
-    if (top <= bottom)
+    for (i = 0; i < ellipse_height / 2; i++)
+    {
+        rects[i].left = rects[b - i].left;
+        rects[i].right = rects[b - i].right;
+        rects[i].top = top + i;
+        rects[i].bottom = rects[i].top + 1;
+    }
+    for (; i < ellipse_height; i++)
     {
-        rect.top = top;
-        rect.bottom = bottom;
-        REGION_UnionRectWithRgn(obj, &rect);
+        rects[i].top = bottom - ellipse_height + i;
+        rects[i].bottom = rects[i].top + 1;
     }
+    rects[ellipse_height / 2].top = top + ellipse_height / 2;  /* extend to top of rectangle */
 
     REGION_UnlockRgn(obj);
     return hrgn;
