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

gdi32: Avoid use of some 16-bit types.

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