NtGdiExtTextOut(): fixed some double-frees I introduced, initialize variables that need it, put {} around DPRINT(1) where needed

svn path=/trunk/; revision=12205
This commit is contained in:
Royce Mitchell III 2004-12-18 21:35:35 +00:00
parent ef53a44b8a
commit de1d28fabc

View file

@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: text.c,v 1.121 2004/12/18 18:21:02 royce Exp $ */
/* $Id: text.c,v 1.122 2004/12/18 21:35:35 royce Exp $ */
#include <w32k.h>
#include <ft2build.h>
@ -1499,7 +1499,7 @@ NtGdiExtTextOut(
PFONTGDI FontGDI;
PTEXTOBJ TextObj = NULL;
PPALGDI PalDestGDI;
XLATEOBJ *XlateObj, *XlateObj2;
XLATEOBJ *XlateObj=NULL, *XlateObj2=NULL;
ULONG Mode;
FT_Render_Mode RenderMode;
BOOLEAN Render;
@ -1530,7 +1530,9 @@ NtGdiExtTextOut(
BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap);
if ( !BitmapObj )
{
goto fail;
}
SurfObj = &BitmapObj->SurfObj;
ASSERT(SurfObj);
@ -1551,27 +1553,39 @@ NtGdiExtTextOut(
}
XlateObj = (XLATEOBJ*)IntEngCreateXlate(Mode, PAL_RGB, dc->w.hPalette, NULL);
if ( !XlateObj )
{
goto fail;
}
hBrushFg = NtGdiCreateSolidBrush(XLATEOBJ_iXlate(XlateObj, dc->w.textColor));
if ( !hBrushFg )
{
goto fail;
}
BrushFg = BRUSHOBJ_LockBrush(hBrushFg);
if ( !BrushFg )
{
goto fail;
}
IntGdiInitBrushInstance(&BrushFgInst, BrushFg, NULL);
if ((fuOptions & ETO_OPAQUE) || dc->w.backgroundMode == OPAQUE)
{
hBrushBg = NtGdiCreateSolidBrush(XLATEOBJ_iXlate(XlateObj, dc->w.backgroundColor));
if ( !hBrushBg )
{
goto fail;
}
BrushBg = BRUSHOBJ_LockBrush(hBrushBg);
if ( !BrushBg )
{
goto fail;
}
IntGdiInitBrushInstance(&BrushBgInst, BrushBg, NULL);
}
XlateObj2 = (XLATEOBJ*)IntEngCreateXlate(PAL_RGB, Mode, NULL, dc->w.hPalette);
if ( !XlateObj2 )
{
goto fail;
}
SourcePoint.x = 0;
SourcePoint.y = 0;
@ -1637,13 +1651,17 @@ NtGdiExtTextOut(
}
}
if (!found)
{
DPRINT1("WARNING: Could not find desired charmap!\n");
}
IntLockFreeType;
error = FT_Set_Charmap(face, found);
IntUnLockFreeType;
if (error)
{
DPRINT1("WARNING: Could not set the charmap!\n");
}
}
Render = IntIsFontRenderingEnabled();
if (Render)
@ -1764,8 +1782,6 @@ NtGdiExtTextOut(
if (error)
{
EngDeleteXlate(XlateObj);
EngDeleteXlate(XlateObj2);
DPRINT1("WARNING: Failed to load and render glyph! [index: %u]\n", glyph_index);
goto fail;
}
@ -1789,8 +1805,6 @@ NtGdiExtTextOut(
IntUnLockFreeType;
if (error)
{
EngDeleteXlate(XlateObj);
EngDeleteXlate(XlateObj2);
DPRINT1("WARNING: Failed to render glyph!\n");
goto fail;
}
@ -1839,8 +1853,6 @@ NtGdiExtTextOut(
HSourceGlyph = EngCreateBitmap(bitSize, pitch, (glyph->bitmap.pixel_mode == ft_pixel_mode_grays) ? BMF_8BPP : BMF_1BPP, BMF_TOPDOWN, glyph->bitmap.buffer);
if ( !HSourceGlyph )
{
EngDeleteXlate(XlateObj);
EngDeleteXlate(XlateObj2);
DPRINT1("WARNING: EngLockSurface() failed!\n");
goto fail;
}
@ -1848,8 +1860,6 @@ NtGdiExtTextOut(
if ( !SourceGlyphSurf )
{
EngDeleteSurface((HSURF)HSourceGlyph);
EngDeleteXlate(XlateObj);
EngDeleteXlate(XlateObj2);
DPRINT1("WARNING: EngLockSurface() failed!\n");
goto fail;
}