Author: fireball
Date: Thu Feb 11 22:58:21 2010
New Revision: 45581
URL: 
http://svn.reactos.org/svn/reactos?rev=45581&view=rev
Log:
- Implement ellipse and arcs (pie/chord/arc) in the graphics driver. Heavily based on
trunk's win32k.
Added:
    branches/arwinss/reactos/subsystems/win32/win32k/gre/arc.c   (with props)
    branches/arwinss/reactos/subsystems/win32/win32k/gre/drawing.c
      - copied, changed from r45537,
trunk/reactos/subsystems/win32/win32k/objects/drawing.c
    branches/arwinss/reactos/subsystems/win32/win32k/gre/ellipse.c   (with props)
    branches/arwinss/reactos/subsystems/win32/win32k/math/   (with props)
    branches/arwinss/reactos/subsystems/win32/win32k/math/i386/   (with props)
    branches/arwinss/reactos/subsystems/win32/win32k/math/i386/atan2_asm.s
      - copied unchanged from r45537,
trunk/reactos/subsystems/win32/win32k/misc/i386/atan2_asm.s
    branches/arwinss/reactos/subsystems/win32/win32k/math/i386/ceil_asm.s
      - copied unchanged from r45537,
trunk/reactos/subsystems/win32/win32k/misc/i386/ceil_asm.s
    branches/arwinss/reactos/subsystems/win32/win32k/math/i386/cos_asm.s
      - copied unchanged from r45537,
trunk/reactos/subsystems/win32/win32k/misc/i386/cos_asm.s
    branches/arwinss/reactos/subsystems/win32/win32k/math/i386/floor_asm.s
      - copied unchanged from r45537,
trunk/reactos/subsystems/win32/win32k/misc/i386/floor_asm.s
    branches/arwinss/reactos/subsystems/win32/win32k/math/i386/sin_asm.s
      - copied unchanged from r45537,
trunk/reactos/subsystems/win32/win32k/misc/i386/sin_asm.s
Modified:
    branches/arwinss/reactos/dll/win32/winent.drv/font.c
    branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c
    branches/arwinss/reactos/dll/win32/winent.drv/mouse.c
    branches/arwinss/reactos/dll/win32/winent.drv/ogldrv.c
    branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c
    branches/arwinss/reactos/dll/win32/winent.drv/wnd.c
    branches/arwinss/reactos/include/psdk/ntrosgdi.h
    branches/arwinss/reactos/subsystems/win32/win32k/gdi/misc.c
    branches/arwinss/reactos/subsystems/win32/win32k/include/gre.h
    branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db
    branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild
Modified: branches/arwinss/reactos/dll/win32/winent.drv/font.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
==============================================================================
--- branches/arwinss/reactos/dll/win32/winent.drv/font.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winent.drv/font.c [iso-8859-1] Thu Feb 11 22:58:21
2010
@@ -16,6 +16,8 @@
 #include "winbase.h"
 #include "winuser.h"
 #include "wingdi.h"
+#include <winddi.h>
+#include <win32k/ntgdityp.h>
 #include "ntrosgdi.h"
 #include "winent.h"
 #include "wine/unicode.h"
Modified: branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
==============================================================================
--- branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] Thu Feb 11
22:58:21 2010
@@ -14,6 +14,8 @@
 #include "winbase.h"
 #include "winuser.h"
 #include "wingdi.h"
+#include <winddi.h>
+#include <win32k/ntgdityp.h>
 #include "ntrosgdi.h"
 #include "winent.h"
 #include "wine/debug.h"
@@ -70,8 +72,22 @@
 BOOL CDECL RosDrv_Arc( NTDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom,
             INT xstart, INT ystart, INT xend, INT yend )
 {
-    UNIMPLEMENTED;
-    return FALSE;
+    POINT pts[4];
+
+    /* Map coordinates */
+    pts[0].x = left;
+    pts[0].y = top;
+    pts[1].x = right;
+    pts[1].y = bottom;
+    pts[2].x = xstart;
+    pts[2].y = ystart;
+    pts[3].x = xend;
+    pts[3].y = yend;
+
+    LPtoDP(physDev->hUserDC, pts, 4);
+
+    return RosGdiArc(physDev->hKernelDC, pts[0].x, pts[0].y, pts[1].x, pts[1].y,
+        pts[2].x, pts[2].y, pts[3].x, pts[3].y, GdiTypeArc);
 }
 BOOL CDECL RosDrv_BitBlt( NTDRV_PDEVICE *physDevDst, INT xDst, INT yDst,
@@ -116,8 +132,22 @@
 BOOL CDECL RosDrv_Chord( NTDRV_PDEVICE *physDev, INT left, INT top, INT right, INT
bottom,
               INT xstart, INT ystart, INT xend, INT yend )
 {
-    UNIMPLEMENTED;
-    return FALSE;
+    POINT pts[4];
+
+    /* Map coordinates */
+    pts[0].x = left;
+    pts[0].y = top;
+    pts[1].x = right;
+    pts[1].y = bottom;
+    pts[2].x = xstart;
+    pts[2].y = ystart;
+    pts[3].x = xend;
+    pts[3].y = yend;
+
+    LPtoDP(physDev->hUserDC, pts, 4);
+
+    return RosGdiArc(physDev->hKernelDC, pts[0].x, pts[0].y, pts[1].x, pts[1].y,
+        pts[2].x, pts[2].y, pts[3].x, pts[3].y, GdiTypeChord );
 }
 BOOL CDECL RosDrv_CreateBitmap( NTDRV_PDEVICE *physDev, HBITMAP hbitmap, LPVOID bmBits )
@@ -471,8 +501,8 @@
     LPtoDP(physDev->hUserDC, pts, 4);
-    return RosGdiPie(physDev->hKernelDC, pts[0].x, pts[0].y, pts[1].x, pts[1].y,
-        pts[2].x, pts[2].y, pts[3].x, pts[3].y);
+    return RosGdiArc(physDev->hKernelDC, pts[0].x, pts[0].y, pts[1].x, pts[1].y,
+        pts[2].x, pts[2].y, pts[3].x, pts[3].y, GdiTypePie);
 }
 BOOL CDECL RosDrv_PolyPolygon( NTDRV_PDEVICE *physDev, const POINT* pt, const INT*
counts, UINT polygons)
Modified: branches/arwinss/reactos/dll/win32/winent.drv/mouse.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
==============================================================================
--- branches/arwinss/reactos/dll/win32/winent.drv/mouse.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winent.drv/mouse.c [iso-8859-1] Thu Feb 11 22:58:21
2010
@@ -28,6 +28,8 @@
 #include "wingdi.h"
 #define NTOS_USER_MODE
 #include <ndk/ntndk.h>
+#include <winddi.h>
+#include <win32k/ntgdityp.h>
 #include "ntrosgdi.h"
 #include "win32k/rosuser.h"
 #include "winent.h"
Modified: branches/arwinss/reactos/dll/win32/winent.drv/ogldrv.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
==============================================================================
--- branches/arwinss/reactos/dll/win32/winent.drv/ogldrv.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winent.drv/ogldrv.c [iso-8859-1] Thu Feb 11
22:58:21 2010
@@ -10,6 +10,8 @@
 #include "windows.h"
 #include "wingdi.h"
