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); BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap);
/* FIXME - BitmapObj can be NULL!!!! Don't assert but handle this case gracefully! */ if (NULL = BitmapObj)
ASSERT(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(&FillBrushInst, FillBrush, dc->XlateBrush);
IntGdiInitBrushInstance(&PenBrushInst, PenBrush, dc->XlatePen); IntGdiInitBrushInstance(&PenBrushInst, PenBrush, dc->XlatePen);
@ -1113,30 +1119,44 @@ IntRoundRect(
RectBounds.bottom = bottom; RectBounds.bottom = bottom;
BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap); BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap);
/* FIXME - BitmapObj can be NULL!!!! Handle this case gracefully instead of ASSERT! */ if (!BitmapObj)
ASSERT(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); FillBrushObj = BRUSHOBJ_LockBrush(dc->w.hBrush);
/* FIXME - Don't assert if FillBrushObj == NULL, handle this case !!!! */ if (FillBrushObj)
ASSERT(FillBrushObj);
if (FillBrushObj->flAttrs & GDIBRUSH_IS_NULL)
{ {
BRUSHOBJ_UnlockBrush(dc->w.hBrush); if (FillBrushObj->flAttrs & GDIBRUSH_IS_NULL)
FillBrushObj = NULL; // make null brush check simpler... {
/* make null brush check simpler... */
BRUSHOBJ_UnlockBrush(dc->w.hBrush);
FillBrushObj = NULL;
}
else
{
IntGdiInitBrushInstance(&FillBrushInst, FillBrushObj, dc->XlateBrush);
}
} }
PenBrushObj = PENOBJ_LockPen(dc->w.hPen); PenBrushObj = PENOBJ_LockPen(dc->w.hPen);
/* FIXME - PenBrushObject can be NULL!!! Don't assert!!!! */ if (PenBrushObj)
ASSERT(PenBrushObj);
if (PenBrushObj->flAttrs & GDIBRUSH_IS_NULL)
{ {
PENOBJ_UnlockPen(dc->w.hPen); if (PenBrushObj->flAttrs & GDIBRUSH_IS_NULL)
PenBrushObj = 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--; right--;
bottom--; bottom--;
@ -1317,7 +1337,8 @@ IntRoundRect(
BITMAPOBJ_UnlockBitmap(dc->w.hBitmap); BITMAPOBJ_UnlockBitmap(dc->w.hBitmap);
if(PenBrushObj != NULL) if(PenBrushObj != NULL)
PENOBJ_UnlockPen(dc->w.hPen); PENOBJ_UnlockPen(dc->w.hPen);
BRUSHOBJ_UnlockBrush(dc->w.hBrush); if(FillBrushObj != NULL)
BRUSHOBJ_UnlockBrush(dc->w.hBrush);
return ret; return ret;
} }