Several fixes for playing enhanced metafiles in a given rectangle.
This commit is contained in:
parent
08936ff97a
commit
d40ef6bfe4
|
@ -638,17 +638,19 @@ BOOL WINAPI PlayEnhMetaFileRecord(
|
||||||
}
|
}
|
||||||
case EMR_EXTTEXTOUTW:
|
case EMR_EXTTEXTOUTW:
|
||||||
{
|
{
|
||||||
/* 0-3: ??? */
|
/* 0-3: rect ??? */
|
||||||
DWORD flags = mr->dParm[4];
|
DWORD flags = mr->dParm[4];
|
||||||
/* 5, 6: ??? */
|
/* 5, 6: ??? */
|
||||||
DWORD x = mr->dParm[7], y = mr->dParm[8];
|
DWORD x = mr->dParm[7], y = mr->dParm[8];
|
||||||
DWORD count = mr->dParm[9];
|
DWORD count = mr->dParm[9];
|
||||||
/* 10-16: ??? */
|
LPWSTR str = (LPWSTR)((char *)mr + mr->dParm[10]);
|
||||||
LPWSTR str = (LPWSTR)& mr->dParm[17];
|
/* 11: ??? */
|
||||||
/* trailing info: dx array? */
|
/* 12-15: rect ???*/
|
||||||
FIXME("Many ExtTextOut args not handled\n");
|
LPINT lpDx = (LPINT)((char *)mr + mr->dParm[16]);
|
||||||
ExtTextOutW(hdc, x, y, flags, /* lpRect */ NULL,
|
|
||||||
str, count, /* lpDx */ NULL);
|
FIXME("Some ExtTextOut args not handled\n");
|
||||||
|
ExtTextOutW(hdc, x, y, flags, NULL,
|
||||||
|
str, count, lpDx);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -666,9 +668,12 @@ BOOL WINAPI PlayEnhMetaFileRecord(
|
||||||
{
|
{
|
||||||
PEMRSELECTPALETTE lpSelectPal = (PEMRSELECTPALETTE)mr;
|
PEMRSELECTPALETTE lpSelectPal = (PEMRSELECTPALETTE)mr;
|
||||||
|
|
||||||
/* FIXME: Should this be forcing background mode? */
|
if( lpSelectPal->ihPal & 0x80000000 ) {
|
||||||
|
SelectPalette( hdc, GetStockObject(lpSelectPal->ihPal & 0x7fffffff), TRUE);
|
||||||
|
} else {
|
||||||
(handletable->objectHandle)[ lpSelectPal->ihPal ] =
|
(handletable->objectHandle)[ lpSelectPal->ihPal ] =
|
||||||
SelectPalette( hdc, (handletable->objectHandle)[lpSelectPal->ihPal], FALSE );
|
SelectPalette( hdc, (handletable->objectHandle)[lpSelectPal->ihPal], TRUE);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -704,9 +709,7 @@ BOOL WINAPI PlayEnhMetaFileRecord(
|
||||||
case EMR_SETWORLDTRANSFORM:
|
case EMR_SETWORLDTRANSFORM:
|
||||||
{
|
{
|
||||||
PEMRSETWORLDTRANSFORM lpXfrm = (PEMRSETWORLDTRANSFORM)mr;
|
PEMRSETWORLDTRANSFORM lpXfrm = (PEMRSETWORLDTRANSFORM)mr;
|
||||||
|
|
||||||
SetWorldTransform( hdc, &lpXfrm->xform );
|
SetWorldTransform( hdc, &lpXfrm->xform );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1219,9 +1222,11 @@ BOOL WINAPI EnumEnhMetaFile(
|
||||||
INT savedMode = 0;
|
INT savedMode = 0;
|
||||||
FLOAT xSrcPixSize, ySrcPixSize, xscale, yscale;
|
FLOAT xSrcPixSize, ySrcPixSize, xscale, yscale;
|
||||||
XFORM savedXform, xform;
|
XFORM savedXform, xform;
|
||||||
HPEN hPen;
|
HPEN hPen = (HPEN)NULL;
|
||||||
HBRUSH hBrush;
|
HBRUSH hBrush = (HBRUSH)NULL;
|
||||||
HFONT hFont;
|
HFONT hFont = (HFONT)NULL;
|
||||||
|
|
||||||
|
XFORM outXform;
|
||||||
|
|
||||||
if(!lpRect)
|
if(!lpRect)
|
||||||
{
|
{
|
||||||
|
@ -1257,6 +1262,8 @@ BOOL WINAPI EnumEnhMetaFile(
|
||||||
}
|
}
|
||||||
ht->objectHandle[0] = hmf;
|
ht->objectHandle[0] = hmf;
|
||||||
|
|
||||||
|
if (hdc)
|
||||||
|
{
|
||||||
xSrcPixSize = (FLOAT) emh->szlMillimeters.cx / emh->szlDevice.cx;
|
xSrcPixSize = (FLOAT) emh->szlMillimeters.cx / emh->szlDevice.cx;
|
||||||
ySrcPixSize = (FLOAT) emh->szlMillimeters.cy / emh->szlDevice.cy;
|
ySrcPixSize = (FLOAT) emh->szlMillimeters.cy / emh->szlDevice.cy;
|
||||||
xscale = (FLOAT)(lpRect->right - lpRect->left) * 100.0 /
|
xscale = (FLOAT)(lpRect->right - lpRect->left) * 100.0 /
|
||||||
|
@ -1268,21 +1275,23 @@ BOOL WINAPI EnumEnhMetaFile(
|
||||||
xform.eM12 = 0;
|
xform.eM12 = 0;
|
||||||
xform.eM21 = 0;
|
xform.eM21 = 0;
|
||||||
xform.eM22 = yscale;
|
xform.eM22 = yscale;
|
||||||
if(emh->rclFrame.left || emh->rclFrame.top)
|
xform.eDx = (FLOAT)lpRect->left - (xscale * emh->rclFrame.left * 0.5);
|
||||||
FIXME("Can't cope with nonzero rclFrame origin yet\n");
|
xform.eDy = (FLOAT)lpRect->top - (yscale * (FLOAT)emh->rclFrame.top * 0.5);
|
||||||
/* eDx = lpRect->left - (lpRect width) / (rclFrame width) * rclFrame.left ? */
|
|
||||||
xform.eDx = lpRect->left;
|
|
||||||
xform.eDy = lpRect->top;
|
|
||||||
savedMode = SetGraphicsMode(hdc, GM_ADVANCED);
|
savedMode = SetGraphicsMode(hdc, GM_ADVANCED);
|
||||||
GetWorldTransform(hdc, &savedXform);
|
GetWorldTransform(hdc, &savedXform);
|
||||||
if (!ModifyWorldTransform(hdc, &xform, MWT_LEFTMULTIPLY)) {
|
|
||||||
|
if (!ModifyWorldTransform(hdc, &xform, MWT_RIGHTMULTIPLY)) {
|
||||||
ERR("World transform failed!\n");
|
ERR("World transform failed!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GetWorldTransform(hdc, &outXform);
|
||||||
|
|
||||||
/* save the current pen, brush and font */
|
/* save the current pen, brush and font */
|
||||||
hPen = GetCurrentObject(hdc, OBJ_PEN);
|
hPen = GetCurrentObject(hdc, OBJ_PEN);
|
||||||
hBrush = GetCurrentObject(hdc, OBJ_BRUSH);
|
hBrush = GetCurrentObject(hdc, OBJ_BRUSH);
|
||||||
hFont = GetCurrentObject(hdc, OBJ_FONT);
|
hFont = GetCurrentObject(hdc, OBJ_FONT);
|
||||||
|
}
|
||||||
|
|
||||||
TRACE("nSize = %ld, nBytes = %ld, nHandles = %d, nRecords = %ld, nPalEntries = %ld\n",
|
TRACE("nSize = %ld, nBytes = %ld, nHandles = %d, nRecords = %ld, nPalEntries = %ld\n",
|
||||||
emh->nSize, emh->nBytes, emh->nHandles, emh->nRecords, emh->nPalEntries);
|
emh->nSize, emh->nBytes, emh->nHandles, emh->nRecords, emh->nPalEntries);
|
||||||
|
@ -1293,25 +1302,29 @@ BOOL WINAPI EnumEnhMetaFile(
|
||||||
{
|
{
|
||||||
emr = (ENHMETARECORD *)((char *)emh + offset);
|
emr = (ENHMETARECORD *)((char *)emh + offset);
|
||||||
TRACE("Calling EnumFunc with record type %ld, size %ld\n", emr->iType, emr->nSize);
|
TRACE("Calling EnumFunc with record type %ld, size %ld\n", emr->iType, emr->nSize);
|
||||||
ret = (*callback)(hdc, ht, emr, emh->nRecords, data);
|
ret = (*callback)(hdc, ht, emr, emh->nHandles, data);
|
||||||
offset += emr->nSize;
|
offset += emr->nSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hdc)
|
||||||
|
{
|
||||||
/* restore pen, brush and font */
|
/* restore pen, brush and font */
|
||||||
SelectObject(hdc, hBrush);
|
SelectObject(hdc, hBrush);
|
||||||
SelectObject(hdc, hPen);
|
SelectObject(hdc, hPen);
|
||||||
SelectObject(hdc, hFont);
|
SelectObject(hdc, hFont);
|
||||||
|
|
||||||
for(i = 1; i < emh->nRecords; i++) /* Don't delete element 0 (hmf) */
|
SetWorldTransform(hdc, &savedXform);
|
||||||
|
if (savedMode)
|
||||||
|
SetGraphicsMode(hdc, savedMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = 1; i < emh->nHandles; i++) /* Don't delete element 0 (hmf) */
|
||||||
if( (ht->objectHandle)[i] )
|
if( (ht->objectHandle)[i] )
|
||||||
DeleteObject( (ht->objectHandle)[i] );
|
DeleteObject( (ht->objectHandle)[i] );
|
||||||
|
|
||||||
HeapFree( GetProcessHeap(), 0, ht );
|
HeapFree( GetProcessHeap(), 0, ht );
|
||||||
HeapFree(GetProcessHeap(), 0, emhTemp);
|
HeapFree(GetProcessHeap(), 0, emhTemp);
|
||||||
|
|
||||||
SetWorldTransform(hdc, &savedXform);
|
|
||||||
if (savedMode) SetGraphicsMode(hdc, savedMode);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue