Alexandre Julliard : gdi32: Compute the correct rectangle interior when using wide pens.

Alexandre Julliard julliard at winehq.org
Wed Dec 28 04:21:00 CST 2011


Module: wine
Branch: master
Commit: 0c840f66ed9734873d9ce76a5f2743f799069bb2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0c840f66ed9734873d9ce76a5f2743f799069bb2

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Dec 27 20:53:35 2011 +0100

gdi32: Compute the correct rectangle interior when using wide pens.

---

 dlls/gdi32/dibdrv/graphics.c |   10 ++++------
 dlls/gdi32/dibdrv/objects.c  |    4 ++--
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/dlls/gdi32/dibdrv/graphics.c b/dlls/gdi32/dibdrv/graphics.c
index e8daa69..f319849 100644
--- a/dlls/gdi32/dibdrv/graphics.c
+++ b/dlls/gdi32/dibdrv/graphics.c
@@ -590,12 +590,10 @@ BOOL dibdrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
 
     pdev->pen_lines(pdev, 4, pts, TRUE);
 
-    /* FIXME: Will need updating when we support wide pens */
-
-    rect.left   += 1;
-    rect.top    += 1;
-    rect.right  -= 1;
-    rect.bottom -= 1;
+    rect.left   += (pdev->pen_width + 1) / 2;
+    rect.top    += (pdev->pen_width + 1) / 2;
+    rect.right  -= (pdev->pen_width + 2) / 2;
+    rect.bottom -= (pdev->pen_width + 2) / 2;
 
     brush_rect( pdev, &rect, GetROP2(dev->hdc) );
 
diff --git a/dlls/gdi32/dibdrv/objects.c b/dlls/gdi32/dibdrv/objects.c
index 626511c..fe83dec 100644
--- a/dlls/gdi32/dibdrv/objects.c
+++ b/dlls/gdi32/dibdrv/objects.c
@@ -1266,9 +1266,9 @@ static inline int get_pen_device_width( dibdrv_physdev *pdev, LOGPEN *pen )
         pts[0].x = pts[0].y = pts[1].y = 0;
         pts[1].x = width;
         LPtoDP( pdev->dev.hdc, pts, 2 );
-        width = max( abs( pts[1].x - pts[0].x ), 1 );
+        width = abs( pts[1].x - pts[0].x );
     }
-    return width;
+    return max( width, 1 );
 }
 
 /***********************************************************************




More information about the wine-cvs mailing list