implement PS_USERSTYLE handling, tested with Dia(win32)
Hans Breuer
hans at breuer.org
Sun Mar 29 12:45:05 CDT 2009
From b89af7d06fc8cbf5210c61fd58ed62caeddad968 Mon Sep 17 00:00:00 2001
From: Hans Breuer <hans at breuer.org>
Date: Sun, 29 Mar 2009 18:27:29 +0200
Subject: implement PS_USERSTYLE handling, tested with Dia(win32) - see
http://hans.breuer.org/dia/dia-wine.htm
---
dlls/winex11.drv/pen.c | 31 +++++++++++++++++++++++++++----
1 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/dlls/winex11.drv/pen.c b/dlls/winex11.drv/pen.c
index 49fe74c..039798e 100644
--- a/dlls/winex11.drv/pen.c
+++ b/dlls/winex11.drv/pen.c
@@ -54,12 +54,33 @@ HPEN CDECL X11DRV_SelectPen( X11DRV_PDEVICE *physDev,
HPEN hpen )
elp = HeapAlloc( GetProcessHeap(), 0, size );
GetObjectW( hpen, size, elp );
- /* FIXME: add support for user style pens */
logpen.lopnStyle = elp->elpPenStyle;
logpen.lopnWidth.x = elp->elpWidth;
logpen.lopnWidth.y = 0;
logpen.lopnColor = elp->elpColor;
-
+ /* support for user style pens */
+ if (MAX_DASHLEN < elp->elpNumEntries)
+ {
+ FIXME("PS_USERSTYLE: len(dashes)>MAX_DASHLEN %d,%d\n",
elp->elpNumEntries, MAX_DASHLEN);
+ physDev->pen.dash_len = 0;
+ }
+ else
+ {
+ BOOL overflow = FALSE;
+ physDev->pen.dash_len = elp->elpNumEntries;
+ for (i = 0; i < elp->elpNumEntries; ++i)
+ {
+ if (elp->elpStyleEntry[i] > 255)
+ {
+ overflow = TRUE; /* can't fit the type */
+ physDev->pen.dashes[i] = 255;
+ }
+ else
+ physDev->pen.dashes[i] = (char)elp->elpStyleEntry[i];
+ }
+ if (overflow)
+ FIXME("PS_USERSTYLE: dashes clipped (type overflow)\n");
+ }
HeapFree( GetProcessHeap(), 0, elp );
}
else
@@ -108,14 +129,16 @@ HPEN CDECL X11DRV_SelectPen( X11DRV_PDEVICE *physDev,
HPEN hpen )
memcpy(physDev->pen.dashes, PEN_alternate,
physDev->pen.dash_len);
break;
case PS_USERSTYLE:
- FIXME("PS_USERSTYLE is not supported\n");
+ /* handled above */
+ break;
/* fall through */
default:
physDev->pen.dash_len = 0;
break;
}
if(physDev->pen.ext && physDev->pen.dash_len &&
- (logpen.lopnStyle & PS_STYLE_MASK) != PS_ALTERNATE)
+ (logpen.lopnStyle & PS_STYLE_MASK) != PS_ALTERNATE &&
+ (logpen.lopnStyle & PS_STYLE_MASK) != PS_USERSTYLE)
for(i = 0; i < physDev->pen.dash_len; i++)
physDev->pen.dashes[i] *= (physDev->pen.width ?
physDev->pen.width : 1);
--
1.6.0.6
More information about the wine-patches
mailing list