VxDCall functions do not need to be 'register'.
[wine/multimedia.git] / graphics / x11drv / pen.c
blob76bb905e2914d9de3f5e2df9f66d09fbaeddcfbd
1 /*
2 * X11DRV pen objects
4 * Copyright 1993 Alexandre Julliard
5 */
7 #include "config.h"
9 #ifndef X_DISPLAY_MISSING
11 #include "pen.h"
12 #include "color.h"
13 #include "x11drv.h"
14 #include "debug.h"
16 static const char PEN_dash[] = { 5,3 }; /* ----- ----- ----- */
17 static const char PEN_dot[] = { 1,1 }; /* -- -- -- -- -- -- */
18 static const char PEN_dashdot[] = { 4,3,2,3 }; /* ---- -- ---- -- */
19 static const char PEN_dashdotdot[] = { 4,2,2,2,2,2 }; /* ---- -- -- ---- */
20 static const char PEN_alternate[] = { 1,1 }; /* FIXME */
22 /***********************************************************************
23 * PEN_SelectObject
25 HPEN X11DRV_PEN_SelectObject( DC * dc, HPEN hpen, PENOBJ * pen )
27 HPEN prevHandle = dc->w.hPen;
28 X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
30 dc->w.hPen = hpen;
31 physDev->pen.style = pen->logpen.lopnStyle & PS_STYLE_MASK;
32 physDev->pen.type = pen->logpen.lopnStyle & PS_TYPE_MASK;
33 physDev->pen.endcap = pen->logpen.lopnStyle & PS_ENDCAP_MASK;
34 physDev->pen.linejoin = pen->logpen.lopnStyle & PS_JOIN_MASK;
36 physDev->pen.width = (pen->logpen.lopnWidth.x * dc->vportExtX +
37 dc->wndExtX / 2) / dc->wndExtX;
38 if (physDev->pen.width < 0) physDev->pen.width = -physDev->pen.width;
39 if (physDev->pen.width == 1) physDev->pen.width = 0; /* Faster */
40 physDev->pen.pixel = X11DRV_PALETTE_ToPhysical( dc, pen->logpen.lopnColor );
41 switch(pen->logpen.lopnStyle & PS_STYLE_MASK)
43 case PS_DASH:
44 physDev->pen.dashes = (char *)PEN_dash;
45 physDev->pen.dash_len = 2;
46 break;
47 case PS_DOT:
48 physDev->pen.dashes = (char *)PEN_dot;
49 physDev->pen.dash_len = 2;
50 break;
51 case PS_DASHDOT:
52 physDev->pen.dashes = (char *)PEN_dashdot;
53 physDev->pen.dash_len = 4;
54 break;
55 case PS_DASHDOTDOT:
56 physDev->pen.dashes = (char *)PEN_dashdotdot;
57 physDev->pen.dash_len = 6;
58 break;
59 case PS_ALTERNATE:
60 /* FIXME: should be alternating _pixels_ that are set */
61 physDev->pen.dashes = (char *)PEN_alternate;
62 physDev->pen.dash_len = 2;
63 break;
64 case PS_USERSTYLE:
65 /* FIXME */
66 break;
69 return prevHandle;
72 #endif /* !defined(X_DISPLAY_MISSING) */