Huw Davies : gdi32: Implement Rectangle().
Alexandre Julliard
julliard at winehq.org
Fri May 13 11:17:52 CDT 2011
Module: wine
Branch: master
Commit: cf290ea6596f734e25fa3a42f0f5200162b6d670
URL: http://source.winehq.org/git/wine.git/?a=commit;h=cf290ea6596f734e25fa3a42f0f5200162b6d670
Author: Huw Davies <huw at codeweavers.com>
Date: Fri May 13 13:28:15 2011 +0100
gdi32: Implement Rectangle().
---
dlls/gdi32/dibdrv/dc.c | 2 +-
dlls/gdi32/dibdrv/dibdrv.h | 1 +
dlls/gdi32/dibdrv/graphics.c | 42 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 44 insertions(+), 1 deletions(-)
diff --git a/dlls/gdi32/dibdrv/dc.c b/dlls/gdi32/dibdrv/dc.c
index 7a11bec..50a7682 100644
--- a/dlls/gdi32/dibdrv/dc.c
+++ b/dlls/gdi32/dibdrv/dc.c
@@ -404,7 +404,7 @@ const DC_FUNCTIONS dib_driver =
NULL, /* pPolylineTo */
NULL, /* pRealizeDefaultPalette */
NULL, /* pRealizePalette */
- NULL, /* pRectangle */
+ dibdrv_Rectangle, /* pRectangle */
NULL, /* pResetDC */
NULL, /* pRestoreDC */
NULL, /* pRoundRect */
diff --git a/dlls/gdi32/dibdrv/dibdrv.h b/dlls/gdi32/dibdrv/dibdrv.h
index a502c72..2ec604c 100644
--- a/dlls/gdi32/dibdrv/dibdrv.h
+++ b/dlls/gdi32/dibdrv/dibdrv.h
@@ -20,6 +20,7 @@
extern BOOL CDECL dibdrv_LineTo( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL CDECL dibdrv_PatBlt( PHYSDEV dev, INT x, INT y, INT width, INT height, DWORD rop ) DECLSPEC_HIDDEN;
+extern BOOL CDECL dibdrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
extern HBRUSH CDECL dibdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush ) DECLSPEC_HIDDEN;
extern HPEN CDECL dibdrv_SelectPen( PHYSDEV dev, HPEN hpen ) DECLSPEC_HIDDEN;
extern COLORREF CDECL dibdrv_SetDCBrushColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
diff --git a/dlls/gdi32/dibdrv/graphics.c b/dlls/gdi32/dibdrv/graphics.c
index c231434..bc7c488 100644
--- a/dlls/gdi32/dibdrv/graphics.c
+++ b/dlls/gdi32/dibdrv/graphics.c
@@ -117,3 +117,45 @@ BOOL CDECL dibdrv_PatBlt( PHYSDEV dev, INT x, INT y, INT width, INT height, DWOR
return TRUE;
}
+
+/***********************************************************************
+ * dibdrv_Rectangle
+ */
+BOOL CDECL dibdrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
+{
+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pRectangle );
+ dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
+ RECT rect = get_device_rect( dev->hdc, left, top, right, bottom );
+ POINT pts[4];
+
+ TRACE("(%p, %d, %d, %d, %d)\n", dev, left, top, right, bottom);
+
+ if(rect.left == rect.right || rect.top == rect.bottom) return TRUE;
+
+ if(defer_pen(pdev) || defer_brush(pdev))
+ return next->funcs->pRectangle( next, left, top, right, bottom );
+
+ reset_dash_origin(pdev);
+
+ /* 4 pts going anti-clockwise starting from top-right */
+ pts[0].x = pts[3].x = rect.right - 1;
+ pts[0].y = pts[1].y = rect.top;
+ pts[1].x = pts[2].x = rect.left;
+ pts[2].y = pts[3].y = rect.bottom - 1;
+
+ pdev->pen_line(pdev, pts , pts + 1);
+ pdev->pen_line(pdev, pts + 1, pts + 2);
+ pdev->pen_line(pdev, pts + 2, pts + 3);
+ pdev->pen_line(pdev, pts + 3, pts );
+
+ /* FIXME: Will need updating when we support wide pens */
+
+ rect.left += 1;
+ rect.top += 1;
+ rect.right -= 1;
+ rect.bottom -= 1;
+
+ pdev->brush_rects(pdev, 1, &rect);
+
+ return TRUE;
+}
More information about the wine-cvs
mailing list