+#include <winddi.h>
+#include <win32k/ntgdityp.h>
 #include "ntrosgdi.h"
 #include "wine/debug.h"
Modified: branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
==============================================================================
--- branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c [iso-8859-1] Thu Feb 11
22:58:21 2010
@@ -18,6 +18,8 @@
 #define NTOS_USER_MODE
 #include <ndk/ntndk.h>
 #include "winuser16.h"
+#include <winddi.h>
+#include <win32k/ntgdityp.h>
 #include "ntrosgdi.h"
 #include "win32k/rosuser.h"
 #include "winent.h"
Modified: branches/arwinss/reactos/dll/win32/winent.drv/wnd.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
==============================================================================
--- branches/arwinss/reactos/dll/win32/winent.drv/wnd.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winent.drv/wnd.c [iso-8859-1] Thu Feb 11 22:58:21
2010
@@ -17,6 +17,8 @@
 #include "wingdi.h"
 #define NTOS_USER_MODE
 #include <ndk/ntndk.h>
+#include <winddi.h>
+#include <win32k/ntgdityp.h>
 #include "ntrosgdi.h"
 #include "win32k/rosuser.h"
 #include "winent.h"
Modified: branches/arwinss/reactos/include/psdk/ntrosgdi.h
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/include/psdk/nt…
==============================================================================
--- branches/arwinss/reactos/include/psdk/ntrosgdi.h [iso-8859-1] (original)
+++ branches/arwinss/reactos/include/psdk/ntrosgdi.h [iso-8859-1] Thu Feb 11 22:58:21 2010
@@ -146,9 +146,7 @@
 /* misc.c */
 BOOL APIENTRY RosGdiArc( HDC physDev, INT left, INT top, INT right, INT bottom,
-            INT xstart, INT ystart, INT xend, INT yend );
-BOOL APIENTRY RosGdiChord( HDC physDev, INT left, INT top, INT right, INT bottom,
-              INT xstart, INT ystart, INT xend, INT yend );
+            INT xstart, INT ystart, INT xend, INT yend, ARCTYPE arc );
 BOOL APIENTRY RosGdiEllipse( HDC physDev, INT left, INT top, INT right, INT bottom );
 INT APIENTRY RosGdiExtEscape( HDC physDev, INT escape, INT in_count, LPCVOID in_data,
                             INT out_count, LPVOID out_data );
@@ -158,8 +156,6 @@
                    const RECT *lprect, LPCWSTR wstr, UINT count,
                    const INT *lpDx, gsCacheEntryFormat *formatEntry );
 BOOL APIENTRY RosGdiLineTo( HDC physDev, INT x1, INT y1, INT x2, INT y2 );
-BOOL APIENTRY RosGdiPie( HDC physDev, INT left, INT top, INT right, INT bottom,
-            INT xstart, INT ystart, INT xend, INT yend );
 BOOL APIENTRY RosGdiPolyPolygon( HDC physDev, const POINT* pt, const INT* counts, UINT
polygons);
 BOOL APIENTRY RosGdiPolyPolyline( HDC physDev, const POINT* pt, const DWORD* counts,
DWORD polylines );
 BOOL APIENTRY RosGdiPolygon( HDC physDev, const POINT* pt, INT count );
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gdi/misc.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/gdi/misc.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/gdi/misc.c [iso-8859-1] Thu Feb 11
22:58:21 2010
@@ -16,24 +16,25 @@
 /* PUBLIC FUNCTIONS **********************************************************/
-BOOL APIENTRY RosGdiArc( HDC physDev, INT left, INT top, INT right, INT bottom,
-            INT xstart, INT ystart, INT xend, INT yend )
-{
-    UNIMPLEMENTED;
-    return FALSE;
-}
-
-BOOL APIENTRY RosGdiChord( HDC physDev, INT left, INT top, INT right, INT bottom,
-              INT xstart, INT ystart, INT xend, INT yend )
-{
-    UNIMPLEMENTED;
-    return FALSE;
-}
-
 BOOL APIENTRY RosGdiEllipse( HDC physDev, INT left, INT top, INT right, INT bottom )
 {
-    UNIMPLEMENTED;
-    return FALSE;
+    PDC pDC;
+
+    /* Get a pointer to the DC */
+    pDC = DC_Lock(physDev);
+
+    /* Add DC origin */
+    left += pDC->rcVport.left + pDC->rcDcRect.left;
+    top += pDC->rcVport.top + pDC->rcDcRect.top;
+    right += pDC->rcVport.left + pDC->rcDcRect.left;
+    bottom += pDC->rcVport.top + pDC->rcDcRect.top;
+
+    GreEllipse(pDC, left, top, right, bottom);
+
+    /* Release the object */
+    DC_Unlock(pDC);
+
+    return TRUE;
 }
 INT APIENTRY RosGdiExtEscape( HDC physDev, INT escape, INT in_count, LPCVOID in_data,
@@ -106,11 +107,30 @@
     return TRUE;
 }
