Make SetMapMode set default window and viewport extents as in
Windows.
This commit is contained in:
parent
d98f4a5e43
commit
e8e10e9a8e
|
@ -38,12 +38,12 @@ void MAPPING_FixIsotropic( DC * dc )
|
||||||
(GetDeviceCaps( dc->hSelf, VERTRES ) * dc->wndExtY);
|
(GetDeviceCaps( dc->hSelf, VERTRES ) * dc->wndExtY);
|
||||||
if (xdim > ydim)
|
if (xdim > ydim)
|
||||||
{
|
{
|
||||||
dc->vportExtX = dc->vportExtX * fabs( ydim / xdim );
|
dc->vportExtX = floor(dc->vportExtX * fabs( ydim / xdim ) + 0.5);
|
||||||
if (!dc->vportExtX) dc->vportExtX = 1;
|
if (!dc->vportExtX) dc->vportExtX = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dc->vportExtY = dc->vportExtY * fabs( xdim / ydim );
|
dc->vportExtY = floor(dc->vportExtY * fabs( xdim / ydim ) + 0.5);
|
||||||
if (!dc->vportExtY) dc->vportExtY = 1;
|
if (!dc->vportExtY) dc->vportExtY = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,6 +163,10 @@ INT WINAPI SetMapMode( HDC hdc, INT mode )
|
||||||
TRACE("%p %d\n", hdc, mode );
|
TRACE("%p %d\n", hdc, mode );
|
||||||
|
|
||||||
ret = dc->MapMode;
|
ret = dc->MapMode;
|
||||||
|
|
||||||
|
if (mode == dc->MapMode && (mode == MM_ISOTROPIC || mode == MM_ANISOTROPIC))
|
||||||
|
goto done;
|
||||||
|
|
||||||
horzSize = GetDeviceCaps( hdc, HORZSIZE );
|
horzSize = GetDeviceCaps( hdc, HORZSIZE );
|
||||||
vertSize = GetDeviceCaps( hdc, VERTSIZE );
|
vertSize = GetDeviceCaps( hdc, VERTSIZE );
|
||||||
horzRes = GetDeviceCaps( hdc, HORZRES );
|
horzRes = GetDeviceCaps( hdc, HORZRES );
|
||||||
|
@ -177,34 +181,34 @@ INT WINAPI SetMapMode( HDC hdc, INT mode )
|
||||||
break;
|
break;
|
||||||
case MM_LOMETRIC:
|
case MM_LOMETRIC:
|
||||||
case MM_ISOTROPIC:
|
case MM_ISOTROPIC:
|
||||||
dc->wndExtX = horzSize;
|
dc->wndExtX = horzSize * 10;
|
||||||
dc->wndExtY = vertSize;
|
dc->wndExtY = vertSize * 10;
|
||||||
dc->vportExtX = horzRes / 10;
|
dc->vportExtX = horzRes;
|
||||||
dc->vportExtY = vertRes / -10;
|
dc->vportExtY = -vertRes;
|
||||||
break;
|
break;
|
||||||
case MM_HIMETRIC:
|
case MM_HIMETRIC:
|
||||||
dc->wndExtX = horzSize * 10;
|
dc->wndExtX = horzSize * 100;
|
||||||
dc->wndExtY = vertSize * 10;
|
dc->wndExtY = vertSize * 100;
|
||||||
dc->vportExtX = horzRes / 10;
|
dc->vportExtX = horzRes;
|
||||||
dc->vportExtY = vertRes / -10;
|
dc->vportExtY = -vertRes;
|
||||||
break;
|
break;
|
||||||
case MM_LOENGLISH:
|
case MM_LOENGLISH:
|
||||||
dc->wndExtX = horzSize;
|
dc->wndExtX = MulDiv(1000, horzSize, 254);
|
||||||
dc->wndExtY = vertSize;
|
dc->wndExtY = MulDiv(1000, vertSize, 254);
|
||||||
dc->vportExtX = 254L * horzRes / 1000;
|
dc->vportExtX = horzRes;
|
||||||
dc->vportExtY = -254L * vertRes / 1000;
|
dc->vportExtY = -vertRes;
|
||||||
break;
|
break;
|
||||||
case MM_HIENGLISH:
|
case MM_HIENGLISH:
|
||||||
dc->wndExtX = horzSize * 10;
|
dc->wndExtX = MulDiv(10000, horzSize, 254);
|
||||||
dc->wndExtY = vertSize * 10;
|
dc->wndExtY = MulDiv(10000, vertSize, 254);
|
||||||
dc->vportExtX = 254L * horzRes / 1000;
|
dc->vportExtX = horzRes;
|
||||||
dc->vportExtY = -254L * vertRes / 1000;
|
dc->vportExtY = -vertRes;
|
||||||
break;
|
break;
|
||||||
case MM_TWIPS:
|
case MM_TWIPS:
|
||||||
dc->wndExtX = 144L * horzSize / 10;
|
dc->wndExtX = MulDiv(14400, horzSize, 254);
|
||||||
dc->wndExtY = 144L * vertSize / 10;
|
dc->wndExtY = MulDiv(14400, vertSize, 254);
|
||||||
dc->vportExtX = 254L * horzRes / 1000;
|
dc->vportExtX = horzRes;
|
||||||
dc->vportExtY = -254L * vertRes / 1000;
|
dc->vportExtY = -vertRes;
|
||||||
break;
|
break;
|
||||||
case MM_ANISOTROPIC:
|
case MM_ANISOTROPIC:
|
||||||
break;
|
break;
|
||||||
|
@ -321,7 +325,7 @@ BOOL WINAPI SetWindowExtEx( HDC hdc, INT x, INT y, LPSIZE size )
|
||||||
}
|
}
|
||||||
dc->wndExtX = x;
|
dc->wndExtX = x;
|
||||||
dc->wndExtY = y;
|
dc->wndExtY = y;
|
||||||
if (dc->MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc );
|
/* Windows fixes MM_ISOTROPIC mode only in SetViewportExtEx() */
|
||||||
DC_UpdateXforms( dc );
|
DC_UpdateXforms( dc );
|
||||||
done:
|
done:
|
||||||
GDI_ReleaseObj( hdc );
|
GDI_ReleaseObj( hdc );
|
||||||
|
|
|
@ -360,34 +360,34 @@ void EMF_SetMapMode(HDC hdc, enum_emh_data *info)
|
||||||
break;
|
break;
|
||||||
case MM_LOMETRIC:
|
case MM_LOMETRIC:
|
||||||
case MM_ISOTROPIC:
|
case MM_ISOTROPIC:
|
||||||
info->wndExtX = horzSize;
|
info->wndExtX = horzSize * 10;
|
||||||
info->wndExtY = vertSize;
|
info->wndExtY = vertSize * 10;
|
||||||
info->vportExtX = horzRes / 10;
|
info->vportExtX = horzRes;
|
||||||
info->vportExtY = vertRes / -10;
|
info->vportExtY = -vertRes;
|
||||||
break;
|
break;
|
||||||
case MM_HIMETRIC:
|
case MM_HIMETRIC:
|
||||||
info->wndExtX = horzSize * 10;
|
info->wndExtX = horzSize * 100;
|
||||||
info->wndExtY = vertSize * 10;
|
info->wndExtY = vertSize * 100;
|
||||||
info->vportExtX = horzRes / 10;
|
info->vportExtX = horzRes;
|
||||||
info->vportExtY = vertRes / -10;
|
info->vportExtY = -vertRes;
|
||||||
break;
|
break;
|
||||||
case MM_LOENGLISH:
|
case MM_LOENGLISH:
|
||||||
info->wndExtX = horzSize;
|
info->wndExtX = MulDiv(1000, horzSize, 254);
|
||||||
info->wndExtY = vertSize;
|
info->wndExtY = MulDiv(1000, vertSize, 254);
|
||||||
info->vportExtX = 254L * horzRes / 1000;
|
info->vportExtX = horzRes;
|
||||||
info->vportExtY = -254L * vertRes / 1000;
|
info->vportExtY = -vertRes;
|
||||||
break;
|
break;
|
||||||
case MM_HIENGLISH:
|
case MM_HIENGLISH:
|
||||||
info->wndExtX = horzSize * 10;
|
info->wndExtX = MulDiv(10000, horzSize, 254);
|
||||||
info->wndExtY = vertSize * 10;
|
info->wndExtY = MulDiv(10000, vertSize, 254);
|
||||||
info->vportExtX = 254L * horzRes / 1000;
|
info->vportExtX = horzRes;
|
||||||
info->vportExtY = -254L * vertRes / 1000;
|
info->vportExtY = -vertRes;
|
||||||
break;
|
break;
|
||||||
case MM_TWIPS:
|
case MM_TWIPS:
|
||||||
info->wndExtX = 144L * horzSize / 10;
|
info->wndExtX = MulDiv(14400, horzSize, 254);
|
||||||
info->wndExtY = 144L * vertSize / 10;
|
info->wndExtY = MulDiv(14400, vertSize, 254);
|
||||||
info->vportExtX = 254L * horzRes / 1000;
|
info->vportExtX = horzRes;
|
||||||
info->vportExtY = -254L * vertRes / 1000;
|
info->vportExtY = -vertRes;
|
||||||
break;
|
break;
|
||||||
case MM_ANISOTROPIC:
|
case MM_ANISOTROPIC:
|
||||||
break;
|
break;
|
||||||
|
@ -516,7 +516,7 @@ BOOL WINAPI PlayEnhMetaFileRecord(
|
||||||
{
|
{
|
||||||
PEMRSETMAPMODE pSetMapMode = (PEMRSETMAPMODE) mr;
|
PEMRSETMAPMODE pSetMapMode = (PEMRSETMAPMODE) mr;
|
||||||
|
|
||||||
if(info->mode == pSetMapMode->iMode)
|
if(info->mode == pSetMapMode->iMode && (info->mode == MM_ISOTROPIC || info->mode == MM_ANISOTROPIC))
|
||||||
break;
|
break;
|
||||||
info->mode = pSetMapMode->iMode;
|
info->mode = pSetMapMode->iMode;
|
||||||
EMF_SetMapMode(hdc, info);
|
EMF_SetMapMode(hdc, info);
|
||||||
|
|
Loading…
Reference in New Issue