winex11.drv: Draw dashed lines for extended pens.

This commit is contained in:
Evan Stade 2007-07-18 19:40:24 -07:00 committed by Alexandre Julliard
parent 12d3905427
commit 9b9e08c210
3 changed files with 38 additions and 19 deletions

View File

@ -243,10 +243,11 @@ BOOL X11DRV_SetupGCForPen( X11DRV_PDEVICE *physDev )
val.join_style = JoinRound; val.join_style = JoinRound;
} }
wine_tsx11_lock(); wine_tsx11_lock();
if (physDev->pen.width <= 1 && physDev->pen.dash_len) if (physDev->pen.dash_len)
{ {
XSetDashes( gdi_display, physDev->gc, 0, physDev->pen.dashes, physDev->pen.dash_len ); XSetDashes( gdi_display, physDev->gc, 0, physDev->pen.dashes, physDev->pen.dash_len );
val.line_style = (GetBkMode(physDev->hdc) == OPAQUE) ? LineDoubleDash : LineOnOffDash; val.line_style = ((GetBkMode(physDev->hdc) == OPAQUE) && (!physDev->pen.ext))
? LineDoubleDash : LineOnOffDash;
} }
else val.line_style = LineSolid; else val.line_style = LineSolid;

View File

@ -36,6 +36,11 @@ HPEN X11DRV_SelectPen( X11DRV_PDEVICE *physDev, HPEN hpen )
static char PEN_dashdot[] = { 12,8,4,8 }; static char PEN_dashdot[] = { 12,8,4,8 };
static char PEN_dashdotdot[] = { 12,4,4,4,4,4 }; static char PEN_dashdotdot[] = { 12,4,4,4,4,4 };
static char PEN_alternate[] = { 1,1 }; static char PEN_alternate[] = { 1,1 };
static char EXTPEN_dash[] = { 3,1 };
static char EXTPEN_dot[] = { 1,1 };
static char EXTPEN_dashdot[] = { 3,1,1,1 };
static char EXTPEN_dashdotdot[] = { 3,1,1,1,1,1 };
int i;
if (!GetObjectW( hpen, sizeof(logpen), &logpen )) if (!GetObjectW( hpen, sizeof(logpen), &logpen ))
{ {
@ -45,6 +50,7 @@ HPEN X11DRV_SelectPen( X11DRV_PDEVICE *physDev, HPEN hpen )
if (!size) return 0; if (!size) return 0;
physDev->pen.ext = 1;
elp = HeapAlloc( GetProcessHeap(), 0, size ); elp = HeapAlloc( GetProcessHeap(), 0, size );
GetObjectW( hpen, size, elp ); GetObjectW( hpen, size, elp );
@ -56,6 +62,8 @@ HPEN X11DRV_SelectPen( X11DRV_PDEVICE *physDev, HPEN hpen )
HeapFree( GetProcessHeap(), 0, elp ); HeapFree( GetProcessHeap(), 0, elp );
} }
else
physDev->pen.ext = 0;
physDev->pen.style = logpen.lopnStyle & PS_STYLE_MASK; physDev->pen.style = logpen.lopnStyle & PS_STYLE_MASK;
physDev->pen.type = logpen.lopnStyle & PS_TYPE_MASK; physDev->pen.type = logpen.lopnStyle & PS_TYPE_MASK;
@ -76,33 +84,41 @@ HPEN X11DRV_SelectPen( X11DRV_PDEVICE *physDev, HPEN hpen )
switch(logpen.lopnStyle & PS_STYLE_MASK) switch(logpen.lopnStyle & PS_STYLE_MASK)
{ {
case PS_DASH: case PS_DASH:
physDev->pen.dashes = PEN_dash; physDev->pen.dash_len = sizeof(PEN_dash)/sizeof(*PEN_dash);
physDev->pen.dash_len = sizeof(PEN_dash)/sizeof(*PEN_dash); memcpy(physDev->pen.dashes, physDev->pen.ext ? EXTPEN_dash : PEN_dash,
break; physDev->pen.dash_len);
break;
case PS_DOT: case PS_DOT:
physDev->pen.dashes = PEN_dot; physDev->pen.dash_len = sizeof(PEN_dot)/sizeof(*PEN_dot);
physDev->pen.dash_len = sizeof(PEN_dot)/sizeof(*PEN_dot); memcpy(physDev->pen.dashes, physDev->pen.ext ? EXTPEN_dot : PEN_dot,
break; physDev->pen.dash_len);
break;
case PS_DASHDOT: case PS_DASHDOT:
physDev->pen.dashes = PEN_dashdot; physDev->pen.dash_len = sizeof(PEN_dashdot)/sizeof(*PEN_dashdot);
physDev->pen.dash_len = sizeof(PEN_dashdot)/sizeof(*PEN_dashdot); memcpy(physDev->pen.dashes, physDev->pen.ext ? EXTPEN_dashdot : PEN_dashdot,
break; physDev->pen.dash_len);
break;
case PS_DASHDOTDOT: case PS_DASHDOTDOT:
physDev->pen.dashes = PEN_dashdotdot; physDev->pen.dash_len = sizeof(PEN_dashdotdot)/sizeof(*PEN_dashdotdot);
physDev->pen.dash_len = sizeof(PEN_dashdotdot)/sizeof(*PEN_dashdotdot); memcpy(physDev->pen.dashes, physDev->pen.ext ? EXTPEN_dashdotdot : PEN_dashdotdot,
break; physDev->pen.dash_len);
break;
case PS_ALTERNATE: case PS_ALTERNATE:
physDev->pen.dashes = PEN_alternate; physDev->pen.dash_len = sizeof(PEN_alternate)/sizeof(*PEN_alternate);
physDev->pen.dash_len = sizeof(PEN_alternate)/sizeof(*PEN_alternate); memcpy(physDev->pen.dashes, PEN_alternate, physDev->pen.dash_len);
break; break;
case PS_USERSTYLE: case PS_USERSTYLE:
FIXME("PS_USERSTYLE is not supported\n"); FIXME("PS_USERSTYLE is not supported\n");
/* fall through */ /* fall through */
default: default:
physDev->pen.dashes = NULL;
physDev->pen.dash_len = 0; physDev->pen.dash_len = 0;
break; break;
} }
if(physDev->pen.ext && physDev->pen.dash_len &&
(logpen.lopnStyle & PS_STYLE_MASK) != PS_ALTERNATE)
for(i = 0; i < physDev->pen.dash_len; i++)
physDev->pen.dashes[i] *= (physDev->pen.width ? physDev->pen.width : 1);
return hpen; return hpen;
} }

View File

@ -62,6 +62,7 @@ typedef int Status;
#include "wine/list.h" #include "wine/list.h"
#define MAX_PIXELFORMATS 8 #define MAX_PIXELFORMATS 8
#define MAX_DASHLEN 16
struct tagCURSORICONINFO; struct tagCURSORICONINFO;
struct dce; struct dce;
@ -77,9 +78,10 @@ typedef struct
int linejoin; int linejoin;
int pixel; int pixel;
int width; int width;
char * dashes; char dashes[MAX_DASHLEN];
int dash_len; int dash_len;
int type; /* GEOMETRIC || COSMETIC */ int type; /* GEOMETRIC || COSMETIC */
int ext; /* extended pen - 1, otherwise - 0 */
} X_PHYSPEN; } X_PHYSPEN;
/* X physical brush */ /* X physical brush */