Commit 269b2519 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

gdi32/enhmfdrv: Always set ExtTextOut bounding rect if we're not inside path bracket.

parent a3e741fd
......@@ -420,8 +420,11 @@ BOOL EMFDRV_AbortPath( PHYSDEV dev )
BOOL EMFDRV_BeginPath( PHYSDEV dev )
{
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE*) dev;
EMRBEGINPATH emr;
physDev->path = TRUE;
emr.emr.iType = EMR_BEGINPATH;
emr.emr.nSize = sizeof(emr);
......@@ -440,8 +443,11 @@ BOOL EMFDRV_CloseFigure( PHYSDEV dev )
BOOL EMFDRV_EndPath( PHYSDEV dev )
{
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE*) dev;
EMRENDPATH emr;
physDev->path = FALSE;
emr.emr.iType = EMR_ENDPATH;
emr.emr.nSize = sizeof(emr);
......
......@@ -42,6 +42,7 @@ typedef struct
HDC ref_dc; /* Reference device */
HDC screen_dc; /* Screen DC if no reference device specified */
INT restoring; /* RestoreDC counter */
BOOL path;
} EMFDRV_PDEVICE;
......
......@@ -746,6 +746,7 @@ BOOL EMFDRV_InvertRgn( PHYSDEV dev, HRGN hrgn )
BOOL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *lprect,
LPCWSTR str, UINT count, const INT *lpDx )
{
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE*) dev;
EMREXTTEXTOUTW *pemr;
DWORD nSize;
BOOL ret;
......@@ -827,13 +828,14 @@ BOOL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *lprec
}
}
if (!lprect)
if (physDev->path)
{
pemr->rclBounds.left = pemr->rclBounds.top = 0;
pemr->rclBounds.right = pemr->rclBounds.bottom = -1;
goto no_bounds;
}
/* FIXME: handle font escapement */
switch (textAlign & (TA_LEFT | TA_RIGHT | TA_CENTER)) {
case TA_CENTER: {
pemr->rclBounds.left = x - (textWidth / 2) - 1;
......
......@@ -352,6 +352,7 @@ HDC WINAPI CreateEnhMetaFileW(
physDev->dc_pen = 0;
physDev->screen_dc = 0;
physDev->restoring = 0;
physDev->path = FALSE;
if (hdc) /* if no ref, use current display */
physDev->ref_dc = hdc;
else
......
......@@ -148,6 +148,13 @@ static int CALLBACK eto_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
ok(!memcmp(&orig_lf, &device_lf, FIELD_OFFSET(LOGFONTA, lfOutPrecision)), "fonts don't match\n");
ok(!lstrcmpA(orig_lf.lfFaceName, device_lf.lfFaceName), "font names don't match\n");
ok(!emr_ExtTextOutW->rclBounds.left, "emr_ExtTextOutW->rclBounds.left = %d\n",
emr_ExtTextOutW->rclBounds.left);
ok(emr_ExtTextOutW->rclBounds.right != -1, "emr_ExtTextOutW->rclBounds.right = %d\n",
emr_ExtTextOutW->rclBounds.right);
ok(emr_ExtTextOutW->rclBounds.bottom != -1, "emr_ExtTextOutW->rclBounds.bottom = %d\n",
emr_ExtTextOutW->rclBounds.bottom);
for(i = 0; i < emr_ExtTextOutW->emrtext.nChars; i++)
{
ok(orig_dx[i] == dx[i], "pass %d: dx[%d] (%d) didn't match %d\n",
......@@ -229,6 +236,10 @@ static void test_ExtTextOut(void)
ret = ExtTextOutA(hdcMetafile, 0, 20, 0, &rc, text, lstrlenA(text), dx);
ok( ret, "ExtTextOutA error %d\n", GetLastError());
/* 3. pass NULL lprc */
ret = ExtTextOutA(hdcMetafile, 0, 40, 0, NULL, text, lstrlenA(text), NULL);
ok( ret, "ExtTextOutA error %d\n", GetLastError());
hFont = SelectObject(hdcMetafile, hFont);
ret = DeleteObject(hFont);
ok( ret, "DeleteObject error %d\n", GetLastError());
......
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