gdi32/enhmfdrv: Don't update document bounds in Polyline within a path.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Piotr Caban 2016-04-28 18:48:58 +02:00 committed by Alexandre Julliard
parent 0d84feaf49
commit 67e26bec8d
2 changed files with 41 additions and 15 deletions

View File

@ -347,6 +347,7 @@ COLORREF EMFDRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color )
static BOOL
EMFDRV_Polylinegon( PHYSDEV dev, const POINT* pt, INT count, DWORD iType )
{
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE*) dev;
EMRPOLYLINE *emr;
DWORD size;
INT i;
@ -358,6 +359,17 @@ EMFDRV_Polylinegon( PHYSDEV dev, const POINT* pt, INT count, DWORD iType )
emr->emr.iType = iType;
emr->emr.nSize = size;
emr->cptl = count;
memcpy(emr->aptl, pt, count * sizeof(POINTL));
if(physDev->path) {
emr->rclBounds.left = emr->rclBounds.top = 0;
emr->rclBounds.right = emr->rclBounds.bottom = -1;
ret = EMFDRV_WriteRecord( dev, &emr->emr );
HeapFree( GetProcessHeap(), 0, emr );
return ret;
}
if(iType == EMR_POLYBEZIERTO) {
POINT cur_pt;
@ -384,9 +396,6 @@ EMFDRV_Polylinegon( PHYSDEV dev, const POINT* pt, INT count, DWORD iType )
emr->rclBounds.bottom = pt[i].y;
}
emr->cptl = count;
memcpy(emr->aptl, pt, count * sizeof(POINTL));
ret = EMFDRV_WriteRecord( dev, &emr->emr );
if(ret)
EMFDRV_UpdateBBox( dev, &emr->rclBounds );
@ -406,6 +415,7 @@ EMFDRV_Polylinegon( PHYSDEV dev, const POINT* pt, INT count, DWORD iType )
static BOOL
EMFDRV_Polylinegon16( PHYSDEV dev, const POINT* pt, INT count, DWORD iType )
{
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE*) dev;
EMRPOLYLINE16 *emr;
DWORD size;
INT i;
@ -424,6 +434,20 @@ EMFDRV_Polylinegon16( PHYSDEV dev, const POINT* pt, INT count, DWORD iType )
emr->emr.iType = iType;
emr->emr.nSize = size;
emr->cpts = count;
for(i = 0; i < count; i++ ) {
emr->apts[i].x = pt[i].x;
emr->apts[i].y = pt[i].y;
}
if(physDev->path) {
emr->rclBounds.left = emr->rclBounds.top = 0;
emr->rclBounds.right = emr->rclBounds.bottom = -1;
ret = EMFDRV_WriteRecord( dev, &emr->emr );
HeapFree( GetProcessHeap(), 0, emr );
return ret;
}
if(iType == EMR_POLYBEZIERTO16) {
POINT cur_pt;
@ -450,12 +474,6 @@ EMFDRV_Polylinegon16( PHYSDEV dev, const POINT* pt, INT count, DWORD iType )
emr->rclBounds.bottom = pt[i].y;
}
emr->cpts = count;
for(i = 0; i < count; i++ ) {
emr->apts[i].x = pt[i].x;
emr->apts[i].y = pt[i].y;
}
ret = EMFDRV_WriteRecord( dev, &emr->emr );
if(ret)
EMFDRV_UpdateBBox( dev, &emr->rclBounds );

View File

@ -3585,7 +3585,7 @@ static const unsigned char EMF_PATH_BITS[] =
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xef, 0xff, 0xff, 0xff, 0xea, 0xff, 0xff, 0xff,
0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00,
0xa8, 0x01, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
0xd4, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x80, 0x07, 0x00, 0x00, 0x3e, 0x04, 0x00, 0x00,
@ -3628,14 +3628,21 @@ static const unsigned char EMF_PATH_BITS[] =
0x20, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
0x0a, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00,
0x13, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00
0x05, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00,
0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00,
0x0a, 0x00, 0x0a, 0x00, 0x14, 0x00, 0x0a, 0x00,
0x0a, 0x00, 0x14, 0x00, 0x14, 0x00, 0x14, 0x00,
0x3c, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x0e, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x14, 0x00, 0x00, 0x00
};
static void test_emf_GetPath(void)
{
POINT pts[4] = {{10, 10}, {20, 10}, {10, 20}, {20, 20}};
HDC hdcMetafile;
HENHMETAFILE hemf;
BOOL ret;
@ -3662,10 +3669,11 @@ static void test_emf_GetPath(void)
Pie(hdcMetafile, 21, 21, 39, 29, 39, 29, 21, 21);
Ellipse(hdcMetafile, 10, 10, 20, 20);
RoundRect(hdcMetafile, 10, 10, 20, 20, 3, 5);
Polyline(hdcMetafile, pts, 4);
EndPath(hdcMetafile);
size = GetPath(hdcMetafile, NULL, NULL, 0);
todo_wine ok( size == 69, "GetPath returned %d.\n", size);
todo_wine ok( size == 73, "GetPath returned %d.\n", size);
hemf = CloseEnhMetaFile(hdcMetafile);
ok(hemf != 0, "CloseEnhMetaFile error %d\n", GetLastError());