Added correct implementation of GetCaps, changed Play and Stop handling
[wine/multimedia.git] / graphics / win16drv / graphics.c
blob721ca1b823e4af9c10e0dcc02ea656e5e6f69203
1 /*
2 * Windows 16 bit device driver graphics functions
4 * Copyright 1997 John Harvey
5 */
7 #include <stdio.h>
8 #include "heap.h"
9 #include "win16drv.h"
10 #include "debug.h"
12 /**********************************************************************
13 * WIN16DRV_MoveToEx
15 BOOL32
16 WIN16DRV_MoveToEx(DC *dc,INT32 x,INT32 y,LPPOINT32 pt)
18 if (pt)
20 pt->x = dc->w.CursPosX;
21 pt->y = dc->w.CursPosY;
23 dc->w.CursPosX = x;
24 dc->w.CursPosY = y;
25 return TRUE;
28 /***********************************************************************
29 * WIN16DRV_LineTo
31 BOOL32
32 WIN16DRV_LineTo( DC *dc, INT32 x, INT32 y )
34 BOOL32 bRet ;
35 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
36 POINT16 points[2];
37 points[0].x = dc->w.DCOrgX + XLPTODP( dc, dc->w.CursPosX );
38 points[0].y = dc->w.DCOrgY + YLPTODP( dc, dc->w.CursPosY );
39 points[1].x = dc->w.DCOrgX + XLPTODP( dc, x );
40 points[1].y = dc->w.DCOrgY + YLPTODP( dc, y );
41 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
42 OS_POLYLINE, 2, points,
43 physDev->PenInfo,
44 NULL,
45 win16drv_SegPtr_DrawMode, dc->w.hClipRgn);
47 dc->w.CursPosX = x;
48 dc->w.CursPosY = y;
49 return TRUE;
53 /***********************************************************************
54 * WIN16DRV_Rectangle
56 BOOL32
57 WIN16DRV_Rectangle(DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom)
59 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
60 BOOL32 bRet = 0;
61 POINT16 points[2];
63 TRACE(win16drv, "In WIN16DRV_Rectangle, x %d y %d DCOrgX %d y %d\n",
64 left, top, dc->w.DCOrgX, dc->w.DCOrgY);
65 TRACE(win16drv, "In WIN16DRV_Rectangle, VPortOrgX %d y %d\n",
66 dc->vportOrgX, dc->vportOrgY);
67 points[0].x = XLPTODP(dc, left);
68 points[0].y = YLPTODP(dc, top);
70 points[1].x = XLPTODP(dc, right);
71 points[1].y = YLPTODP(dc, bottom);
72 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
73 OS_RECTANGLE, 2, points,
74 physDev->PenInfo,
75 physDev->BrushInfo,
76 win16drv_SegPtr_DrawMode, dc->w.hClipRgn);
77 return bRet;
83 /***********************************************************************
84 * WIN16DRV_Polygon
86 BOOL32
87 WIN16DRV_Polygon(DC *dc, const POINT32* pt, INT32 count )
89 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
90 BOOL32 bRet = 0;
91 LPPOINT16 points;
92 int i;
94 if(count < 2) return TRUE;
95 if(pt[0].x != pt[count-1].x || pt[0].y != pt[count-1].y)
96 count++; /* Ensure polygon is closed */
98 points = HEAP_xalloc( GetProcessHeap(), 0, count * sizeof(POINT16) );
99 for (i = 0; i < count - 1; i++)
101 points[i].x = XLPTODP( dc, pt[i].x );
102 points[i].y = YLPTODP( dc, pt[i].y );
104 points[count-1].x = points[0].x;
105 points[count-1].y = points[0].y;
106 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
107 OS_WINDPOLYGON, count, points,
108 physDev->PenInfo,
109 physDev->BrushInfo,
110 win16drv_SegPtr_DrawMode, dc->w.hClipRgn);
111 HeapFree( GetProcessHeap(), 0, points );
112 return bRet;
116 /***********************************************************************
117 * WIN16DRV_Polyline
119 BOOL32
120 WIN16DRV_Polyline(DC *dc, const POINT32* pt, INT32 count )
122 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
123 BOOL32 bRet = 0;
124 LPPOINT16 points;
125 int i;
127 if(count < 2) return TRUE;
129 points = HEAP_xalloc( GetProcessHeap(), 0, count * sizeof(POINT16) );
130 for (i = 0; i < count; i++)
132 points[i].x = XLPTODP( dc, pt[i].x );
133 points[i].y = YLPTODP( dc, pt[i].y );
135 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
136 OS_POLYLINE, count, points,
137 physDev->PenInfo,
138 NULL,
139 win16drv_SegPtr_DrawMode, dc->w.hClipRgn);
140 HeapFree( GetProcessHeap(), 0, points );
141 return bRet;
146 /***********************************************************************
147 * WIN16DRV_Ellipse
149 BOOL32
150 WIN16DRV_Ellipse(DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom)
152 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
153 BOOL32 bRet = 0;
154 POINT16 points[2];
155 TRACE(win16drv, "In WIN16DRV_Ellipse, x %d y %d DCOrgX %d y %d\n",
156 left, top, dc->w.DCOrgX, dc->w.DCOrgY);
157 TRACE(win16drv, "In WIN16DRV_Ellipse, VPortOrgX %d y %d\n",
158 dc->vportOrgX, dc->vportOrgY);
159 points[0].x = XLPTODP(dc, left);
160 points[0].y = YLPTODP(dc, top);
162 points[1].x = XLPTODP(dc, right);
163 points[1].y = YLPTODP(dc, bottom);
165 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
166 OS_ELLIPSE, 2, points,
167 physDev->PenInfo,
168 physDev->BrushInfo,
169 win16drv_SegPtr_DrawMode, dc->w.hClipRgn);
170 return bRet;