gdi32: Fix handling of ModifyWorldTransform( MWT_IDENTITY ) on an emf dc.
When the mode parameter is MWT_IDENTITY, the xform parameter can be NULL because it should be ignored and use the identity matrix. Fix Tally crashing when exporting a JPEG image. Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8ccf24ccb0
commit
efdd6f46c9
|
@ -362,7 +362,19 @@ BOOL CDECL EMFDRV_ModifyWorldTransform( PHYSDEV dev, const XFORM *xform, DWORD m
|
|||
|
||||
emr.emr.iType = EMR_MODIFYWORLDTRANSFORM;
|
||||
emr.emr.nSize = sizeof(emr);
|
||||
emr.xform = *xform;
|
||||
if (mode == MWT_IDENTITY)
|
||||
{
|
||||
emr.xform.eM11 = 1.0f;
|
||||
emr.xform.eM12 = 0.0f;
|
||||
emr.xform.eM21 = 0.0f;
|
||||
emr.xform.eM22 = 1.0f;
|
||||
emr.xform.eDx = 0.0f;
|
||||
emr.xform.eDy = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
emr.xform = *xform;
|
||||
}
|
||||
emr.iMode = mode;
|
||||
|
||||
if (!EMFDRV_WriteRecord( dev, &emr.emr )) return FALSE;
|
||||
|
|
|
@ -4158,6 +4158,18 @@ static INT CALLBACK enum_emf_WorldTransform(HDC hdc, HANDLETABLE *ht,
|
|||
|
||||
CombineTransform(&test_data->expected, &test_data->stored, &test_data->scale);
|
||||
}
|
||||
else if(lpXfrm->iMode == MWT_IDENTITY)
|
||||
{
|
||||
/* reset to identity matrix also does discard */
|
||||
test_data->stored.eM11 = 1.0f;
|
||||
test_data->stored.eM12 = 0.0f;
|
||||
test_data->stored.eM21 = 0.0f;
|
||||
test_data->stored.eM22 = 1.0f;
|
||||
test_data->stored.eDx = 0.0f;
|
||||
test_data->stored.eDy = 0.0f;
|
||||
|
||||
CombineTransform(&test_data->expected, &test_data->stored, &test_data->scale);
|
||||
}
|
||||
|
||||
/* verify it is updated immediately */
|
||||
ret = GetWorldTransform(hdc, &xform);
|
||||
|
@ -4265,6 +4277,9 @@ static void test_emf_WorldTransform(void)
|
|||
ret = SetWorldTransform(hdcMetafile, &xform); /* EMR_SETWORLDTRANSFORM */
|
||||
ok(ret == TRUE, "SetWorldTransform failed\n");
|
||||
|
||||
ret = ModifyWorldTransform(hdcMetafile, NULL, MWT_IDENTITY); /* EMR_MODIFYWORLDTRANSFORM */
|
||||
ok(ret == TRUE, "ModifyWorldTransform failed\n");
|
||||
|
||||
set_rotation_xform(&xform, M_PI / 2.f, -2, -3);
|
||||
ret = ModifyWorldTransform(hdcMetafile, &xform, MWT_LEFTMULTIPLY); /* EMR_MODIFYWORLDTRANSFORM */
|
||||
ok(ret == TRUE, "ModifyWorldTransform failed\n");
|
||||
|
|
Loading…
Reference in New Issue