Commit 083e61fd authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

gdi32: Update metafile world transform immediately in winnt mode.

The Chrome browser print function implements their own handling for EMR_MODIFYWORLDTRANSFORM which calls ModifyWorldTransform on the HDC directly without ever calling PlayEnhMetaFileRecord. In Wine, this transformation would get discarded when the callback function returned, causing the page to be printed at the wrong scale. Tests show that the transform is updated immediately during PlayEnhMetaFileRecord. In addition, a modified transform persists between callbacks until PlayEnhMetaFileRecord is called on a relevant type of callback, at which point the transform is reverted before playing back the record. Signed-off-by: 's avatarAndrew Eikum <aeikum@codeweavers.com> Signed-off-by: 's avatarHuw Davies <huw@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 7860d11e
...@@ -785,6 +785,10 @@ BOOL WINAPI PlayEnhMetaFileRecord( ...@@ -785,6 +785,10 @@ BOOL WINAPI PlayEnhMetaFileRecord(
break; break;
info->state.mode = pSetMapMode->iMode; info->state.mode = pSetMapMode->iMode;
EMF_SetMapMode(hdc, info); EMF_SetMapMode(hdc, info);
if (!IS_WIN9X())
EMF_Update_MF_Xform(hdc, info);
break; break;
} }
case EMR_SETBKMODE: case EMR_SETBKMODE:
...@@ -886,6 +890,10 @@ BOOL WINAPI PlayEnhMetaFileRecord( ...@@ -886,6 +890,10 @@ BOOL WINAPI PlayEnhMetaFileRecord(
info->state.wndOrgY = pSetWindowOrgEx->ptlOrigin.y; info->state.wndOrgY = pSetWindowOrgEx->ptlOrigin.y;
TRACE("SetWindowOrgEx: %d,%d\n", info->state.wndOrgX, info->state.wndOrgY); TRACE("SetWindowOrgEx: %d,%d\n", info->state.wndOrgX, info->state.wndOrgY);
if (!IS_WIN9X())
EMF_Update_MF_Xform(hdc, info);
break; break;
} }
case EMR_SETWINDOWEXTEX: case EMR_SETWINDOWEXTEX:
...@@ -900,6 +908,10 @@ BOOL WINAPI PlayEnhMetaFileRecord( ...@@ -900,6 +908,10 @@ BOOL WINAPI PlayEnhMetaFileRecord(
EMF_FixIsotropic(hdc, info); EMF_FixIsotropic(hdc, info);
TRACE("SetWindowExtEx: %d,%d\n",info->state.wndExtX, info->state.wndExtY); TRACE("SetWindowExtEx: %d,%d\n",info->state.wndExtX, info->state.wndExtY);
if (!IS_WIN9X())
EMF_Update_MF_Xform(hdc, info);
break; break;
} }
case EMR_SETVIEWPORTORGEX: case EMR_SETVIEWPORTORGEX:
...@@ -909,6 +921,10 @@ BOOL WINAPI PlayEnhMetaFileRecord( ...@@ -909,6 +921,10 @@ BOOL WINAPI PlayEnhMetaFileRecord(
info->state.vportOrgX = pSetViewportOrgEx->ptlOrigin.x; info->state.vportOrgX = pSetViewportOrgEx->ptlOrigin.x;
info->state.vportOrgY = pSetViewportOrgEx->ptlOrigin.y; info->state.vportOrgY = pSetViewportOrgEx->ptlOrigin.y;
TRACE("SetViewportOrgEx: %d,%d\n", info->state.vportOrgX, info->state.vportOrgY); TRACE("SetViewportOrgEx: %d,%d\n", info->state.vportOrgX, info->state.vportOrgY);
if (!IS_WIN9X())
EMF_Update_MF_Xform(hdc, info);
break; break;
} }
case EMR_SETVIEWPORTEXTEX: case EMR_SETVIEWPORTEXTEX:
...@@ -922,6 +938,10 @@ BOOL WINAPI PlayEnhMetaFileRecord( ...@@ -922,6 +938,10 @@ BOOL WINAPI PlayEnhMetaFileRecord(
if (info->state.mode == MM_ISOTROPIC) if (info->state.mode == MM_ISOTROPIC)
EMF_FixIsotropic(hdc, info); EMF_FixIsotropic(hdc, info);
TRACE("SetViewportExtEx: %d,%d\n", info->state.vportExtX, info->state.vportExtY); TRACE("SetViewportExtEx: %d,%d\n", info->state.vportExtX, info->state.vportExtY);
if (!IS_WIN9X())
EMF_Update_MF_Xform(hdc, info);
break; break;
} }
case EMR_CREATEPEN: case EMR_CREATEPEN:
...@@ -1251,6 +1271,10 @@ BOOL WINAPI PlayEnhMetaFileRecord( ...@@ -1251,6 +1271,10 @@ BOOL WINAPI PlayEnhMetaFileRecord(
{ {
const EMRSETWORLDTRANSFORM *lpXfrm = (const EMRSETWORLDTRANSFORM *)mr; const EMRSETWORLDTRANSFORM *lpXfrm = (const EMRSETWORLDTRANSFORM *)mr;
info->state.world_transform = lpXfrm->xform; info->state.world_transform = lpXfrm->xform;
if (!IS_WIN9X())
EMF_Update_MF_Xform(hdc, info);
break; break;
} }
...@@ -1406,6 +1430,9 @@ BOOL WINAPI PlayEnhMetaFileRecord( ...@@ -1406,6 +1430,9 @@ BOOL WINAPI PlayEnhMetaFileRecord(
lpScaleViewportExtEx->xNum,lpScaleViewportExtEx->xDenom, lpScaleViewportExtEx->xNum,lpScaleViewportExtEx->xDenom,
lpScaleViewportExtEx->yNum,lpScaleViewportExtEx->yDenom); lpScaleViewportExtEx->yNum,lpScaleViewportExtEx->yDenom);
if (!IS_WIN9X())
EMF_Update_MF_Xform(hdc, info);
break; break;
} }
...@@ -1431,6 +1458,9 @@ BOOL WINAPI PlayEnhMetaFileRecord( ...@@ -1431,6 +1458,9 @@ BOOL WINAPI PlayEnhMetaFileRecord(
lpScaleWindowExtEx->xNum,lpScaleWindowExtEx->xDenom, lpScaleWindowExtEx->xNum,lpScaleWindowExtEx->xDenom,
lpScaleWindowExtEx->yNum,lpScaleWindowExtEx->yDenom); lpScaleWindowExtEx->yNum,lpScaleWindowExtEx->yDenom);
if (!IS_WIN9X())
EMF_Update_MF_Xform(hdc, info);
break; break;
} }
...@@ -1443,14 +1473,20 @@ BOOL WINAPI PlayEnhMetaFileRecord( ...@@ -1443,14 +1473,20 @@ BOOL WINAPI PlayEnhMetaFileRecord(
info->state.world_transform.eM11 = info->state.world_transform.eM22 = 1; info->state.world_transform.eM11 = info->state.world_transform.eM22 = 1;
info->state.world_transform.eM12 = info->state.world_transform.eM21 = 0; info->state.world_transform.eM12 = info->state.world_transform.eM21 = 0;
info->state.world_transform.eDx = info->state.world_transform.eDy = 0; info->state.world_transform.eDx = info->state.world_transform.eDy = 0;
if (!IS_WIN9X())
EMF_Update_MF_Xform(hdc, info);
break; break;
case MWT_LEFTMULTIPLY: case MWT_LEFTMULTIPLY:
CombineTransform(&info->state.world_transform, &lpModifyWorldTrans->xform, CombineTransform(&info->state.world_transform, &lpModifyWorldTrans->xform,
&info->state.world_transform); &info->state.world_transform);
if (!IS_WIN9X())
ModifyWorldTransform(hdc, &lpModifyWorldTrans->xform, MWT_LEFTMULTIPLY);
break; break;
case MWT_RIGHTMULTIPLY: case MWT_RIGHTMULTIPLY:
CombineTransform(&info->state.world_transform, &info->state.world_transform, CombineTransform(&info->state.world_transform, &info->state.world_transform,
&lpModifyWorldTrans->xform); &lpModifyWorldTrans->xform);
if (!IS_WIN9X())
EMF_Update_MF_Xform(hdc, info);
break; break;
default: default:
FIXME("Unknown imode %d\n", lpModifyWorldTrans->iMode); FIXME("Unknown imode %d\n", lpModifyWorldTrans->iMode);
...@@ -2427,11 +2463,6 @@ BOOL WINAPI EnumEnhMetaFile( ...@@ -2427,11 +2463,6 @@ BOOL WINAPI EnumEnhMetaFile(
TRACE("Calling EnumFunc with record %s, size %d\n", get_emr_name(emr->iType), emr->nSize); TRACE("Calling EnumFunc with record %s, size %d\n", get_emr_name(emr->iType), emr->nSize);
ret = (*callback)(hdc, ht, emr, emh->nHandles, (LPARAM)data); ret = (*callback)(hdc, ht, emr, emh->nHandles, (LPARAM)data);
offset += emr->nSize; offset += emr->nSize;
/* WinNT - update the transform (win9x updates when the next graphics
output record is played). */
if (hdc && !IS_WIN9X())
EMF_Update_MF_Xform(hdc, info);
} }
if (hdc) if (hdc)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment