ChangeSet ID: 20315 CVSROOT: /opt/cvs-commit Module name: wine Changes by: julliard@winehq.org 2005/09/21 04:41:13 Modified files: dlls/gdi : font.c Log message: Huw Davies Release the dc before drawing the underline and strikeout lines. Patch: http://cvs.winehq.org/patch.py?id=20315 Old revision New revision Changes Path 1.18 1.19 +18 -18 wine/dlls/gdi/font.c Index: wine/dlls/gdi/font.c diff -u -p wine/dlls/gdi/font.c:1.18 wine/dlls/gdi/font.c:1.19 --- wine/dlls/gdi/font.c:1.18 Thu May 23 20:01:47 2013 +++ wine/dlls/gdi/font.c Thu May 23 20:01:47 2013 @@ -1748,7 +1748,7 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, SIZE sz; RECT rc; BOOL done_extents = FALSE; - INT width, xwidth, ywidth; + INT width, xwidth = 0, ywidth = 0; DWORD type; DC * dc = DC_GetDCUpdate( hdc ); @@ -2042,14 +2042,23 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, glyphs ? glyphs : reordered_str, count, deltas); } - if (lf.lfUnderline || lf.lfStrikeOut) +done: + HeapFree(GetProcessHeap(), 0, deltas); + if(glyphs != reordered_str) + HeapFree(GetProcessHeap(), 0, glyphs); + if(reordered_str != str) + HeapFree(GetProcessHeap(), 0, reordered_str); + + GDI_ReleaseObj( hdc ); + + if (ret && (lf.lfUnderline || lf.lfStrikeOut)) { int underlinePos, strikeoutPos; int underlineWidth, strikeoutWidth; - UINT nMetricsSize = GetOutlineTextMetricsW(hdc, 0, NULL); + UINT size = GetOutlineTextMetricsW(hdc, 0, NULL); OUTLINETEXTMETRICW* otm = NULL; - if(!nMetricsSize) + if(!size) { TEXTMETRICW tm; GetTextMetricsW(hdc, &tm); @@ -2060,20 +2069,19 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, } else { - otm = HeapAlloc(GetProcessHeap(), 0, nMetricsSize); - if (!otm) goto done; - - GetOutlineTextMetricsW(hdc, nMetricsSize, otm); + otm = HeapAlloc(GetProcessHeap(), 0, size); + GetOutlineTextMetricsW(hdc, size, otm); underlinePos = otm->otmsUnderscorePosition; underlineWidth = otm->otmsUnderscoreSize; strikeoutPos = otm->otmsStrikeoutPosition; strikeoutWidth = otm->otmsStrikeoutSize; + HeapFree(GetProcessHeap(), 0, otm); } if(lf.lfUnderline) { POINT pts[2], oldpt; - HPEN hpen = CreatePen(PS_SOLID, underlineWidth, dc->textColor); + HPEN hpen = CreatePen(PS_SOLID, underlineWidth, GetTextColor(hdc)); hpen = SelectObject(hdc, hpen); pts[0].x = x; pts[0].y = y; @@ -2089,7 +2097,7 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, if(lf.lfStrikeOut) { POINT pts[2], oldpt; - HPEN hpen = CreatePen(PS_SOLID, strikeoutWidth, dc->textColor); + HPEN hpen = CreatePen(PS_SOLID, strikeoutWidth, GetTextColor(hdc)); hpen = SelectObject(hdc, hpen); pts[0].x = x; pts[0].y = y; @@ -2103,14 +2111,6 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, } } -done: - HeapFree(GetProcessHeap(), 0, deltas); - if(glyphs != reordered_str) - HeapFree(GetProcessHeap(), 0, glyphs); - if(reordered_str != str) - HeapFree(GetProcessHeap(), 0, reordered_str); - - GDI_ReleaseObj( hdc ); return ret; }