mirror of
https://github.com/reactos/reactos.git
synced 2024-09-21 10:07:17 +00:00
NtGdiExtTextOut(): improved error handling
svn path=/trunk/; revision=12191
This commit is contained in:
parent
e6a6a8e434
commit
f4354d8f89
|
@ -22,7 +22,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: text.c,v 1.120 2004/12/18 17:50:22 royce Exp $ */
|
/* $Id: text.c,v 1.121 2004/12/18 18:21:02 royce Exp $ */
|
||||||
#include <w32k.h>
|
#include <w32k.h>
|
||||||
|
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
|
@ -1529,8 +1529,10 @@ NtGdiExtTextOut(
|
||||||
}
|
}
|
||||||
|
|
||||||
BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap);
|
BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap);
|
||||||
ASSERT(BitmapObj);
|
if ( !BitmapObj )
|
||||||
|
goto fail;
|
||||||
SurfObj = &BitmapObj->SurfObj;
|
SurfObj = &BitmapObj->SurfObj;
|
||||||
|
ASSERT(SurfObj);
|
||||||
|
|
||||||
Start.x = XStart; Start.y = YStart;
|
Start.x = XStart; Start.y = YStart;
|
||||||
IntLPtoDP(dc, &Start, 1);
|
IntLPtoDP(dc, &Start, 1);
|
||||||
|
@ -1548,25 +1550,28 @@ NtGdiExtTextOut(
|
||||||
PALETTE_UnlockPalette(dc->w.hPalette);
|
PALETTE_UnlockPalette(dc->w.hPalette);
|
||||||
}
|
}
|
||||||
XlateObj = (XLATEOBJ*)IntEngCreateXlate(Mode, PAL_RGB, dc->w.hPalette, NULL);
|
XlateObj = (XLATEOBJ*)IntEngCreateXlate(Mode, PAL_RGB, dc->w.hPalette, NULL);
|
||||||
|
if ( !XlateObj )
|
||||||
|
goto fail;
|
||||||
hBrushFg = NtGdiCreateSolidBrush(XLATEOBJ_iXlate(XlateObj, dc->w.textColor));
|
hBrushFg = NtGdiCreateSolidBrush(XLATEOBJ_iXlate(XlateObj, dc->w.textColor));
|
||||||
|
if ( !hBrushFg )
|
||||||
|
goto fail;
|
||||||
BrushFg = BRUSHOBJ_LockBrush(hBrushFg);
|
BrushFg = BRUSHOBJ_LockBrush(hBrushFg);
|
||||||
|
if ( !BrushFg )
|
||||||
|
goto fail;
|
||||||
IntGdiInitBrushInstance(&BrushFgInst, BrushFg, NULL);
|
IntGdiInitBrushInstance(&BrushFgInst, BrushFg, NULL);
|
||||||
if ((fuOptions & ETO_OPAQUE) || dc->w.backgroundMode == OPAQUE)
|
if ((fuOptions & ETO_OPAQUE) || dc->w.backgroundMode == OPAQUE)
|
||||||
{
|
{
|
||||||
hBrushBg = NtGdiCreateSolidBrush(XLATEOBJ_iXlate(XlateObj, dc->w.backgroundColor));
|
hBrushBg = NtGdiCreateSolidBrush(XLATEOBJ_iXlate(XlateObj, dc->w.backgroundColor));
|
||||||
if (hBrushBg)
|
if ( !hBrushBg )
|
||||||
{
|
|
||||||
BrushBg = BRUSHOBJ_LockBrush(hBrushBg);
|
|
||||||
/* FIXME - Handle BrushBg == NULL !!!!! */
|
|
||||||
IntGdiInitBrushInstance(&BrushBgInst, BrushBg, NULL);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
EngDeleteXlate(XlateObj);
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
BrushBg = BRUSHOBJ_LockBrush(hBrushBg);
|
||||||
|
if ( !BrushBg )
|
||||||
|
goto fail;
|
||||||
|
IntGdiInitBrushInstance(&BrushBgInst, BrushBg, NULL);
|
||||||
}
|
}
|
||||||
XlateObj2 = (XLATEOBJ*)IntEngCreateXlate(PAL_RGB, Mode, NULL, dc->w.hPalette);
|
XlateObj2 = (XLATEOBJ*)IntEngCreateXlate(PAL_RGB, Mode, NULL, dc->w.hPalette);
|
||||||
|
if ( !XlateObj2 )
|
||||||
|
goto fail;
|
||||||
|
|
||||||
SourcePoint.x = 0;
|
SourcePoint.x = 0;
|
||||||
SourcePoint.y = 0;
|
SourcePoint.y = 0;
|
||||||
|
@ -1611,7 +1616,9 @@ NtGdiExtTextOut(
|
||||||
}
|
}
|
||||||
|
|
||||||
FontObj = TextObj->Font;
|
FontObj = TextObj->Font;
|
||||||
|
ASSERT(FontObj);
|
||||||
FontGDI = ObjToGDI(FontObj, FONT);
|
FontGDI = ObjToGDI(FontObj, FONT);
|
||||||
|
ASSERT(FontGDI);
|
||||||
|
|
||||||
face = FontGDI->face;
|
face = FontGDI->face;
|
||||||
if (face->charmap == NULL)
|
if (face->charmap == NULL)
|
||||||
|
@ -1901,6 +1908,10 @@ NtGdiExtTextOut(
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
if ( XlateObj2 != NULL )
|
||||||
|
EngDeleteXlate(XlateObj2);
|
||||||
|
if ( XlateObj != NULL )
|
||||||
|
EngDeleteXlate(XlateObj);
|
||||||
if(TextObj != NULL)
|
if(TextObj != NULL)
|
||||||
TEXTOBJ_UnlockText(dc->w.hFont);
|
TEXTOBJ_UnlockText(dc->w.hFont);
|
||||||
BITMAPOBJ_UnlockBitmap(dc->w.hBitmap);
|
BITMAPOBJ_UnlockBitmap(dc->w.hBitmap);
|
||||||
|
|
Loading…
Reference in a new issue