Handle NULL values in IntRoundRect and NtGdiEllipse

svn path=/trunk/; revision=13690
This commit is contained in:
Hervé Poussineau 2005-02-20 17:35:50 +00:00
parent 9eb2145d0e
commit 5f5e7e77d2

View file

@ -260,8 +260,14 @@ NtGdiEllipse(
}
BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap);
/* FIXME - BitmapObj can be NULL!!!! Don't assert but handle this case gracefully! */
ASSERT(BitmapObj);
if (NULL = BitmapObj)
{
BRUSHOBJ_UnlockBrush(dc->w.hBrush);
BITMAPOBJ_UnlockBitmap(dc->w.hBitmap);
DC_UnlockDc(hDC);
SetLastWin32Error(ERROR_INTERNAL_ERROR);
return FALSE;
}
IntGdiInitBrushInstance(&FillBrushInst, FillBrush, dc->XlateBrush);
IntGdiInitBrushInstance(&PenBrushInst, PenBrush, dc->XlatePen);
@ -1113,30 +1119,44 @@ IntRoundRect(
RectBounds.bottom = bottom;
BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap);
/* FIXME - BitmapObj can be NULL!!!! Handle this case gracefully instead of ASSERT! */
ASSERT(BitmapObj);
if (!BitmapObj)
{
/* Nothing to do, as we don't have a bitmap */
BITMAPOBJ_UnlockBitmap(dc->w.hBitmap);
SetLastWin32Error(ERROR_INTERNAL_ERROR);
return FALSE;
}
FillBrushObj = BRUSHOBJ_LockBrush(dc->w.hBrush);
/* FIXME - Don't assert if FillBrushObj == NULL, handle this case !!!! */
ASSERT(FillBrushObj);
if (FillBrushObj->flAttrs & GDIBRUSH_IS_NULL)
if (FillBrushObj)
{
BRUSHOBJ_UnlockBrush(dc->w.hBrush);
FillBrushObj = NULL; // make null brush check simpler...
if (FillBrushObj->flAttrs & GDIBRUSH_IS_NULL)
{
/* make null brush check simpler... */
BRUSHOBJ_UnlockBrush(dc->w.hBrush);
FillBrushObj = NULL;
}
else
{
IntGdiInitBrushInstance(&FillBrushInst, FillBrushObj, dc->XlateBrush);
}
}
PenBrushObj = PENOBJ_LockPen(dc->w.hPen);
/* FIXME - PenBrushObject can be NULL!!! Don't assert!!!! */
ASSERT(PenBrushObj);
if (PenBrushObj->flAttrs & GDIBRUSH_IS_NULL)
if (PenBrushObj)
{
PENOBJ_UnlockPen(dc->w.hPen);
PenBrushObj = NULL;
if (PenBrushObj->flAttrs & GDIBRUSH_IS_NULL)
{
/* make null pen check simpler... */
PENOBJ_UnlockPen(dc->w.hPen);
PenBrushObj = NULL;
}
else
{
IntGdiInitBrushInstance(&PenBrushInst, PenBrushObj, dc->XlatePen);
}
}
IntGdiInitBrushInstance(&FillBrushInst, FillBrushObj, dc->XlateBrush);
IntGdiInitBrushInstance(&PenBrushInst, PenBrushObj, dc->XlatePen);
right--;
bottom--;
@ -1317,7 +1337,8 @@ IntRoundRect(
BITMAPOBJ_UnlockBitmap(dc->w.hBitmap);
if(PenBrushObj != NULL)
PENOBJ_UnlockPen(dc->w.hPen);
BRUSHOBJ_UnlockBrush(dc->w.hBrush);
if(FillBrushObj != NULL)
BRUSHOBJ_UnlockBrush(dc->w.hBrush);
return ret;
}