-BOOL APIENTRY RosGdiPie( HDC physDev, INT left, INT top, INT right, INT bottom,
-            INT xstart, INT ystart, INT xend, INT yend )
-{
-    UNIMPLEMENTED;
-    return FALSE;
+BOOL APIENTRY RosGdiArc( HDC physDev, INT left, INT top, INT right, INT bottom,
+            INT xstart, INT ystart, INT xend, INT yend, ARCTYPE arc )
+{
+    PDC pDC;
+
+    /* Get a pointer to the DC */
+    pDC = DC_Lock(physDev);
+
+    /* Add DC origin */
+    left += pDC->rcVport.left + pDC->rcDcRect.left;
+    top += pDC->rcVport.top + pDC->rcDcRect.top;
+    right += pDC->rcVport.left + pDC->rcDcRect.left;
+    bottom += pDC->rcVport.top + pDC->rcDcRect.top;
+    xstart += pDC->rcVport.left + pDC->rcDcRect.left;
+    ystart += pDC->rcVport.top + pDC->rcDcRect.top;
+    xend += pDC->rcVport.left + pDC->rcDcRect.left;
+    yend += pDC->rcVport.top + pDC->rcDcRect.top;
+
+    GrepArc(pDC, left, top, right, bottom, xstart, ystart, xend, yend, arc);
+
+    /* Release the object */
+    DC_Unlock(pDC);
+
+    return TRUE;
 }
 BOOL APIENTRY RosGdiPolyPolygon( HDC physDev, const POINT* pt, const INT* counts, UINT
polygons)
Added: branches/arwinss/reactos/subsystems/win32/win32k/gre/arc.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/gre/arc.c (added)
+++ branches/arwinss/reactos/subsystems/win32/win32k/gre/arc.c [iso-8859-1] Thu Feb 11
22:58:21 2010
@@ -1,0 +1,173 @@
+/*
+ * PROJECT:         ReactOS Win32K
+ * LICENSE:         LGPL - See COPYING in the top level directory
+ * FILE:            subsystems/win32/win32k/gre/arc.c
+ * PURPOSE:         Graphic engine: arcs
+ * PROGRAMMERS:     Aleksey Bragin <aleksey(a)reactos.org>
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <win32k.h>
+#include "math.h"
+#define NDEBUG
+#include <debug.h>
+
+/* PUBLIC FUNCTIONS **********************************************************/
+
+/*
+ * a couple macros to fill a single pixel or a line
+ */
+#define PUTPIXEL(x,y,BrushInst)        \
+  ret = ret && GreLineTo(&psurf->SurfObj, \
+       dc->CombinedClip,                         \
+       &BrushInst->BrushObj,                   \
+       x, y, (x)+1, y,                           \
+       &RectBounds,                              \
+       ROP2_TO_MIX(R2_COPYPEN/*pdcattr->jROP2*/));
+
+#define PUTLINE(x1,y1,x2,y2,BrushInst) \
+  ret = ret && GreLineTo(&psurf->SurfObj, \
+       dc->CombinedClip,                         \
+       &BrushInst->BrushObj,                   \
+       x1, y1, x2, y2,                           \
+       &RectBounds,                              \
+       ROP2_TO_MIX(R2_COPYPEN/*pdcattr->jROP2*/));
+
+#define Rsin(d) ((d) == 0.0 ? 0.0 : ((d) == 90.0 ? 1.0 : sin(d*M_PI/180.0)))
+#define Rcos(d) ((d) == 0.0 ? 1.0 : ((d) == 90.0 ? 0.0 : cos(d*M_PI/180.0)))
+
+BOOLEAN
+APIENTRY
+GrepArc(PDC  dc,
+        int  Left,
+        int  Top,
+        int  Right,
+        int  Bottom,
+        int  XRadialStart,
+        int  YRadialStart,
+        int  XRadialEnd,
+        int  YRadialEnd,
+        ARCTYPE arctype)
+{
+    RECTL RectBounds, RectSEpts;
+    PBRUSHGDI pbrushPen;
+    SURFACE *psurf;
+    BOOLEAN ret = TRUE;
+    LONG PenWidth, PenOrigWidth;
+    double AngleStart, AngleEnd;
+    LONG RadiusX, RadiusY, CenterX, CenterY;
+    LONG SfCx, SfCy, EfCx, EfCy;
+    POINTL BrushOrg;
+
+    if (Right < Left)
+    {
+       INT tmp = Right; Right = Left; Left = tmp;
+    }
+    if (Bottom < Top)
+    {
+       INT tmp = Bottom; Bottom = Top; Top = tmp;
+    }
+    if ((Left == Right) ||
+        (Top == Bottom) ||
+        (((arctype != GdiTypeArc) || (arctype != GdiTypeArcTo)) &&
+        ((Right - Left == 1) ||
+        (Bottom - Top == 1))))
+       return TRUE;
+
+    GreUpdateBrush(dc->pLineBrush, dc);
+    pbrushPen = dc->pLineBrush;
+    PenOrigWidth = PenWidth = pbrushPen->ptPenWidth.x;
+    if (pbrushPen->ulPenStyle == PS_NULL) PenWidth = 0;
+
+    if (pbrushPen->ulPenStyle == PS_INSIDEFRAME)
+    {
+       if (2*PenWidth > (Right - Left)) PenWidth = (Right -Left + 1)/2;
+       if (2*PenWidth > (Bottom - Top)) PenWidth = (Bottom -Top + 1)/2;
+       Left   += PenWidth / 2;
+       Right  -= (PenWidth - 1) / 2;
+       Top    += PenWidth / 2;
+       Bottom -= (PenWidth - 1) / 2;
+    }
+
+    if (!PenWidth) PenWidth = 1;
+    pbrushPen->ptPenWidth.x = PenWidth;
+
+    RectBounds.left   = Left;
+    RectBounds.right  = Right;
+    RectBounds.top    = Top;
+    RectBounds.bottom = Bottom;
+
+    RectSEpts.left   = XRadialStart;
+    RectSEpts.top    = YRadialStart;
+    RectSEpts.right  = XRadialEnd;
+    RectSEpts.bottom = YRadialEnd;
+
+    DPRINT("1: StartX: %d, StartY: %d, EndX: %d, EndY: %d\n",
+               RectSEpts.left,RectSEpts.top,RectSEpts.right,RectSEpts.bottom);
+
+    DPRINT("1: Left: %d, Top: %d, Right: %d, Bottom: %d\n",
+               RectBounds.left,RectBounds.top,RectBounds.right,RectBounds.bottom);
+
+    RadiusX = max((RectBounds.right - RectBounds.left) / 2, 1);
+    RadiusY = max((RectBounds.bottom - RectBounds.top) / 2, 1);
+    CenterX = (RectBounds.right + RectBounds.left) / 2;
+    CenterY = (RectBounds.bottom + RectBounds.top) / 2;
+    AngleEnd   = atan2((RectSEpts.bottom - CenterY), RectSEpts.right -
CenterX)*(360.0/(M_PI*2));
+    AngleStart = atan2((RectSEpts.top - CenterY), RectSEpts.left -
CenterX)*(360.0/(M_PI*2));
+
+    SfCx = (Rcos(AngleStart) * RadiusX);
+    SfCy = (Rsin(AngleStart) * RadiusY);
+    EfCx = (Rcos(AngleEnd) * RadiusX);
+    EfCy = (Rsin(AngleEnd) * RadiusY);
+
+    BrushOrg.x = 0;
+    BrushOrg.y = 0;
+
+    if ((arctype == GdiTypePie) || (arctype == GdiTypeChord))
+    {
+        GreUpdateBrush(dc->pFillBrush, dc);
+        GrepFillArc( dc,
+              RectBounds.left,
+              RectBounds.top,
+              abs(RectBounds.right-RectBounds.left), // Width
+              abs(RectBounds.bottom-RectBounds.top), // Height
+              AngleStart,
+              AngleEnd,
+              arctype,
+              &BrushOrg);
+    }
+
+    ret = GrepDrawArc( dc,
+              RectBounds.left,
+              RectBounds.top,
+              abs(RectBounds.right-RectBounds.left), // Width
+              abs(RectBounds.bottom-RectBounds.top), // Height
+              AngleStart,
+              AngleEnd,
+              arctype,
+              pbrushPen,
+              &BrushOrg);
+
+    psurf = dc->pBitmap;
+    if (NULL == psurf)
+    {
+        DPRINT1("Arc Fail 2\n");
+        SetLastWin32Error(ERROR_INTERNAL_ERROR);
+        return FALSE;
+    }
+
+    if (arctype == GdiTypePie)
+    {
+       PUTLINE(CenterX, CenterY, SfCx + CenterX, SfCy + CenterY, dc->pLineBrush);
+       PUTLINE(EfCx + CenterX, EfCy + CenterY, CenterX, CenterY, dc->pLineBrush);
+    }
+    if (arctype == GdiTypeChord)
+        PUTLINE(EfCx + CenterX, EfCy + CenterY, SfCx + CenterX, SfCy + CenterY,
dc->pLineBrush);
+
+    pbrushPen->ptPenWidth.x = PenOrigWidth;
+
+    return ret;
+}
+
+/* EOF */
Propchange: branches/arwinss/reactos/subsystems/win32/win32k/gre/arc.c
------------------------------------------------------------------------------
    svn:eol-style = native
Copied: branches/arwinss/reactos/subsystems/win32/win32k/gre/drawing.c (from r45537,
trunk/reactos/subsystems/win32/win32k/objects/drawing.c)
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/drawing.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/gre/drawing.c [iso-8859-1] Thu Feb 11
22:58:21 2010
@@ -49,11 +49,12 @@
     Modified for ReactOS
  */
-#include <w32k.h>
-
+#include <win32k.h>
+#include "math.h"
 #define NDEBUG
 #include <debug.h>
+#define INTERNAL_CALL APIENTRY
 #define DEGREES_TO_RADIANS(deg) ((deg)*2*M_PI/360)
@@ -63,8 +64,8 @@
        int width, height;      /* width and height of rect */
 } Rect, *PRect;
