2 * Windows 16 bit device driver graphics functions
4 * Copyright 1997 John Harvey
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "win16drv/win16drv.h"
24 #include "wine/debug.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(win16drv
);
28 /***********************************************************************
32 WIN16DRV_LineTo( PHYSDEV dev
, INT x
, INT y
)
35 WIN16DRV_PDEVICE
*physDev
= (WIN16DRV_PDEVICE
*)dev
;
39 points
[0].x
= dc
->DCOrgX
+ XLPTODP( dc
, dc
->CursPosX
);
40 points
[0].y
= dc
->DCOrgY
+ YLPTODP( dc
, dc
->CursPosY
);
41 points
[1].x
= dc
->DCOrgX
+ XLPTODP( dc
, x
);
42 points
[1].y
= dc
->DCOrgY
+ YLPTODP( dc
, y
);
43 bRet
= PRTDRV_Output(physDev
->segptrPDEVICE
,
44 OS_POLYLINE
, 2, points
,
47 win16drv_SegPtr_DrawMode
, dc
->hClipRgn
);
55 /***********************************************************************
59 WIN16DRV_Rectangle(PHYSDEV dev
, INT left
, INT top
, INT right
, INT bottom
)
61 WIN16DRV_PDEVICE
*physDev
= (WIN16DRV_PDEVICE
*)dev
;
66 TRACE("In WIN16DRV_Rectangle, x %d y %d DCOrgX %d y %d\n",
67 left
, top
, dc
->DCOrgX
, dc
->DCOrgY
);
68 TRACE("In WIN16DRV_Rectangle, VPortOrgX %d y %d\n",
69 dc
->vportOrgX
, dc
->vportOrgY
);
70 points
[0].x
= XLPTODP(dc
, left
);
71 points
[0].y
= YLPTODP(dc
, top
);
73 points
[1].x
= XLPTODP(dc
, right
);
74 points
[1].y
= YLPTODP(dc
, bottom
);
75 bRet
= PRTDRV_Output(physDev
->segptrPDEVICE
,
76 OS_RECTANGLE
, 2, points
,
79 win16drv_SegPtr_DrawMode
, dc
->hClipRgn
);
86 /***********************************************************************
90 WIN16DRV_Polygon(PHYSDEV dev
, const POINT
* pt
, INT count
)
92 WIN16DRV_PDEVICE
*physDev
= (WIN16DRV_PDEVICE
*)dev
;
98 if(count
< 2) return TRUE
;
99 if(pt
[0].x
!= pt
[count
-1].x
|| pt
[0].y
!= pt
[count
-1].y
)
100 count
++; /* Ensure polygon is closed */
102 points
= HeapAlloc( GetProcessHeap(), 0, count
* sizeof(POINT16
) );
103 if(points
== NULL
) return FALSE
;
105 for (i
= 0; i
< count
- 1; i
++)
107 points
[i
].x
= XLPTODP( dc
, pt
[i
].x
);
108 points
[i
].y
= YLPTODP( dc
, pt
[i
].y
);
110 points
[count
-1].x
= points
[0].x
;
111 points
[count
-1].y
= points
[0].y
;
112 bRet
= PRTDRV_Output(physDev
->segptrPDEVICE
,
113 OS_WINDPOLYGON
, count
, points
,
116 win16drv_SegPtr_DrawMode
, dc
->hClipRgn
);
117 HeapFree( GetProcessHeap(), 0, points
);
122 /***********************************************************************
126 WIN16DRV_Polyline(PHYSDEV dev
, const POINT
* pt
, INT count
)
128 WIN16DRV_PDEVICE
*physDev
= (WIN16DRV_PDEVICE
*)dev
;
129 DC
*dc
= physDev
->dc
;
134 if(count
< 2) return TRUE
;
136 points
= HeapAlloc( GetProcessHeap(), 0, count
* sizeof(POINT16
) );
137 if(points
== NULL
) return FALSE
;
139 for (i
= 0; i
< count
; i
++)
141 points
[i
].x
= XLPTODP( dc
, pt
[i
].x
);
142 points
[i
].y
= YLPTODP( dc
, pt
[i
].y
);
144 bRet
= PRTDRV_Output(physDev
->segptrPDEVICE
,
145 OS_POLYLINE
, count
, points
,
148 win16drv_SegPtr_DrawMode
, dc
->hClipRgn
);
149 HeapFree( GetProcessHeap(), 0, points
);
155 /***********************************************************************
159 WIN16DRV_Ellipse(PHYSDEV dev
, INT left
, INT top
, INT right
, INT bottom
)
161 WIN16DRV_PDEVICE
*physDev
= (WIN16DRV_PDEVICE
*)dev
;
162 DC
*dc
= physDev
->dc
;
166 TRACE("In WIN16DRV_Ellipse, x %d y %d DCOrgX %d y %d\n", left
, top
, dc
->DCOrgX
, dc
->DCOrgY
);
167 TRACE("In WIN16DRV_Ellipse, VPortOrgX %d y %d\n", dc
->vportOrgX
, dc
->vportOrgY
);
168 points
[0].x
= XLPTODP(dc
, left
);
169 points
[0].y
= YLPTODP(dc
, top
);
171 points
[1].x
= XLPTODP(dc
, right
);
172 points
[1].y
= YLPTODP(dc
, bottom
);
174 bRet
= PRTDRV_Output(physDev
->segptrPDEVICE
,
175 OS_ELLIPSE
, 2, points
,
178 win16drv_SegPtr_DrawMode
, dc
->hClipRgn
);