Alexandre Julliard : gdi32: Compute the extents of the whole string at once in ExtTextOut.
Alexandre Julliard
julliard at winehq.org
Thu Dec 20 12:39:56 CST 2012
Module: wine
Branch: master
Commit: 0da8c0d92ec095d806ffdd525cf03979283d5af3
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0da8c0d92ec095d806ffdd525cf03979283d5af3
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Dec 20 14:32:58 2012 +0100
gdi32: Compute the extents of the whole string at once in ExtTextOut.
---
dlls/gdi32/font.c | 47 +++++++++++++++++++++++++----------------------
1 files changed, 25 insertions(+), 22 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 3f79dff..51a6c23 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -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)
{
UINT i;
- SIZE tmpsz;
POINT total = {0, 0}, desired[2];
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].y = -lpDx[i * 2 + 1];
}
- else
+ }
+ else
+ {
+ for (i = 0; i < count; i++)
{
deltas[i].x = lpDx[i] + char_extra;
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
- {
- if(flags & ETO_GLYPH_INDEX)
- GetTextExtentPointI(hdc, glyphs + i, 1, &tmpsz);
- else
- GetTextExtentPointW(hdc, reordered_str + i, 1, &tmpsz);
+ GetTextExtentExPointW( hdc, reordered_str, count, -1, NULL, dx, &sz );
- deltas[i].x = tmpsz.cx;
- deltas[i].y = 0;
- }
-
- if (!(flags & ETO_GLYPH_INDEX) && (dc->breakExtra || breakRem) && reordered_str[i] == tm.tmBreakChar)
+ deltas[0].x = dx[0];
+ deltas[0].y = 0;
+ for (i = 1; i < count; i++)
{
- deltas[i].x = deltas[i].x + dc->breakExtra;
- if (breakRem > 0)
- {
- breakRem--;
- deltas[i].x++;
- }
+ deltas[i].x = dx[i] - dx[i - 1];
+ deltas[i].y = 0;
}
+ HeapFree( GetProcessHeap(), 0, dx );
+ }
+
+ for(i = 0; i < count; i++)
+ {
total.x += deltas[i].x;
total.y += deltas[i].y;
More information about the wine-cvs
mailing list