-int FASTCALL IntFillRect(DC *dc, INT XLeft, INT YLeft, INT Width, INT Height, PBRUSH
pbrush, BOOL Pen);
-int FASTCALL app_fill_rect(DC *dc, Rect r, PBRUSH pbrush, BOOL Pen);
+int FASTCALL IntFillRect(DC *dc, INT XLeft, INT YLeft, INT Width, INT Height, PBRUSHGDI
pbrush, PPOINTL BrushOrg, BOOL Pen);
+int FASTCALL app_fill_rect(DC *dc, Rect r, PBRUSHGDI pbrush, BOOL Pen);
 static
 POINT
@@ -104,8 +105,8 @@
  *  is no way for the program to know which portions of the
  *  window are currently obscured.
  */
-#define app_fill_rect( dc, r, BrushObj, Pen) \
-        IntFillRect(dc, r.x, r.y, r.width, r.height, BrushObj, Pen)
+#define app_fill_rect( dc, r, BrushObj, BrushOrg, Pen) \
+        IntFillRect(dc, r.x, r.y, r.width, r.height, BrushObj, BrushOrg, Pen)
 /*
  *  Drawing an ellipse with a certain line thickness.
@@ -121,7 +122,7 @@
 static
 int
 INTERNAL_CALL
-app_draw_ellipse(DC *g, Rect r, PBRUSH pbrush)
+app_draw_ellipse(DC *g, Rect r, PBRUSHGDI pbrush, PPOINTL brushOrg)
 {
        /* Outer ellipse: e(x,y) = b*b*x*x + a*a*y*y - a*a*b*b */
@@ -165,7 +166,7 @@
 //     START_DEBUG();
        if ((r.width <= 2) || (r.height <= 2))
-               return app_fill_rect(g, r, pbrush, TRUE);
+               return app_fill_rect(g, r, pbrush, brushOrg, TRUE);
        r1.x = r.x + a;
        r1.y = r.y;
@@ -264,8 +265,8 @@
                        if ((r1.y < r.y+w) || (r1.x+W >= r1.x+r1.width-W))
                        {
-                               result &= app_fill_rect(g, r1, pbrush, TRUE);
-                               result &= app_fill_rect(g, r2, pbrush, TRUE);
+                               result &= app_fill_rect(g, r1, pbrush, brushOrg,
TRUE);
+                               result &= app_fill_rect(g, r2, pbrush, brushOrg,
TRUE);
                                prevx = r1.x;
                                prevy = r1.y;
@@ -274,13 +275,13 @@
                        {
                                /* draw distinct rectangles */
                                result &= app_fill_rect(g, rect(r1.x,r1.y,
-                                               W,1), pbrush, TRUE);
+                                               W,1), pbrush, brushOrg, TRUE);
                                result &= app_fill_rect(g, rect(
-                                               r1.x+r1.width-W,r1.y,W,1), pbrush, TRUE);
+                                               r1.x+r1.width-W,r1.y,W,1), pbrush,
brushOrg, TRUE);
                                result &= app_fill_rect(g, rect(r2.x,
-                                               r2.y,W,1), pbrush, TRUE);
+                                               r2.y,W,1), pbrush, brushOrg, TRUE);
                                result &= app_fill_rect(g, rect(
-                                               r2.x+r2.width-W,r2.y,W,1), pbrush, TRUE);
+                                               r2.x+r2.width-W,r2.y,W,1), pbrush,
brushOrg, TRUE);
                                prevx = r1.x;
                                prevy = r1.y;
@@ -310,13 +311,13 @@
                if (W+W >= r.width) {
                        result &= app_fill_rect(g, rect(r.x, r1.y,
-                               r.width, r1.height), pbrush, TRUE);
+                               r.width, r1.height), pbrush, brushOrg, TRUE);
                        return result;
                }
-               result &= app_fill_rect(g, rect(r.x, r1.y, W, r1.height), pbrush,
TRUE);
+               result &= app_fill_rect(g, rect(r.x, r1.y, W, r1.height), pbrush,
brushOrg, TRUE);
                result &= app_fill_rect(g, rect(r.x+r.width-W, r1.y,
-                       W, r1.height), pbrush, TRUE);
+                       W, r1.height), pbrush, brushOrg, TRUE);
        }
        return result;
 }
@@ -364,7 +365,8 @@
        POINT p2, // End
        int start_angle,
        int end_angle,
-       PBRUSH pbrush,
+       PBRUSHGDI pbrush,
+       PPOINTL brushOrg,
        BOOL Pen)
 {
        int x1, x2;
@@ -440,36 +442,36 @@
                        {
                                /* fill outsides of wedge */
                                if (! app_fill_rect(g, rect(r.x, r.y,
-                                       x1-r.x, r.height), pbrush, Pen))
+                                       x1-r.x, r.height), pbrush, brushOrg, Pen))
                                        return 0;
                                return app_fill_rect(g, rect(x2, r.y,
-                                       r.x+r.width-x2, r.height), pbrush, Pen);
+                                       r.x+r.width-x2, r.height), pbrush, brushOrg, Pen);
                        }
                        else
                        {
                                /* fill inside of wedge */
                                r.width = x1-x2;
                                r.x = x2;
-                               return app_fill_rect(g, r, pbrush, Pen);
+                               return app_fill_rect(g, r, pbrush, brushOrg, Pen);
                        }
                }
                else if (start_above)
                {
                        /* fill to the left of the start_line */
                        r.width = x1-r.x;
-                       return app_fill_rect(g, r, pbrush, Pen);
+                       return app_fill_rect(g, r, pbrush, brushOrg, Pen);
                }
                else if (end_above)
                {
                        /* fill right of end_line */
                        r.width = r.x+r.width-x2;
                        r.x = x2;
-                       return app_fill_rect(g, r, pbrush, Pen);
+                       return app_fill_rect(g, r, pbrush, brushOrg, Pen);
                }
                else
                {
                        if (start_angle > end_angle)
-                               return app_fill_rect(g,r, pbrush, Pen);
+                               return app_fill_rect(g,r, pbrush, brushOrg, Pen);
                        else
                                return 1;
                }
@@ -535,7 +537,7 @@
                if (start_above && end_above)
                {
                        if (start_angle > end_angle)
-                               return app_fill_rect(g,r, pbrush, Pen);
+                               return app_fill_rect(g,r, pbrush, brushOrg, Pen);
                        else
                                return 1;
                }
