Centralized NULL checking for Stamp drawing.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@849 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -155,20 +155,9 @@ DrawBatch (PPRIMITIVE lpBasePrim, PRIM_LINKS PrimLinks, register
|
||||
TFB_Prim_Point (&lpWorkPrim->Object.Point, &color);
|
||||
break;
|
||||
case STAMP_PRIM:
|
||||
SrcFramePtr = (FRAMEPTR)(lpWorkPrim->Object.Stamp.frame);
|
||||
if (SrcFramePtr == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
TFB_Prim_Stamp (&lpWorkPrim->Object.Stamp);
|
||||
break;
|
||||
case STAMPFILL_PRIM:
|
||||
SrcFramePtr = (FRAMEPTR)(lpWorkPrim->Object.Stamp.frame);
|
||||
if (SrcFramePtr == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
c32k = GetPrimColor (lpWorkPrim) >> 8; //shift out color index
|
||||
color.r = (c32k >> (10 - (8 - 5))) & 0xF8;
|
||||
color.g = (c32k >> (5 - (8 - 5))) & 0xF8;
|
||||
|
||||
@@ -121,6 +121,11 @@ TFB_Prim_Stamp (PSTAMP stmp)
|
||||
int gscale;
|
||||
|
||||
SrcFramePtr = (PFRAME_DESC)stmp->frame;
|
||||
if (!SrcFramePtr)
|
||||
{
|
||||
fprintf (stderr, "TFB_Prim_Stamp: Tried to draw a NULL frame (Stamp address = %p)\n", stmp);
|
||||
return;
|
||||
}
|
||||
img = SrcFramePtr->image;
|
||||
gscale = GetGraphicScale ();
|
||||
|
||||
@@ -175,6 +180,11 @@ TFB_Prim_StampFill (PSTAMP stmp, TFB_Palette *color)
|
||||
int gscale;
|
||||
|
||||
SrcFramePtr = (PFRAME_DESC)stmp->frame;
|
||||
if (!SrcFramePtr)
|
||||
{
|
||||
fprintf (stderr, "TFB_Prim_StampFill: Tried to draw a NULL frame (Stamp address = %p)\n", stmp);
|
||||
return;
|
||||
}
|
||||
img = SrcFramePtr->image;
|
||||
gscale = GetGraphicScale ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user