Commit 81bc9dfb authored by Luc Tourangeau's avatar Luc Tourangeau Committed by Alexandre Julliard

Some adjustments to ExtTextOut.

parent 62efee23
...@@ -11,20 +11,71 @@ ...@@ -11,20 +11,71 @@
DEFAULT_DEBUG_CHANNEL(psdrv) DEFAULT_DEBUG_CHANNEL(psdrv)
static BOOL PSDRV_Text(DC *dc, INT x, INT y, LPCSTR str, UINT count);
/*********************************************************************** /***********************************************************************
* PSDRV_ExtTextOut * PSDRV_ExtTextOut
*/ */
BOOL PSDRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags, BOOL PSDRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
const RECT *lprect, LPCSTR str, UINT count, const RECT *lprect, LPCSTR str, UINT count,
const INT *lpDx ) const INT *lpDx )
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev; PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
char *strbuf; BOOL bResult = TRUE;
SIZE sz; RECT rect;
TRACE("(x=%d, y=%d, flags=0x%08x, str='%.*s', count=%d)\n", x, y, TRACE("(x=%d, y=%d, flags=0x%08x, str='%.*s', count=%d)\n", x, y,
flags, (int)count, str, count); flags, (int)count, str, count);
/* write font if not already written */
PSDRV_SetFont(dc);
/* set clipping and/or draw background */
if ((flags & (ETO_OPAQUE | ETO_CLIPPED)) && (lprect != NULL))
{
rect.left = XLPTODP(dc, lprect->left);
rect.right = XLPTODP(dc, lprect->right);
rect.top = YLPTODP(dc, lprect->top);
rect.bottom = YLPTODP(dc, lprect->bottom);
PSDRV_WriteGSave(dc);
PSDRV_WriteRectangle(dc, rect.left, rect.top, rect.right - rect.left,
rect.bottom - rect.top);
if (flags & ETO_OPAQUE)
{
PSDRV_WriteGSave(dc);
PSDRV_WriteSetColor(dc, &physDev->bkColor);
PSDRV_WriteFill(dc);
PSDRV_WriteGRestore(dc);
}
if (flags & ETO_CLIPPED)
{
PSDRV_WriteClip(dc);
}
bResult = PSDRV_Text(dc, x, y, str, count);
PSDRV_WriteGRestore(dc);
}
else
{
bResult = PSDRV_Text(dc, x, y, str, count);
}
return bResult;
}
/***********************************************************************
* PSDRV_Text
*/
static BOOL PSDRV_Text(DC *dc, INT x, INT y, LPCSTR str, UINT count)
{
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
char *strbuf;
SIZE sz;
POINT pt;
strbuf = (char *)HeapAlloc( PSDRV_Heap, 0, count + 1); strbuf = (char *)HeapAlloc( PSDRV_Heap, 0, count + 1);
if(!strbuf) { if(!strbuf) {
WARN("HeapAlloc failed\n"); WARN("HeapAlloc failed\n");
...@@ -36,8 +87,8 @@ BOOL PSDRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags, ...@@ -36,8 +87,8 @@ BOOL PSDRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
y = dc->w.CursPosY; y = dc->w.CursPosY;
} }
x = XLPTODP(dc, x); pt.x = x = XLPTODP(dc, x);
y = YLPTODP(dc, y); pt.y = y = YLPTODP(dc, y);
GetTextExtentPoint32A(dc->hSelf, str, count, &sz); GetTextExtentPoint32A(dc->hSelf, str, count, &sz);
sz.cx = XLSTODS(dc, sz.cx); sz.cx = XLSTODS(dc, sz.cx);
...@@ -78,6 +129,12 @@ BOOL PSDRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags, ...@@ -78,6 +129,12 @@ BOOL PSDRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
PSDRV_SetFont(dc); PSDRV_SetFont(dc);
PSDRV_WriteGSave(dc);
PSDRV_WriteNewPath(dc);
PSDRV_WriteRectangle(dc, pt.x, pt.y, sz.cx, sz.cy);
PSDRV_WriteSetColor(dc, &physDev->bkColor);
PSDRV_WriteFill(dc);
PSDRV_WriteGRestore(dc);
PSDRV_WriteMoveTo(dc, x, y); PSDRV_WriteMoveTo(dc, x, y);
PSDRV_WriteShow(dc, strbuf, strlen(strbuf)); PSDRV_WriteShow(dc, strbuf, strlen(strbuf));
......
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