gdi32: Avoid duplicate computation of text extents in ExtTextOut.

This commit is contained in:
Alexandre Julliard 2012-12-20 15:08:23 +01:00
parent 0da8c0d92e
commit 57f84bc7bb
1 changed files with 9 additions and 34 deletions

View File

@ -2097,7 +2097,6 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
INT char_extra; INT char_extra;
SIZE sz; SIZE sz;
RECT rc; RECT rc;
BOOL done_extents = FALSE;
POINT *deltas = NULL, width = {0, 0}; POINT *deltas = NULL, width = {0, 0};
DWORD type; DWORD type;
DC * dc = get_dc_ptr( hdc ); DC * dc = get_dc_ptr( hdc );
@ -2125,9 +2124,6 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
return ret; return ret;
} }
if (!lprect)
flags &= ~ETO_CLIPPED;
if (flags & ETO_RTLREADING) align |= TA_RTLREADING; if (flags & ETO_RTLREADING) align |= TA_RTLREADING;
if (layout & LAYOUT_RTL) if (layout & LAYOUT_RTL)
{ {
@ -2189,32 +2185,15 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
sinEsc = 0; sinEsc = 0;
} }
if(flags & (ETO_CLIPPED | ETO_OPAQUE)) if (lprect)
{ {
if(!lprect) rc = *lprect;
{
if(flags & ETO_GLYPH_INDEX)
GetTextExtentPointI(hdc, glyphs, count, &sz);
else
GetTextExtentPointW(hdc, reordered_str, count, &sz);
done_extents = TRUE;
rc.left = x;
rc.top = y;
rc.right = x + sz.cx;
rc.bottom = y + sz.cy;
}
else
{
rc = *lprect;
}
LPtoDP(hdc, (POINT*)&rc, 2); LPtoDP(hdc, (POINT*)&rc, 2);
order_rect( &rc ); order_rect( &rc );
if (flags & ETO_OPAQUE)
physdev->funcs->pExtTextOut( physdev, 0, 0, ETO_OPAQUE, &rc, NULL, 0, NULL );
} }
else flags &= ~ETO_CLIPPED;
if (lprect && (flags & ETO_OPAQUE))
physdev->funcs->pExtTextOut( physdev, 0, 0, ETO_OPAQUE, &rc, NULL, 0, NULL );
if(count == 0) if(count == 0)
{ {
@ -2306,14 +2285,10 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
{ {
POINT desired[2]; POINT desired[2];
if(!done_extents) if(flags & ETO_GLYPH_INDEX)
{ GetTextExtentPointI(hdc, glyphs, count, &sz);
if(flags & ETO_GLYPH_INDEX) else
GetTextExtentPointI(hdc, glyphs, count, &sz); GetTextExtentPointW(hdc, reordered_str, count, &sz);
else
GetTextExtentPointW(hdc, reordered_str, count, &sz);
done_extents = TRUE;
}
desired[0].x = desired[0].y = 0; desired[0].x = desired[0].y = 0;
desired[1].x = sz.cx; desired[1].x = sz.cx;
desired[1].y = 0; desired[1].y = 0;