Commit 0da8c0d9 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Compute the extents of the whole string at once in ExtTextOut.

parent 718e2f25
...@@ -2232,46 +2232,49 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags, ...@@ -2232,46 +2232,49 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
if(char_extra || dc->breakExtra || breakRem || lpDx || lf.lfEscapement != 0) if(char_extra || dc->breakExtra || breakRem || lpDx || lf.lfEscapement != 0)
{ {
UINT i; UINT i;
SIZE tmpsz;
POINT total = {0, 0}, desired[2]; POINT total = {0, 0}, desired[2];
deltas = HeapAlloc(GetProcessHeap(), 0, count * sizeof(*deltas)); deltas = HeapAlloc(GetProcessHeap(), 0, count * sizeof(*deltas));
for(i = 0; i < count; i++) if (lpDx)
{ {
if(lpDx) if (flags & ETO_PDY)
{ {
if(flags & ETO_PDY) for (i = 0; i < count; i++)
{ {
deltas[i].x = lpDx[i * 2] + char_extra; deltas[i].x = lpDx[i * 2] + char_extra;
deltas[i].y = -lpDx[i * 2 + 1]; deltas[i].y = -lpDx[i * 2 + 1];
} }
else }
else
{
for (i = 0; i < count; i++)
{ {
deltas[i].x = lpDx[i] + char_extra; deltas[i].x = lpDx[i] + char_extra;
deltas[i].y = 0; deltas[i].y = 0;
} }
} }
}
else
{
INT *dx = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*dx) );
if (flags & ETO_GLYPH_INDEX)
GetTextExtentExPointI( hdc, glyphs, count, -1, NULL, dx, &sz );
else else
{ GetTextExtentExPointW( hdc, reordered_str, count, -1, NULL, dx, &sz );
if(flags & ETO_GLYPH_INDEX)
GetTextExtentPointI(hdc, glyphs + i, 1, &tmpsz);
else
GetTextExtentPointW(hdc, reordered_str + i, 1, &tmpsz);
deltas[i].x = tmpsz.cx; deltas[0].x = dx[0];
deltas[i].y = 0; deltas[0].y = 0;
} for (i = 1; i < count; i++)
if (!(flags & ETO_GLYPH_INDEX) && (dc->breakExtra || breakRem) && reordered_str[i] == tm.tmBreakChar)
{ {
deltas[i].x = deltas[i].x + dc->breakExtra; deltas[i].x = dx[i] - dx[i - 1];
if (breakRem > 0) deltas[i].y = 0;
{
breakRem--;
deltas[i].x++;
}
} }
HeapFree( GetProcessHeap(), 0, dx );
}
for(i = 0; i < count; i++)
{
total.x += deltas[i].x; total.x += deltas[i].x;
total.y += deltas[i].y; total.y += deltas[i].y;
......
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