@@ -543,14 +545,14 @@
                {
                        /* fill to the left of end_line */
                        r.width = x2-r.x;
-                       return app_fill_rect(g,r, pbrush, Pen);
+                       return app_fill_rect(g,r, pbrush, brushOrg, Pen);
                }
                else if (end_above)
                {
                        /* fill right of start_line */
                        r.width = r.x+r.width-x1;
                        r.x = x1;
-                       return app_fill_rect(g,r, pbrush, Pen);
+                       return app_fill_rect(g,r, pbrush, brushOrg, Pen);
                }
                else
                {
@@ -558,17 +560,17 @@
                        {
                                /* fill outsides of wedge */
                                if (! app_fill_rect(g, rect(r.x, r.y,
-                                       x2-r.x, r.height), pbrush, Pen))
+                                       x2-r.x, r.height), pbrush, brushOrg, Pen))
                                        return 0;
                                return app_fill_rect(g, rect(x1, r.y,
-                                       r.x+r.width-x1, r.height), pbrush, Pen);
+                                       r.x+r.width-x1, r.height), pbrush, brushOrg, Pen);
                        }
                        else
                        {
                                /* fill inside of wedge */
                                r.width = x2-x1;
                                r.x = x1;
-                               return app_fill_rect(g, r, pbrush, Pen);
+                               return app_fill_rect(g, r, pbrush, brushOrg, Pen);
                        }
                }
        }
@@ -604,7 +606,7 @@
 static
 int
 FASTCALL
-app_fill_ellipse(DC *g, Rect r, PBRUSH pbrush)
+app_fill_ellipse(DC *g, Rect r, PBRUSHGDI pbrush, PPOINTL brushOrg)
 {
        /* e(x,y) = b*b*x*x + a*a*y*y - a*a*b*b */
@@ -627,7 +629,7 @@
 //     START_DEBUG();
        if ((r.width <= 2) || (r.height <= 2))
-               return app_fill_rect(g, r, pbrush, FALSE);
+               return app_fill_rect(g, r, pbrush, brushOrg, FALSE);
        r1.x = r.x + a;
        r1.y = r.y;
@@ -673,8 +675,8 @@
                                if (r1.y+r1.height < r2.y) {
                                        /* distinct rectangles */
-                                       result &= app_fill_rect(g, r1, pbrush, FALSE);
-                                       result &= app_fill_rect(g, r2, pbrush, FALSE);
+                                       result &= app_fill_rect(g, r1, pbrush,
brushOrg, FALSE);
+                                       result &= app_fill_rect(g, r2, pbrush,
brushOrg, FALSE);
                                }
                                /* move down */
@@ -699,7 +701,7 @@
                r1.x = r.x;
                r1.width = r.width;
                r1.height = r2.y+r2.height-r1.y;
-               result &= app_fill_rect(g, r1, pbrush, FALSE);
+               result &= app_fill_rect(g, r1, pbrush, brushOrg, FALSE);
        }
        else if (x <= a) {
                /* crossover, draw final line */
@@ -707,7 +709,7 @@
                r1.width = r.width;
                r1.height = r1.y+r1.height-r2.y;
                r1.y = r2.y;
-               result &= app_fill_rect(g, r1, pbrush, FALSE);
+               result &= app_fill_rect(g, r1, pbrush, brushOrg, FALSE);
        }
        return result;
 }
@@ -759,7 +761,7 @@
 int
 FASTCALL
-app_fill_arc(DC *g, Rect r, int start_angle, int end_angle, PBRUSH pbrush, BOOL Chord)
+app_fill_arc(DC *g, Rect r, int start_angle, int end_angle, PBRUSHGDI pbrush, PPOINTL
brushOrg, BOOL Chord)
 {
        /* e(x,y) = b*b*x*x + a*a*y*y - a*a*b*b */
@@ -789,7 +791,7 @@
        if ((start_angle + 360 <= end_angle) ||
            (start_angle - 360 >= end_angle))
        {
-               return app_fill_ellipse(g, r, pbrush);
+               return app_fill_ellipse(g, r, pbrush, brushOrg);
        }
        /* make start_angle >= 0 and <= 360 */
@@ -875,10 +877,10 @@
                                /* distinct rectangles */
                                result &= app_fill_arc_rect(g, r1,
                                                p0, p1, p2,
-                                               start_angle, end_angle, pbrush, FALSE);
+                                               start_angle, end_angle, pbrush, brushOrg,
FALSE);
                                result &= app_fill_arc_rect(g, r2,
                                                p0, p1, p2,
-                                               start_angle, end_angle, pbrush, FALSE);
+                                               start_angle, end_angle, pbrush, brushOrg,
FALSE);
                        }
                        /* move down */
@@ -900,7 +902,7 @@
                while (r1.height > 0) {
                        result &= app_fill_arc_rect(g,
                                rect(r1.x, r1.y, r1.width, 1),
-                               p0, p1, p2, start_angle, end_angle, pbrush, FALSE);
+                               p0, p1, p2, start_angle, end_angle, pbrush, brushOrg,
FALSE);
                        r1.y += 1;
                        r1.height -= 1;
                }
@@ -914,7 +916,7 @@
                while (r1.height > 0) {
                        result &= app_fill_arc_rect(g,
                                rect(r1.x, r1.y, r1.width, 1),
-                               p0, p1, p2, start_angle, end_angle, pbrush, FALSE);
+                               p0, p1, p2, start_angle, end_angle, pbrush, brushOrg,
FALSE);
                        r1.y += 1;
                        r1.height -= 1;
                }
@@ -922,7 +924,7 @@
        return result;
 }
-int app_draw_arc(DC *g, Rect r, int start_angle, int end_angle, PBRUSH pbrushPen, BOOL
Chord)
+int app_draw_arc(DC *g, Rect r, int start_angle, int end_angle, PBRUSHGDI pbrushPen,
PPOINTL brushOrg, BOOL Chord)
 {
        /* Outer ellipse: e(x,y) = b*b*x*x + a*a*y*y - a*a*b*b */
@@ -973,7 +975,7 @@
        if ((start_angle + 360 <= end_angle) ||
            (start_angle - 360 >= end_angle))
        {
-               return app_draw_ellipse(g, r, pbrushPen);
+               return app_draw_ellipse(g, r, pbrushPen, brushOrg);
        }
        /* make start_angle >= 0 and <= 360 */
@@ -1098,10 +1100,10 @@
                        {
                                result &= app_fill_arc_rect(g, r1,
                                                p0, p1, p2,
-                                               start_angle, end_angle, pbrushPen, TRUE);
+                                               start_angle, end_angle, pbrushPen,
brushOrg, TRUE);
                                result &= app_fill_arc_rect(g, r2,
                                                p0, p1, p2,
-                                               start_angle, end_angle, pbrushPen, TRUE);
+                                               start_angle, end_angle, pbrushPen,
brushOrg, TRUE);
                                prevx = r1.x;
                                prevy = r1.y;
