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

Alexandre Julliard julliard at wine.codeweavers.com
Fri Apr 29 11:05:58 CDT 2016


Module: wine
Branch: master
Commit: 67e26bec8dc5d0ca4d1c60772e57a5d74890b490
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=67e26bec8dc5d0ca4d1c60772e57a5d74890b490

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu Apr 28 18:48:58 2016 +0200

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

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdi32/enhmfdrv/graphics.c | 36 +++++++++++++++++++++++++++---------
 dlls/gdi32/tests/metafile.c    | 20 ++++++++++++++------
 2 files changed, 41 insertions(+), 15 deletions(-)

diff --git a/dlls/gdi32/enhmfdrv/graphics.c b/dlls/gdi32/enhmfdrv/graphics.c
index 98121e5..1b5d26d 100644
--- a/dlls/gdi32/enhmfdrv/graphics.c
+++ b/dlls/gdi32/enhmfdrv/graphics.c
@@ -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 );
diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c
index bdc2a0a..64ad004 100644
--- a/dlls/gdi32/tests/metafile.c
+++ b/dlls/gdi32/tests/metafile.c
@@ -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());




More information about the wine-cvs mailing list