From 18c20964e1e22f9aa974cc774bf77da6fc013716 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 28 Dec 2011 11:06:30 +0100 Subject: [PATCH] gdi32: Add support for PS_INSIDEFRAME pens when drawing rectangles. --- dlls/gdi32/dibdrv/dibdrv.h | 2 +- dlls/gdi32/dibdrv/graphics.c | 8 ++++++++ dlls/gdi32/dibdrv/objects.c | 8 ++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/dlls/gdi32/dibdrv/dibdrv.h b/dlls/gdi32/dibdrv/dibdrv.h index 31c878379da..85aa2cfede0 100644 --- a/dlls/gdi32/dibdrv/dibdrv.h +++ b/dlls/gdi32/dibdrv/dibdrv.h @@ -83,7 +83,7 @@ typedef struct dibdrv_physdev /* pen */ COLORREF pen_colorref; - DWORD pen_endcap, pen_join; + DWORD pen_style, pen_endcap, pen_join; int pen_width; dash_pattern pen_pattern; dash_pos dash_pos; diff --git a/dlls/gdi32/dibdrv/graphics.c b/dlls/gdi32/dibdrv/graphics.c index f3198499a0b..c84cce23ddd 100644 --- a/dlls/gdi32/dibdrv/graphics.c +++ b/dlls/gdi32/dibdrv/graphics.c @@ -580,6 +580,14 @@ BOOL dibdrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) if(defer_pen(pdev)) return next->funcs->pRectangle( next, left, top, right, bottom ); + if (pdev->pen_style == PS_INSIDEFRAME) + { + rect.left += pdev->pen_width / 2; + rect.top += pdev->pen_width / 2; + rect.right -= (pdev->pen_width - 1) / 2; + rect.bottom -= (pdev->pen_width - 1) / 2; + } + reset_dash_origin(pdev); /* 4 pts going anti-clockwise starting from top-right */ diff --git a/dlls/gdi32/dibdrv/objects.c b/dlls/gdi32/dibdrv/objects.c index fe83decf74c..79ae0478f9c 100644 --- a/dlls/gdi32/dibdrv/objects.c +++ b/dlls/gdi32/dibdrv/objects.c @@ -1279,7 +1279,6 @@ HPEN dibdrv_SelectPen( PHYSDEV dev, HPEN hpen ) PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSelectPen ); dibdrv_physdev *pdev = get_dibdrv_pdev(dev); LOGPEN logpen; - DWORD style; TRACE("(%p, %p)\n", dev, hpen); @@ -1315,11 +1314,12 @@ HPEN dibdrv_SelectPen( PHYSDEV dev, HPEN hpen ) pdev->defer |= DEFER_PEN; - style = logpen.lopnStyle & PS_STYLE_MASK; + pdev->pen_style = logpen.lopnStyle & PS_STYLE_MASK; - switch(style) + switch (pdev->pen_style) { case PS_SOLID: + case PS_INSIDEFRAME: if(pdev->pen_width <= 1) pdev->pen_lines = solid_pen_lines; else @@ -1334,7 +1334,7 @@ HPEN dibdrv_SelectPen( PHYSDEV dev, HPEN hpen ) if(logpen.lopnStyle & PS_GEOMETRIC) break; if(logpen.lopnWidth.x > 1) break; pdev->pen_lines = dashed_pen_lines; - pdev->pen_pattern = dash_patterns[style]; + pdev->pen_pattern = dash_patterns[pdev->pen_style]; pdev->defer &= ~DEFER_PEN; break;