@@ -1112,19 +1114,19 @@
                                result &= app_fill_arc_rect(g, rect(
                                                r1.x,r1.y,W,1),
                                                p0, p1, p2,
-                                               start_angle, end_angle, pbrushPen, TRUE);
+                                               start_angle, end_angle, pbrushPen,
brushOrg, TRUE);
                                result &= app_fill_arc_rect(g, rect(
                                                r1.x+r1.width-W,r1.y,W,1),
                                                p0, p1, p2,
-                                               start_angle, end_angle, pbrushPen, TRUE);
+                                               start_angle, end_angle, pbrushPen,
brushOrg, TRUE);
                                result &= app_fill_arc_rect(g, rect(
                                                r2.x,r2.y,W,1),
                                                p0, p1, p2,
-                                               start_angle, end_angle, pbrushPen, TRUE);
+                                               start_angle, end_angle, pbrushPen,
brushOrg, TRUE);
                                result &= app_fill_arc_rect(g, rect(
                                                r2.x+r2.width-W,r2.y,W,1),
                                                 p0, p1, p2,
-                                               start_angle, end_angle, pbrushPen, TRUE);
+                                               start_angle, end_angle, pbrushPen,
brushOrg, TRUE);
                                prevx = r1.x;
                                prevy = r1.y;
@@ -1156,7 +1158,7 @@
                        while (r1.height > 0) {
                                result &= app_fill_arc_rect(g, rect(r.x,
                                        r1.y, r.width, 1), p0, p1, p2,
-                                       start_angle, end_angle, pbrushPen, TRUE);
+                                       start_angle, end_angle, pbrushPen, brushOrg,
TRUE);
                                r1.y += 1;
                                r1.height -= 1;
                        }
@@ -1166,10 +1168,10 @@
                while (r1.height > 0) {
                        result &= app_fill_arc_rect(g, rect(r.x, r1.y,
                                        W, 1), p0, p1, p2,
-                                       start_angle, end_angle, pbrushPen, TRUE);
+                                       start_angle, end_angle, pbrushPen, brushOrg,
TRUE);
                        result &= app_fill_arc_rect(g, rect(r.x+r.width-W,
                                        r1.y, W, 1), p0, p1, p2,
-                                       start_angle, end_angle, pbrushPen, TRUE);
+                                       start_angle, end_angle, pbrushPen, brushOrg,
TRUE);
                        r1.y += 1;
                        r1.height -= 1;
                }
@@ -1179,7 +1181,6 @@
 }
 /* ReactOS Interface *********************************************************/
-
 int
 FASTCALL
 IntFillRect( DC *dc,
@@ -1187,111 +1188,69 @@
              INT YLeft,
              INT Width,
              INT Height,
-             PBRUSH pbrush,
+             PBRUSHGDI pbrush,
+             PPOINTL BrushOrigin,
              BOOL Pen)
 {
-  DWORD ROP = PATCOPY;
-  RECTL DestRect;
-  SURFACE *psurf;
-  POINTL BrushOrigin;
-  BOOL Ret = TRUE;
-  PDC_ATTR pdcattr;
-
-  ASSERT(pbrush);
-
-  psurf = dc->dclevel.pSurface;
-  if (psurf == NULL)
-  {
-      SetLastWin32Error(ERROR_INVALID_HANDLE);
-      return 0;
-  }
-
-  if (!(pbrush->flAttrs & GDIBRUSH_IS_NULL))
-  {
-     pdcattr = dc->pdcattr;
-
-     /* fix negative spaces */
-     if (Width < 0)
-     {
-       XLeft += Width;
-       Width = 0 - Width;
-     }
-     if (Height < 0)
-     {
-       YLeft += Height;
-       Height = 0 - Height;
-     }
-
-     DestRect.left = XLeft;
-     DestRect.right = XLeft + Width;
-
-     DestRect.top = YLeft;
-     DestRect.bottom = YLeft + Height;
-
-     BrushOrigin.x = pbrush->ptOrigin.x;
-     BrushOrigin.y = pbrush->ptOrigin.y;
-
-     if (pdcattr->jROP2 == R2_XORPEN)
-        ROP = PATINVERT;
-     else
-        ROP = PATCOPY;
-
-     Ret = IntEngBitBlt(
-         &psurf->SurfObj,
-         NULL,
-         NULL,
-         dc->rosdc.CombinedClip,
-         NULL,
-         &DestRect,
-         NULL,
-         NULL,
-         Pen ? &dc->eboLine.BrushObject : &dc->eboFill.BrushObject,
-         &BrushOrigin,
-         ROP3_TO_ROP4(ROP));
-  }
-
-  return (int)Ret;
+    DWORD ROP = PATCOPY;
+    RECTL DestRect;
+    SURFACE *psurf;
+    BOOL Ret = TRUE;
+
+    ASSERT(pbrush);
+
+    psurf = dc->pBitmap;
+    if (psurf == NULL)
+    {
+        SetLastWin32Error(ERROR_INVALID_HANDLE);
+        return 0;
+    }
+
+    if (!(pbrush->flAttrs & GDIBRUSH_IS_NULL))
+    {
+        /* fix negative spaces */
+        if (Width < 0)
+        {
+            XLeft += Width;
+            Width = 0 - Width;
+        }
+        if (Height < 0)
+        {
+            YLeft += Height;
+            Height = 0 - Height;
+        }
+
+        DestRect.left = XLeft;
+        DestRect.right = XLeft + Width;
+
+        DestRect.top = YLeft;
+        DestRect.bottom = YLeft + Height;
+
+        //if (pdcattr->jROP2 == R2_XORPEN)
+        //   ROP = PATINVERT;
+        //else
+            ROP = PATCOPY;
+
+        GrepBitBltEx(&psurf->SurfObj,
+                     NULL,
+                     NULL,
+                     dc->CombinedClip,
+                     NULL,
+                     &DestRect,
+                     NULL,
+                     NULL,
+                     Pen ? &dc->pLineBrush->BrushObj :
&dc->pFillBrush->BrushObj,
+                     BrushOrigin,
+                     ROP3_TO_ROP4(ROP),
+                     TRUE);
+    }
+
+    return (int)Ret;
 }
