Commit 13608c8b authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Avoid use of some 16-bit types.

parent 1ac23b9b
......@@ -43,7 +43,6 @@
#include "wingdi.h"
#include "winnls.h"
#include "winerror.h"
#include "wine/wingdi16.h"
#include "gdi_private.h"
#include "wine/debug.h"
......@@ -1074,16 +1073,16 @@ BOOL WINAPI PlayEnhMetaFileRecord(
/* NB POINTS array doesn't start at pPolyPoly->apts it's actually
pPolyPoly->aPolyCounts + pPolyPoly->nPolys */
POINT16 *pts16 = (POINT16 *)(pPolyPoly->aPolyCounts + pPolyPoly->nPolys);
POINT *pts = HeapAlloc( GetProcessHeap(), 0, pPolyPoly->cpts * sizeof(POINT) );
POINTS *pts = (POINTS *)(pPolyPoly->aPolyCounts + pPolyPoly->nPolys);
POINT *pt = HeapAlloc( GetProcessHeap(), 0, pPolyPoly->cpts * sizeof(POINT) );
DWORD i;
for(i = 0; i < pPolyPoly->cpts; i++)
{
pts[i].x = pts16[i].x;
pts[i].y = pts16[i].y;
pt[i].x = pts[i].x;
pt[i].y = pts[i].y;
}
PolyPolygon(hdc, pts, (INT*)pPolyPoly->aPolyCounts, pPolyPoly->nPolys);
HeapFree( GetProcessHeap(), 0, pts );
PolyPolygon(hdc, pt, (INT*)pPolyPoly->aPolyCounts, pPolyPoly->nPolys);
HeapFree( GetProcessHeap(), 0, pt );
break;
}
case EMR_POLYPOLYLINE16:
......@@ -1092,16 +1091,16 @@ BOOL WINAPI PlayEnhMetaFileRecord(
/* NB POINTS array doesn't start at pPolyPoly->apts it's actually
pPolyPoly->aPolyCounts + pPolyPoly->nPolys */
POINT16 *pts16 = (POINT16 *)(pPolyPoly->aPolyCounts + pPolyPoly->nPolys);
POINT *pts = HeapAlloc( GetProcessHeap(), 0, pPolyPoly->cpts * sizeof(POINT) );
POINTS *pts = (POINTS *)(pPolyPoly->aPolyCounts + pPolyPoly->nPolys);
POINT *pt = HeapAlloc( GetProcessHeap(), 0, pPolyPoly->cpts * sizeof(POINT) );
DWORD i;
for(i = 0; i < pPolyPoly->cpts; i++)
{
pts[i].x = pts16[i].x;
pts[i].y = pts16[i].y;
pt[i].x = pts[i].x;
pt[i].y = pts[i].y;
}
PolyPolyline(hdc, pts, pPolyPoly->aPolyCounts, pPolyPoly->nPolys);
HeapFree( GetProcessHeap(), 0, pts );
PolyPolyline(hdc, pt, pPolyPoly->aPolyCounts, pPolyPoly->nPolys);
HeapFree( GetProcessHeap(), 0, pt );
break;
}
......
......@@ -57,7 +57,6 @@
#include "winreg.h"
#include "winnls.h"
#include "winternl.h"
#include "wine/wingdi16.h"
#include "gdi_private.h"
#include "wine/debug.h"
......@@ -139,10 +138,10 @@ static METAHEADER *MF_GetMetaHeader( HMETAFILE hmf )
/******************************************************************
* convert_points
*
* Convert an array of POINT16 to an array of POINT.
* Convert an array of POINTS to an array of POINT.
* Result must be freed by caller.
*/
static POINT *convert_points( UINT count, POINT16 *pt16 )
static POINT *convert_points( UINT count, const POINTS *pts )
{
UINT i;
POINT *ret = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*ret) );
......@@ -150,8 +149,8 @@ static POINT *convert_points( UINT count, POINT16 *pt16 )
{
for (i = 0; i < count; i++)
{
ret[i].x = pt16[i].x;
ret[i].y = pt16[i].y;
ret[i].x = pts[i].x;
ret[i].y = pts[i].y;
}
}
return ret;
......@@ -743,7 +742,7 @@ BOOL WINAPI PlayMetaFileRecord( HDC hdc, HANDLETABLE *ht, METARECORD *mr, UINT
break;
case META_POLYGON:
if ((pt = convert_points( mr->rdParm[0], (LPPOINT16)(mr->rdParm + 1))))
if ((pt = convert_points( mr->rdParm[0], (POINTS *)(mr->rdParm + 1))))
{
Polygon(hdc, pt, mr->rdParm[0]);
HeapFree( GetProcessHeap(), 0, pt );
......@@ -756,7 +755,7 @@ BOOL WINAPI PlayMetaFileRecord( HDC hdc, HANDLETABLE *ht, METARECORD *mr, UINT
SHORT *counts = (SHORT *)(mr->rdParm + 1);
for (i = total = 0; i < mr->rdParm[0]; i++) total += counts[i];
pt = convert_points( total, (LPPOINT16)(counts + mr->rdParm[0]) );
pt = convert_points( total, (POINTS *)(counts + mr->rdParm[0]) );
if (pt)
{
INT *cnt32 = HeapAlloc( GetProcessHeap(), 0, mr->rdParm[0] * sizeof(*cnt32) );
......@@ -772,7 +771,7 @@ BOOL WINAPI PlayMetaFileRecord( HDC hdc, HANDLETABLE *ht, METARECORD *mr, UINT
break;
case META_POLYLINE:
if ((pt = convert_points( mr->rdParm[0], (LPPOINT16)(mr->rdParm + 1))))
if ((pt = convert_points( mr->rdParm[0], (POINTS *)(mr->rdParm + 1))))
{
Polyline( hdc, pt, mr->rdParm[0] );
HeapFree( GetProcessHeap(), 0, pt );
......@@ -1432,7 +1431,7 @@ static BOOL MF_Play_MetaExtTextOut(HDC hdc, METARECORD *mr)
{
INT *dx = NULL;
int i;
LPINT16 dxx;
SHORT *dxx;
LPSTR sot;
DWORD len;
WORD s1;
......@@ -1441,7 +1440,7 @@ static BOOL MF_Play_MetaExtTextOut(HDC hdc, METARECORD *mr)
s1 = mr->rdParm[2]; /* String length */
len = sizeof(METARECORD) + (((s1 + 1) >> 1) * 2) + 2 * sizeof(short)
+ sizeof(UINT16) + (isrect ? sizeof(RECT16) : 0);
+ sizeof(UINT16) + (isrect ? 4 * sizeof(SHORT) : 0);
/* rec len without dx array */
sot = (LPSTR)&mr->rdParm[4]; /* start_of_text */
......@@ -1451,7 +1450,7 @@ static BOOL MF_Play_MetaExtTextOut(HDC hdc, METARECORD *mr)
rect.top = (SHORT)mr->rdParm[5];
rect.right = (SHORT)mr->rdParm[6];
rect.bottom = (SHORT)mr->rdParm[7];
sot += sizeof(RECT16); /* there is a rectangle, so add offset */
sot += 4 * sizeof(SHORT); /* there is a rectangle, so add offset */
}
if (mr->rdSize == len / 2)
......@@ -1459,7 +1458,7 @@ static BOOL MF_Play_MetaExtTextOut(HDC hdc, METARECORD *mr)
else
if (mr->rdSize == (len + s1 * sizeof(INT16)) / 2)
{
dxx = (LPINT16)(sot+(((s1+1)>>1)*2));
dxx = (SHORT *)(sot+(((s1+1)>>1)*2));
dx = HeapAlloc( GetProcessHeap(), 0, s1*sizeof(INT));
if (dx) for (i = 0; i < s1; i++) dx[i] = dxx[i];
}
......
......@@ -25,7 +25,6 @@
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "wine/wingdi16.h"
#include "mfdrv/metafiledrv.h"
#include "wine/debug.h"
......@@ -128,7 +127,7 @@ MFDRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color )
/******************************************************************
* MFDRV_MetaPoly - implements Polygon and Polyline
*/
static BOOL MFDRV_MetaPoly(PHYSDEV dev, short func, LPPOINT16 pt, short count)
static BOOL MFDRV_MetaPoly(PHYSDEV dev, short func, POINTS *pt, short count)
{
BOOL ret;
DWORD len;
......@@ -154,20 +153,20 @@ static BOOL MFDRV_MetaPoly(PHYSDEV dev, short func, LPPOINT16 pt, short count)
BOOL CDECL
MFDRV_Polyline( PHYSDEV dev, const POINT* pt, INT count )
{
register int i;
LPPOINT16 pt16;
BOOL16 ret;
int i;
POINTS *pts;
BOOL ret;
pt16 = HeapAlloc( GetProcessHeap(), 0, sizeof(POINT16)*count );
if(!pt16) return FALSE;
pts = HeapAlloc( GetProcessHeap(), 0, sizeof(POINTS)*count );
if(!pts) return FALSE;
for (i=count;i--;)
{
pt16[i].x = pt[i].x;
pt16[i].y = pt[i].y;
pts[i].x = pt[i].x;
pts[i].y = pt[i].y;
}
ret = MFDRV_MetaPoly(dev, META_POLYLINE, pt16, count);
ret = MFDRV_MetaPoly(dev, META_POLYLINE, pts, count);
HeapFree( GetProcessHeap(), 0, pt16 );
HeapFree( GetProcessHeap(), 0, pts );
return ret;
}
......@@ -178,20 +177,20 @@ MFDRV_Polyline( PHYSDEV dev, const POINT* pt, INT count )
BOOL CDECL
MFDRV_Polygon( PHYSDEV dev, const POINT* pt, INT count )
{
register int i;
LPPOINT16 pt16;
BOOL16 ret;
int i;
POINTS *pts;
BOOL ret;
pt16 = HeapAlloc( GetProcessHeap(), 0, sizeof(POINT16)*count );
if(!pt16) return FALSE;
pts = HeapAlloc( GetProcessHeap(), 0, sizeof(POINTS)*count );
if(!pts) return FALSE;
for (i=count;i--;)
{
pt16[i].x = pt[i].x;
pt16[i].y = pt[i].y;
pts[i].x = pt[i].x;
pts[i].y = pt[i].y;
}
ret = MFDRV_MetaPoly(dev, META_POLYGON, pt16, count);
ret = MFDRV_MetaPoly(dev, META_POLYGON, pts, count);
HeapFree( GetProcessHeap(), 0, pt16 );
HeapFree( GetProcessHeap(), 0, pts );
return ret;
}
......@@ -206,7 +205,7 @@ MFDRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT polygon
DWORD len;
METARECORD *mr;
unsigned int i,j;
LPPOINT16 pt16;
POINTS *pts;
INT16 totalpoint16 = 0;
INT16 * pointcounts;
......@@ -215,7 +214,7 @@ MFDRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT polygon
}
/* allocate space for all points */
pt16=HeapAlloc( GetProcessHeap(), 0, sizeof(POINT16) * totalpoint16 );
pts=HeapAlloc( GetProcessHeap(), 0, sizeof(POINTS) * totalpoint16 );
pointcounts = HeapAlloc( GetProcessHeap(), 0, sizeof(INT16) * totalpoint16 );
/* copy point counts */
......@@ -225,14 +224,14 @@ MFDRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT polygon
/* convert all points */
for (j = totalpoint16; j--;){
pt16[j].x = pt[j].x;
pt16[j].y = pt[j].y;
pts[j].x = pt[j].x;
pts[j].y = pt[j].y;
}
len = sizeof(METARECORD) + sizeof(WORD) + polygons*sizeof(INT16) + totalpoint16*sizeof(POINT16);
len = sizeof(METARECORD) + sizeof(WORD) + polygons*sizeof(INT16) + totalpoint16*sizeof(*pts);
if (!(mr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, len ))) {
HeapFree( GetProcessHeap(), 0, pt16 );
HeapFree( GetProcessHeap(), 0, pts );
HeapFree( GetProcessHeap(), 0, pointcounts );
return FALSE;
}
......@@ -241,10 +240,10 @@ MFDRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT polygon
mr->rdFunction = META_POLYPOLYGON;
*(mr->rdParm) = polygons;
memcpy(mr->rdParm + 1, pointcounts, polygons*sizeof(INT16));
memcpy(mr->rdParm + 1+polygons, pt16 , totalpoint16*sizeof(POINT16));
memcpy(mr->rdParm + 1+polygons, pts , totalpoint16*sizeof(*pts));
ret = MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
HeapFree( GetProcessHeap(), 0, pt16 );
HeapFree( GetProcessHeap(), 0, pts );
HeapFree( GetProcessHeap(), 0, pointcounts );
HeapFree( GetProcessHeap(), 0, mr);
return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment