Jacek Caban : gdi32: Use META_EXTFLOODFILL records for ExtFloodFill.

Alexandre Julliard julliard at winehq.org
Mon Jul 26 15:30:27 CDT 2021


Module: wine
Branch: master
Commit: 6762f6ac52132a3c6052fd291d8f7bb38e77983c
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6762f6ac52132a3c6052fd291d8f7bb38e77983c

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sun Jul 25 12:58:12 2021 +0200

gdi32: Use META_EXTFLOODFILL records for ExtFloodFill.

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

---

 dlls/gdi32/mfdrv/graphics.c    |  4 ++--
 dlls/gdi32/mfdrv/init.c        | 16 ++++++++++++++
 dlls/gdi32/mfdrv/metafiledrv.h |  2 ++
 dlls/gdi32/tests/metafile.c    | 48 +++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 67 insertions(+), 3 deletions(-)

diff --git a/dlls/gdi32/mfdrv/graphics.c b/dlls/gdi32/mfdrv/graphics.c
index 0f6b3d75e52..396be6e1472 100644
--- a/dlls/gdi32/mfdrv/graphics.c
+++ b/dlls/gdi32/mfdrv/graphics.c
@@ -250,9 +250,9 @@ BOOL METADC_PolyPolygon( HDC hdc, const POINT *pt, const INT *counts, UINT polyg
 /**********************************************************************
  *          METADC_ExtFloodFill
  */
-BOOL METADC_ExtFloodFill( HDC hdc, INT x, INT y, COLORREF color, UINT fillType )
+BOOL METADC_ExtFloodFill( HDC hdc, INT x, INT y, COLORREF color, UINT fill_type )
 {
-    return metadc_param4( hdc, META_FLOODFILL, x, y, HIWORD(color), LOWORD(color) );
+    return metadc_param5( hdc, META_EXTFLOODFILL, x, y, HIWORD(color), LOWORD(color), fill_type );
 }
 
 
diff --git a/dlls/gdi32/mfdrv/init.c b/dlls/gdi32/mfdrv/init.c
index 8961c45d24f..1a647a655f3 100644
--- a/dlls/gdi32/mfdrv/init.c
+++ b/dlls/gdi32/mfdrv/init.c
@@ -629,6 +629,22 @@ BOOL metadc_param4( HDC hdc, short func, short param1, short param2,
     return MFDRV_MetaParam4( &dev->dev, func, param1, param2, param3, param4 );
 }
 
+BOOL metadc_param5( HDC hdc, short func, short param1, short param2,
+                    short param3, short param4, short param5 )
+{
+    char buffer[FIELD_OFFSET(METARECORD, rdParm[5])];
+    METARECORD *mr = (METARECORD *)&buffer;
+
+    mr->rdSize = sizeof(buffer) / sizeof(WORD);
+    mr->rdFunction = func;
+    mr->rdParm[0] = param5;
+    mr->rdParm[1] = param4;
+    mr->rdParm[2] = param3;
+    mr->rdParm[3] = param2;
+    mr->rdParm[4] = param1;
+    return metadc_record( hdc, mr, sizeof(buffer) );
+}
+
 BOOL metadc_param6( HDC hdc, short func, short param1, short param2,
                     short param3, short param4, short param5,
                     short param6 )
diff --git a/dlls/gdi32/mfdrv/metafiledrv.h b/dlls/gdi32/mfdrv/metafiledrv.h
index 9b4bb2d9e84..805c0c2f9d9 100644
--- a/dlls/gdi32/mfdrv/metafiledrv.h
+++ b/dlls/gdi32/mfdrv/metafiledrv.h
@@ -63,6 +63,8 @@ extern METAFILEDRV_PDEVICE *get_metadc_ptr( HDC hdc ) DECLSPEC_HIDDEN;
 extern BOOL metadc_param2( HDC hdc, short func, short param1, short param2 ) DECLSPEC_HIDDEN;
 extern BOOL metadc_param4( HDC hdc, short func, short param1, short param2,
                            short param3, short param4 ) DECLSPEC_HIDDEN;
+extern BOOL metadc_param5( HDC hdc, short func, short param1, short param2, short param3,
+                           short param4, short param5 ) DECLSPEC_HIDDEN;
 extern BOOL metadc_param6( HDC hdc, short func, short param1, short param2, short param3,
                            short param4, short param5, short param6 ) DECLSPEC_HIDDEN;
 extern BOOL metadc_param8( HDC hdc, short func, short param1, short param2,
diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c
index 5f626e83901..9a9a3fa6a5a 100644
--- a/dlls/gdi32/tests/metafile.c
+++ b/dlls/gdi32/tests/metafile.c
@@ -3221,7 +3221,7 @@ static void test_emf_SetPixel(void)
     BOOL ret;
     HDC hdc;
 
-    hdc = CreateEnhMetaFileW(NULL, L"test.emf", NULL, NULL);
+    hdc = CreateEnhMetaFileW(NULL, NULL, NULL, NULL);
     ok(hdc != 0, "CreateEnhMetaFile failed\n");
 
     c = GetPixel(hdc, 5, 5);
@@ -3440,6 +3440,51 @@ static void test_mf_Graphics(void)
         hMetafile, GetLastError());
 }
 
+static void test_mf_FloodFill(void)
+{
+    HMETAFILE mf;
+    HDC hdc;
+    BOOL ret;
+
+    static const unsigned char floodfill_bits[] =
+    {
+        0x01, 0x00, 0x09, 0x00, 0x00, 0x03, 0x24, 0x00,
+        0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+        0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x48, 0x05,
+        0x00, 0x00, 0x03, 0x04, 0x05, 0x00, 0x02, 0x00,
+        0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x48, 0x05,
+        0x00, 0x00, 0x08, 0x09, 0x0a, 0x00, 0x07, 0x00,
+        0x06, 0x00, 0x08, 0x00, 0x00, 0x00, 0x48, 0x05,
+        0x01, 0x00, 0x12, 0x13, 0x14, 0x00, 0x11, 0x00,
+        0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00
+    };
+
+    hdc = CreateMetaFileA(NULL);
+    ok(hdc != 0, "CreateMetaFileA(NULL) error %d\n", GetLastError());
+
+    ret = FloodFill(hdc, 1, 2, RGB(3,4,5));
+    ok(ret, "FloodFill failed\n");
+
+    ret = ExtFloodFill(hdc, 6, 7, RGB(8,9,10), FLOODFILLBORDER);
+    ok(ret, "FloodFill failed\n");
+
+    ret = ExtFloodFill(hdc, 16, 17, RGB(18,19,20), FLOODFILLSURFACE);
+    ok(ret, "FloodFill failed\n");
+
+    mf = CloseMetaFile(hdc);
+    ok(mf != 0, "CloseMetaFile error %d\n", GetLastError());
+
+    if (compare_mf_bits (mf, floodfill_bits, sizeof(floodfill_bits),
+        "mf_FloodFill") != 0)
+    {
+        dump_mf_bits(mf, "mf_FloodFill");
+        EnumMetaFile(0, mf, mf_enum_proc, 0);
+    }
+
+    ret = DeleteMetaFile(mf);
+    ok(ret, "DeleteMetaFile(%p) error %d\n", mf, GetLastError());
+}
+
 static void test_mf_PatternBrush(void)
 {
     HDC hdcMetafile;
@@ -6357,6 +6402,7 @@ START_TEST(metafile)
     test_mf_SetLayout();
     test_metafile_file();
     test_mf_SetPixel();
+    test_mf_FloodFill();
 
     /* For metafile conversions */
     test_mf_conversions();




More information about the wine-cvs mailing list