wineps PaintRgn

Huw D M Davies h.davies1 at physics.ox.ac.uk
Mon Nov 3 10:27:10 CST 2003


        Huw Davies <huw at codeweavers.com>
        Implement PSDRV_PaintRgn (also gets us FillRgn, FrameRgn and FillPath
        for free).
-- 
Huw Davies
huw at codeweavers.com

Index: dlls/wineps/graphics.c
===================================================================
RCS file: /home/wine/wine/dlls/wineps/graphics.c,v
retrieving revision 1.11
diff -u -r1.11 graphics.c
--- dlls/wineps/graphics.c	19 May 2003 19:06:47 -0000	1.11
+++ dlls/wineps/graphics.c	3 Nov 2003 16:23:17 -0000
@@ -98,7 +98,6 @@
       return TRUE;
     }
 
-    PSDRV_WriteSpool(physDev, "%Rectangle\n",11); 
     PSDRV_SetPen(physDev);
 
     PSDRV_SetClip(physDev);
@@ -413,4 +412,42 @@
     PSDRV_WriteGRestore(physDev);
     PSDRV_ResetClip(physDev);
     return color;
+}
+
+/***********************************************************************
+ *           PSDRV_PaintRgn
+ */
+BOOL PSDRV_PaintRgn( PSDRV_PDEVICE *physDev, HRGN hrgn )
+{
+    
+    RGNDATA *rgndata = NULL;
+    RECT *pRect;
+    DWORD size, i;
+
+    TRACE("hdc=%p\n", physDev->hdc);
+
+    size = GetRegionData(hrgn, 0, NULL);
+    rgndata = HeapAlloc( GetProcessHeap(), 0, size );
+    if(!rgndata) {
+        ERR("Can't allocate buffer\n");
+        return FALSE;
+    }
+    
+    GetRegionData(hrgn, size, rgndata);
+    if (rgndata->rdh.nCount == 0)
+        goto end;
+
+    LPtoDP(physDev->hdc, (POINT*)rgndata->Buffer, rgndata->rdh.nCount * 2);
+
+    PSDRV_SetClip(physDev);
+    PSDRV_WriteNewPath(physDev);
+    for(i = 0, pRect = (RECT*)rgndata->Buffer; i < rgndata->rdh.nCount; i++, pRect++)
+        PSDRV_WriteRectangle(physDev, pRect->left, pRect->top, pRect->right - pRect->left, pRect->bottom - pRect->top);
+
+    PSDRV_Brush(physDev, 0);
+    PSDRV_ResetClip(physDev);
+
+ end:
+    HeapFree(GetProcessHeap(), 0, rgndata);
+    return TRUE;
 }
Index: dlls/wineps/wineps.spec
===================================================================
RCS file: /home/wine/wine/dlls/wineps/wineps.spec,v
retrieving revision 1.21
diff -u -r1.21 wineps.spec
--- dlls/wineps/wineps.spec	4 Nov 2002 23:53:43 -0000	1.21
+++ dlls/wineps/wineps.spec	3 Nov 2003 16:23:17 -0000
@@ -17,6 +17,7 @@
 @ cdecl GetTextExtentPoint(ptr ptr long ptr) PSDRV_GetTextExtentPoint
 @ cdecl GetTextMetrics(ptr ptr) PSDRV_GetTextMetrics
 @ cdecl LineTo(ptr long long) PSDRV_LineTo
+@ cdecl PaintRgn(ptr long) PSDRV_PaintRgn
 @ cdecl PatBlt(ptr long long long long long) PSDRV_PatBlt
 @ cdecl Pie(ptr long long long long long long long long) PSDRV_Pie
 @ cdecl PolyPolygon(ptr ptr ptr long) PSDRV_PolyPolygon



More information about the wine-patches mailing list