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"
25 #include "wine/debug.h"
27 WINE_DEFAULT_DEBUG_CHANNEL(win16drv);
29 /***********************************************************************
33 WIN16DRV_LineTo( PHYSDEV dev, INT x, INT y )
36 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
40 points[0].x = dc->CursPosX;
41 points[0].y = dc->CursPosY;
44 LPtoDP16( HDC_16(physDev->hdc), points, 2 );
46 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
47 OS_POLYLINE, 2, points,
50 win16drv_SegPtr_DrawMode, dc->hClipRgn);
58 /***********************************************************************
62 WIN16DRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
64 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
69 TRACE("In WIN16DRV_Rectangle, x %d y %d\n", left, top );
70 TRACE("In WIN16DRV_Rectangle, VPortOrgX %d y %d\n",
71 dc->vportOrgX, dc->vportOrgY);
76 LPtoDP16( HDC_16(physDev->hdc), points, 2 );
78 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
79 OS_RECTANGLE, 2, points,
82 win16drv_SegPtr_DrawMode, dc->hClipRgn);
89 /***********************************************************************
93 WIN16DRV_Polygon(PHYSDEV dev, const POINT* pt, INT count )
95 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
101 if(count < 2) return TRUE;
102 if(pt[0].x != pt[count-1].x || pt[0].y != pt[count-1].y)
103 count++; /* Ensure polygon is closed */
105 points = HeapAlloc( GetProcessHeap(), 0, count * sizeof(POINT16) );
106 if(points == NULL) return FALSE;
108 for (i = 0; i < count - 1; i++)
110 points[i].x = pt[i].x;
111 points[i].y = pt[i].y;
113 LPtoDP16( HDC_16(physDev->hdc), points, count-1 );
114 points[count-1].x = points[0].x;
115 points[count-1].y = points[0].y;
116 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
117 OS_WINDPOLYGON, count, points,
120 win16drv_SegPtr_DrawMode, dc->hClipRgn);
121 HeapFree( GetProcessHeap(), 0, points );
126 /***********************************************************************
130 WIN16DRV_Polyline(PHYSDEV dev, const POINT* pt, INT count )
132 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
133 DC *dc = physDev->dc;
138 if(count < 2) return TRUE;
140 points = HeapAlloc( GetProcessHeap(), 0, count * sizeof(POINT16) );
141 if(points == NULL) return FALSE;
143 for (i = 0; i < count; i++)
145 points[i].x = pt[i].x;
146 points[i].y = pt[i].y;
148 LPtoDP16( HDC_16(physDev->hdc), points, count );
149 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
150 OS_POLYLINE, count, points,
153 win16drv_SegPtr_DrawMode, dc->hClipRgn);
154 HeapFree( GetProcessHeap(), 0, points );
160 /***********************************************************************
164 WIN16DRV_Ellipse(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
166 WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
167 DC *dc = physDev->dc;
171 TRACE("In WIN16DRV_Ellipse, x %d y %d\n", left, top );
172 TRACE("In WIN16DRV_Ellipse, VPortOrgX %d y %d\n", dc->vportOrgX, dc->vportOrgY);
177 points[1].y = bottom;
178 LPtoDP16( HDC_16(physDev->hdc), points, 2 );
180 bRet = PRTDRV_Output(physDev->segptrPDEVICE,
181 OS_ELLIPSE, 2, points,
184 win16drv_SegPtr_DrawMode, dc->hClipRgn);