-BOOL
-FASTCALL
-IntFillArc( PDC dc,
-            INT XLeft,
-            INT YLeft,
-            INT Width,
-            INT Height,
-            double StartArc,
-            double EndArc,
-            ARCTYPE arctype)
-{
-  PDC_ATTR pdcattr;
-  PBRUSH pbrush;
-  int Start = ceil(StartArc);
-  int End   = ceil(EndArc);
-  BOOL Chord = (arctype == GdiTypeChord), ret;
-
-  pdcattr = dc->pdcattr;
-
-  pbrush = BRUSH_LockBrush(pdcattr->hbrush);
-  if (!pbrush)
-  {
-      DPRINT1("FillArc Fail\n");
-      SetLastWin32Error(ERROR_INTERNAL_ERROR);
-      return FALSE;
-  }
-  // Sort out alignment here.
-  ret = app_fill_arc(dc, rect( XLeft, YLeft, Width, Height),
-                    (dc->dclevel.flPath & DCPATH_CLOCKWISE) ? -End : -Start,
-                    (dc->dclevel.flPath & DCPATH_CLOCKWISE) ? -Start : -End,
-                     pbrush, Chord);
-
-  BRUSH_UnlockBrush(pbrush);
-  return ret;
-}
-
-BOOL
-FASTCALL
-IntDrawArc( PDC dc,
+VOID
+APIENTRY
+GrepFillArc( PDC dc,
             INT XLeft,
             INT YLeft,
             INT Width,
@@ -1299,42 +1258,69 @@
             double StartArc,
             double EndArc,
             ARCTYPE arctype,
-            PBRUSH pbrush)
+            PPOINTL BrushOrigin)
+{
+  int Start = ceil(StartArc);
+  int End   = ceil(EndArc);
+  BOOL Chord = (arctype == GdiTypeChord), ret;
+
+  // Sort out alignment here.
+  ret = app_fill_arc(dc, rect( XLeft, YLeft, Width, Height),
+                    -End, //(dc->dclevel.flPath & DCPATH_CLOCKWISE) ? -End :
-Start,
+                    -Start, //(dc->dclevel.flPath & DCPATH_CLOCKWISE) ? -Start :
-End,
+                     dc->pFillBrush, BrushOrigin, Chord);
+}
+
+BOOLEAN
+APIENTRY
+GrepDrawArc( PDC dc,
+            INT XLeft,
+            INT YLeft,
+            INT Width,
+            INT Height,
+            double StartArc,
+            double EndArc,
+            ARCTYPE arctype,
+            PBRUSHGDI pbrush,
+            PPOINTL BrushOrigin)
 {
   int Start = ceil(StartArc);
   int End   = ceil(EndArc);
   BOOL Chord = (arctype == GdiTypeChord);
   // Sort out alignment here.
   return app_draw_arc(dc, rect( XLeft, YLeft, Width, Height),
-                     (dc->dclevel.flPath & DCPATH_CLOCKWISE) ? -End : -Start,
-                     (dc->dclevel.flPath & DCPATH_CLOCKWISE) ? -Start : -End,
-                      pbrush, Chord);
+                     -End, //(dc->dclevel.flPath & DCPATH_CLOCKWISE) ? -End :
-Start,
+                     -Start, //(dc->dclevel.flPath & DCPATH_CLOCKWISE) ? -Start :
-End,
+                      pbrush, BrushOrigin, Chord);
 }
