Added temp fix for world transform bug in SetWindowOrgEx handler.

Added handlers for EMR_SETTEXTJUSTIFICATION and EMR_SETLAYOUT.
This commit is contained in:
Ulrich Czekalla 2002-06-24 23:09:19 +00:00 committed by Alexandre Julliard
parent 1d70715198
commit 550b97e7cd
2 changed files with 97 additions and 23 deletions

View File

@ -2495,6 +2495,12 @@ typedef struct {
BYTE Data[1];
} EMRGLSBOUNDEDRECORD, *PEMRGLSBOUNDEDRECORD;
typedef struct {
EMR emr;
INT nBreakExtra;
INT nBreakCount;
} EMRSETTEXTJUSTIFICATION, *PEMRSETTEXTJUSTIFICATION;
typedef INT (CALLBACK *ENHMFENUMPROC)(HDC, LPHANDLETABLE,
LPENHMETARECORD, INT, LPVOID);
@ -2601,9 +2607,27 @@ typedef INT (CALLBACK *ENHMFENUMPROC)(HDC, LPHANDLETABLE,
#define EMR_GLSRECORD 102
#define EMR_GLSBOUNDEDRECORD 103
#define EMR_PIXELFORMAT 104
#define EMR_DRAWESCAPE 105
#define EMR_EXTESCAPE 106
#define EMR_STARTDOC 107
#define EMR_SMALLTEXTOUT 108
#define EMR_FORCEUFIMAPPING 109
#define EMR_NAMEDESCAPE 110
#define EMR_COLORCORRECTPALETTE 111
#define EMR_SETICMPROFILEA 112
#define EMR_SETICMPROFILEW 113
#define EMR_ALPHABLEND 114
#define EMR_SETLAYOUT 115
#define EMR_TRANSPARENTBLT 116
#define EMR_RESERVED_117 117
#define EMR_GRADIENTFILL 118
#define EMR_SETLINKEDUFI 119
#define EMR_SETTEXTJUSTIFICATION 120
#define EMR_COLORMATCHTOTARGETW 121
#define EMR_CREATECOLORSPACEW 122
#define EMR_MIN 1
#define EMR_MAX 104
#define EMR_MAX 122
#define ENHMETA_SIGNATURE 1179469088
#define ENHMETA_STOCK_OBJECT 0x80000000

View File

@ -416,16 +416,18 @@ BOOL WINAPI PlayEnhMetaFileRecord(
}
case EMR_SETWINDOWORGEX:
{
/*
* FIXME: The call to SetWindowOrgEx prevents EMFs from being scrolled
* by an application. This is very BAD!!!
*/
#if 0
PEMRSETWINDOWORGEX pSetWindowOrgEx = (PEMRSETWINDOWORGEX) mr;
SetWindowOrgEx(hdc, pSetWindowOrgEx->ptlOrigin.x,
pSetWindowOrgEx->ptlOrigin.y, NULL);
#endif
break;
XFORM xform;
PEMRSETWINDOWORGEX pSetWindowOrgEx = (PEMRSETWINDOWORGEX) mr;
xform.eM11 = 1;
xform.eM12 = 0;
xform.eM21 = 0;
xform.eM22 = 1;
xform.eDx = -pSetWindowOrgEx->ptlOrigin.x;
xform.eDy = -pSetWindowOrgEx->ptlOrigin.y;
ModifyWorldTransform(hdc, &xform, MWT_LEFTMULTIPLY);
break;
}
case EMR_SETWINDOWEXTEX:
{
@ -1181,7 +1183,7 @@ BOOL WINAPI PlayEnhMetaFileRecord(
PEMRBITBLT pBitBlt = (PEMRBITBLT)mr;
HDC hdcSrc = CreateCompatibleDC(hdc);
HBRUSH hBrush, hBrushOld;
HBITMAP hBmp, hBmpOld;
HBITMAP hBmp = 0, hBmpOld = 0;
BITMAPINFO *pbi = (BITMAPINFO *)((BYTE *)mr + pBitBlt->offBmiSrc);
SetWorldTransform(hdcSrc, &pBitBlt->xformSrc);
@ -1194,9 +1196,13 @@ BOOL WINAPI PlayEnhMetaFileRecord(
SelectObject(hdcSrc, hBrushOld);
DeleteObject(hBrush);
hBmp = CreateDIBitmap(0, (BITMAPINFOHEADER *)pbi, CBM_INIT,
(BYTE *)mr + pBitBlt->offBitsSrc, pbi, pBitBlt->iUsageSrc);
hBmpOld = SelectObject(hdcSrc, hBmp);
if (pBitBlt->offBmiSrc > 0)
{
hBmp = CreateDIBitmap(0, (BITMAPINFOHEADER *)pbi, CBM_INIT,
(BYTE *)mr + pBitBlt->offBitsSrc, pbi, pBitBlt->iUsageSrc);
hBmpOld = SelectObject(hdcSrc, hBmp);
}
BitBlt(hdc,
pBitBlt->xDest,
pBitBlt->yDest,
@ -1206,8 +1212,12 @@ BOOL WINAPI PlayEnhMetaFileRecord(
pBitBlt->xSrc,
pBitBlt->ySrc,
pBitBlt->dwRop);
SelectObject(hdcSrc, hBmpOld);
DeleteObject(hBmp);
if (pBitBlt->offBmiSrc > 0)
{
SelectObject(hdcSrc, hBmpOld);
DeleteObject(hBmp);
}
DeleteDC(hdcSrc);
break;
}
@ -1217,7 +1227,7 @@ BOOL WINAPI PlayEnhMetaFileRecord(
PEMRSTRETCHBLT pStretchBlt= (PEMRSTRETCHBLT)mr;
HDC hdcSrc = CreateCompatibleDC(hdc);
HBRUSH hBrush, hBrushOld;
HBITMAP hBmp, hBmpOld;
HBITMAP hBmp = 0, hBmpOld = 0;
BITMAPINFO *pbi = (BITMAPINFO *)((BYTE *)mr + pStretchBlt->offBmiSrc);
SetWorldTransform(hdcSrc, &pStretchBlt->xformSrc);
@ -1230,9 +1240,13 @@ BOOL WINAPI PlayEnhMetaFileRecord(
SelectObject(hdcSrc, hBrushOld);
DeleteObject(hBrush);
hBmp = CreateDIBitmap(0, (BITMAPINFOHEADER *)pbi, CBM_INIT,
(BYTE *)mr + pStretchBlt->offBitsSrc, pbi, pStretchBlt->iUsageSrc);
hBmpOld = SelectObject(hdcSrc, hBmp);
if (pStretchBlt->offBmiSrc)
{
hBmp = CreateDIBitmap(0, (BITMAPINFOHEADER *)pbi, CBM_INIT,
(BYTE *)mr + pStretchBlt->offBitsSrc, pbi, pStretchBlt->iUsageSrc);
hBmpOld = SelectObject(hdcSrc, hBmp);
}
StretchBlt(hdc,
pStretchBlt->xDest,
pStretchBlt->yDest,
@ -1244,8 +1258,14 @@ BOOL WINAPI PlayEnhMetaFileRecord(
pStretchBlt->cxSrc,
pStretchBlt->cySrc,
pStretchBlt->dwRop);
SelectObject(hdcSrc, hBmpOld);
DeleteObject(hBmp);
if (pStretchBlt->offBmiSrc)
{
SelectObject(hdcSrc, hBmpOld);
DeleteObject(hBmp);
}
DeleteDC(hdcSrc);
break;
}
@ -1486,9 +1506,39 @@ BOOL WINAPI PlayEnhMetaFileRecord(
break;
}
case EMR_SETTEXTJUSTIFICATION:
{
PEMRSETTEXTJUSTIFICATION pSetTextJust = (PEMRSETTEXTJUSTIFICATION)mr;
SetTextJustification(hdc, pSetTextJust->nBreakExtra, pSetTextJust->nBreakCount);
break;
}
case EMR_SETLAYOUT:
{
PEMRSETLAYOUT pSetLayout = (PEMRSETLAYOUT)mr;
SetLayout(hdc, pSetLayout->iMode);
break;
}
case EMR_POLYDRAW16:
case EMR_GLSRECORD:
case EMR_GLSBOUNDEDRECORD:
case EMR_DRAWESCAPE :
case EMR_EXTESCAPE:
case EMR_STARTDOC:
case EMR_SMALLTEXTOUT:
case EMR_FORCEUFIMAPPING:
case EMR_NAMEDESCAPE:
case EMR_COLORCORRECTPALETTE:
case EMR_SETICMPROFILEA:
case EMR_SETICMPROFILEW:
case EMR_ALPHABLEND:
case EMR_TRANSPARENTBLT:
case EMR_GRADIENTFILL:
case EMR_SETLINKEDUFI:
case EMR_COLORMATCHTOTARGETW:
case EMR_CREATECOLORSPACEW:
default:
/* From docs: If PlayEnhMetaFileRecord doesn't recognize a
record then ignore and return TRUE. */