gdi32: Use META_EXTFLOODFILL records for ExtFloodFill.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-07-25 12:58:12 +02:00 committed by Alexandre Julliard
parent 0dd6b238aa
commit 6762f6ac52
4 changed files with 67 additions and 3 deletions

View File

@ -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 );
}

View File

@ -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 )

View File

@ -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,

View File

@ -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();