-BOOL
-FASTCALL
-IntDrawEllipse( PDC dc,
+BOOLEAN
+APIENTRY
+GrepDrawEllipse(PDC dc,
                 INT XLeft,
                 INT YLeft,
                 INT Width,
                 INT Height,
-                PBRUSH pbrush)
-{
-  return (BOOL)app_draw_ellipse(dc, rect( XLeft, YLeft, Width, Height), pbrush);
+                PBRUSHGDI pbrush,
+                PPOINTL brushOrg)
+{
+  return (BOOLEAN)app_draw_ellipse(dc, rect( XLeft, YLeft, Width, Height), pbrush,
brushOrg);
 }
-BOOL
-FASTCALL
-IntFillEllipse( PDC dc,
+BOOLEAN
+APIENTRY
+GrepFillEllipse(PDC dc,
                 INT XLeft,
                 INT YLeft,
                 INT Width,
-                INT Height,
-                PBRUSH pbrush)
-{
-  return (BOOL)app_fill_ellipse(dc, rect( XLeft, YLeft, Width, Height), pbrush);
+                INT Height,
+                PBRUSHGDI pbrush,
+                PPOINTL brushOrg)
+{
+  return (BOOLEAN)app_fill_ellipse(dc, rect( XLeft, YLeft, Width, Height), pbrush,
brushOrg);
 }
+#if 0
 BOOL
 FASTCALL
 IntFillRoundRect( PDC dc,
@@ -1470,4 +1456,4 @@
   }
  return TRUE;
 }
-
+#endif
Added: branches/arwinss/reactos/subsystems/win32/win32k/gre/ellipse.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/gre/ellipse.c (added)
+++ branches/arwinss/reactos/subsystems/win32/win32k/gre/ellipse.c [iso-8859-1] Thu Feb 11
22:58:21 2010
@@ -1,0 +1,100 @@
+/*
+ * PROJECT:         ReactOS Win32K
+ * LICENSE:         LGPL - See COPYING in the top level directory
+ * FILE:            subsystems/win32/win32k/gre/ellipse.c
+ * PURPOSE:         Graphic engine: ellipses
+ * PROGRAMMERS:     Aleksey Bragin <aleksey(a)reactos.org>
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <win32k.h>
+#define NDEBUG
+#include <debug.h>
+
+/* PUBLIC FUNCTIONS **********************************************************/
+
+VOID NTAPI
+GreEllipse(PDC dc,
+           INT Left,
+           INT Top,
+           INT Right,
+           INT Bottom)
+{
+    RECTL RectBounds;
+    BOOLEAN ret = TRUE;
+    LONG PenWidth, PenOrigWidth;
+    LONG RadiusX, RadiusY, CenterX, CenterY;
+    POINTL BrushOrigin;
+    PBRUSHGDI pbrush;
+
+    /* Update line brush and temporarily change its width */
+    GreUpdateBrush(dc->pLineBrush, dc);
+    pbrush = dc->pLineBrush;
+
+    PenOrigWidth = PenWidth = pbrush->ptPenWidth.x;
+    if (pbrush->ulPenStyle == PS_NULL) PenWidth = 0;
+
+    if (pbrush->ulPenStyle == PS_INSIDEFRAME)
+    {
+       if (2*PenWidth > (Right - Left)) PenWidth = (Right -Left + 1)/2;
+       if (2*PenWidth > (Bottom - Top)) PenWidth = (Bottom -Top + 1)/2;
+       Left   += PenWidth / 2;
+       Right  -= (PenWidth - 1) / 2;
+       Top    += PenWidth / 2;
+       Bottom -= (PenWidth - 1) / 2;
+    }
+
+    if (!PenWidth) PenWidth = 1;
+    pbrush->ptPenWidth.x = PenWidth;
+
+    RectBounds.left   = Left;
+    RectBounds.right  = Right;
+    RectBounds.top    = Top;
+    RectBounds.bottom = Bottom;
+
+    // Setup for dynamic width and height.
+    RadiusX = max((RectBounds.right - RectBounds.left) / 2, 2); // Needs room
+    RadiusY = max((RectBounds.bottom - RectBounds.top) / 2, 2);
+    CenterX = (RectBounds.right + RectBounds.left) / 2;
+    CenterY = (RectBounds.bottom + RectBounds.top) / 2;
+
+    DPRINT("Ellipse 1: Left: %d, Top: %d, Right: %d, Bottom: %d\n",
+               RectBounds.left,RectBounds.top,RectBounds.right,RectBounds.bottom);
+
+    DPRINT("Ellipse 2: XLeft: %d, YLeft: %d, Width: %d, Height: %d\n",
+               CenterX - RadiusX, CenterY + RadiusY, RadiusX*2, RadiusY*2);
+
+    BrushOrigin.x = dc->ptBrushOrg.x + dc->rcDcRect.left;
+    BrushOrigin.y = dc->ptBrushOrg.y + dc->rcDcRect.top;
+
+    /* Draw filled part */
+    if (dc->pFillBrush && !(dc->pFillBrush->flAttrs &
GDIBRUSH_IS_NULL))
+    {
+        GreUpdateBrush(dc->pFillBrush, dc);
+        ret = GrepFillEllipse(dc,
+                              CenterX - RadiusX,
+                              CenterY - RadiusY,
+                              RadiusX*2, // Width
+                              RadiusY*2, // Height
+                              dc->pFillBrush,
+                              &BrushOrigin);
+    }
+
+    /* Draw line part */
+    if (ret)
+    {
+        ret = GrepDrawEllipse(dc,
+                              CenterX - RadiusX,
+                              CenterY - RadiusY,
+                              RadiusX*2, // Width
+                              RadiusY*2, // Height
+                              pbrush,
+                              &BrushOrigin);
+    }
+
+    /* Restore changed width */
+    pbrush->ptPenWidth.x = PenOrigWidth;
+}
+
+/* EOF */
Propchange: branches/arwinss/reactos/subsystems/win32/win32k/gre/ellipse.c
------------------------------------------------------------------------------
    svn:eol-style = native
Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/gre.h
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/include/gre.h [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/include/gre.h [iso-8859-1] Thu Feb 11
22:58:21 2010
@@ -1,5 +1,22 @@
 #ifndef __WIN32K_GRE_H
 #define __WIN32K_GRE_H
+
+/* Math stuff */
+#define M_PI_2 1.57079632679489661923
+
+/* arc.c */
+BOOLEAN
+APIENTRY
+GrepArc(PDC  dc,
+        int  Left,
+        int  Top,
+        int  Right,
+        int  Bottom,
+        int  XRadialStart,
+        int  YRadialStart,
+        int  XRadialEnd,
+        int  YRadialEnd,
+        ARCTYPE arctype);
 /* bitblt.c */
 INT NTAPI DIB_GetDIBWidthBytes(INT width, INT depth);
@@ -91,6 +108,61 @@
                                          LPDEVMODEW pDevMode, DWORD dwFlags);
 INT APIENTRY GreGetDeviceCaps(PDC pDC, INT cap);
+/* drawing.c */
+
+VOID
+APIENTRY
+GrepFillArc( PDC dc,
+            INT XLeft,
+            INT YLeft,
+            INT Width,
+            INT Height,
+            double StartArc,
+            double EndArc,
+            ARCTYPE arctype,
+            PPOINTL BrushOrigin);
+
+BOOLEAN
+APIENTRY
+GrepDrawArc( PDC dc,
+            INT XLeft,
+            INT YLeft,
+            INT Width,
+            INT Height,
+            double StartArc,
+            double EndArc,
+            ARCTYPE arctype,
+            PBRUSHGDI pbrush,
+            PPOINTL BrushOrigin);
+
+BOOLEAN
+APIENTRY
+GrepDrawEllipse(PDC dc,
+                INT XLeft,
+                INT YLeft,
+                INT Width,
+                INT Height,
+                PBRUSHGDI pbrush,
+                PPOINTL brushOrg);
+
+BOOLEAN
+APIENTRY
+GrepFillEllipse(PDC dc,
+                INT XLeft,
+                INT YLeft,
+                INT Width,
+                INT Height,
+                PBRUSHGDI pbrush,
+                PPOINTL brushOrg);
+
+/* ellipse.c */
+VOID NTAPI
+GreEllipse(PDC dc,
+           INT Left,
+           INT Top,
+           INT Right,
+           INT Bottom);
+
 /* font.c */
 VOID NTAPI
 GreTextOut(PDC pDC, INT x, INT y, UINT flags,
Propchange: branches/arwinss/reactos/subsystems/win32/win32k/math/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Thu Feb 11 22:58:21 2010
@@ -1,0 +1,2 @@
+([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))?
+(\d+)
Propchange: branches/arwinss/reactos/subsystems/win32/win32k/math/
------------------------------------------------------------------------------
    bugtraq:message = See issue #%BUGID% for more details.
Propchange: branches/arwinss/reactos/subsystems/win32/win32k/math/
------------------------------------------------------------------------------
    bugtraq:url = 
http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: branches/arwinss/reactos/subsystems/win32/win32k/math/
------------------------------------------------------------------------------
    tsvn:logminsize = 10
Propchange: branches/arwinss/reactos/subsystems/win32/win32k/math/i386/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Thu Feb 11 22:58:21 2010
@@ -1,0 +1,2 @@
+([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))?
+(\d+)
Propchange: branches/arwinss/reactos/subsystems/win32/win32k/math/i386/
------------------------------------------------------------------------------
    bugtraq:message = See issue #%BUGID% for more details.
Propchange: branches/arwinss/reactos/subsystems/win32/win32k/math/i386/
------------------------------------------------------------------------------
    bugtraq:url = 
http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: branches/arwinss/reactos/subsystems/win32/win32k/math/i386/
------------------------------------------------------------------------------
    tsvn:logminsize = 10
Modified: branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db [iso-8859-1] Thu Feb 11
22:58:21 2010
@@ -46,14 +46,12 @@
 RosGdiGetSystemPaletteEntries      4
 RosGdiGetTextExtentExPoint         7
 RosGdiGetTextMetrics               2
-RosGdiArc                          9
-RosGdiChord                        9
+RosGdiArc                          10
 RosGdiEllipse                      5
 RosGdiExtEscape                    6
 RosGdiExtFloodFill                 5
 RosGdiExtTextOut                   9
 RosGdiLineTo                       5
-RosGdiPie                          9
 RosGdiPolyPolygon                  4
 RosGdiPolyPolyline                 4
 RosGdiPolygon                      3
Modified: branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild [iso-8859-1] Thu Feb 11
22:58:21 2010
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!DOCTYPE group SYSTEM "../../../tools/rbuild/project.dtd">
 <group>
-<module name="win32k" type="kernelmodedriver"
installbase="system32" installname="win32k.sys">
+<module name="win32k" type="kernelmodedriver"
installbase="system32" installname="win32k.sys"
crt="libcntpr">
        <importlibrary definition="win32k.pspec" />
        <define name="_WIN32K_" />
@@ -95,9 +95,12 @@
                <file>misc.c</file>
        </directory>
        <directory name="gre">
+               <file>arc.c</file>
                <file>bitblt.c</file>
                <file>brushobj.c</file>
                <file>clipobj.c</file>
+               <file>drawing.c</file>
+               <file>ellipse.c</file>
                <file>font.c</file>
                <file>gdiobj.c</file>
                <file>lineto.c</file>
@@ -118,6 +121,17 @@
                <file>monitor.c</file>
                <file>kbdlayout.c</file>
                <file>keyboard.c</file>
+       </directory>
+       <directory name="math">
+               <if property="ARCH" value="i386">
+                       <directory name="i386">
+                               <file>cos_asm.s</file>
+                               <file>sin_asm.s</file>
+                               <file>atan2_asm.s</file>
+                               <file>floor_asm.s</file>
+                               <file>ceil_asm.s</file>
+                       </directory>
+               </if>
        </directory>
        <directory name="swm">
                <file>winman.c</file>