Fixed a handful of bugs last commit introduced (Freed the Frame array at

the wrong time, treated SCREEN_DRAWABLE as a flag instead of an enum)


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@943 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2003-05-03 08:18:49 +00:00
parent 3e17cbdb17
commit 41618ae5de
3 changed files with 16 additions and 13 deletions
-1
View File
@@ -149,7 +149,6 @@ DestroyDrawable (DRAWABLE Drawable)
DrawablePtr = LockDrawable (Drawable); DrawablePtr = LockDrawable (Drawable);
if (DrawablePtr) if (DrawablePtr)
{ {
HFree (DrawablePtr->Frame);
UnlockDrawable (Drawable); UnlockDrawable (Drawable);
FreeDrawable (Drawable); FreeDrawable (Drawable);
@@ -508,18 +508,22 @@ _ReleaseCelData (MEM_HANDLE handle)
cel_ct = INDEX_GET (DrawablePtr->FlagsAndIndex)+1; cel_ct = INDEX_GET (DrawablePtr->FlagsAndIndex)+1;
FramePtr = &DrawablePtr->Frame[cel_ct]; if (DrawablePtr->Frame)
if (!(TYPE_GET ((FramePtr-1)->TypeIndexAndFlags) & SCREEN_DRAWABLE))
{ {
while (--FramePtr, cel_ct--) FramePtr = &DrawablePtr->Frame[cel_ct];
if (TYPE_GET ((FramePtr-1)->TypeIndexAndFlags) != SCREEN_DRAWABLE)
{ {
TFB_Image *img = FramePtr->image; while (--FramePtr, cel_ct--)
if (img)
{ {
FramePtr->image = NULL; TFB_Image *img = FramePtr->image;
TFB_DrawScreen_DeleteImage (img); if (img)
{
FramePtr->image = NULL;
TFB_DrawScreen_DeleteImage (img);
}
} }
} }
HFree (DrawablePtr->Frame);
} }
UnlockDrawable (handle); UnlockDrawable (handle);
+5 -5
View File
@@ -36,7 +36,7 @@ TFB_Prim_Point (PPOINT p, TFB_Palette *color)
r.corner.y = p->y - _CurFramePtr->HotSpot.y; r.corner.y = p->y - _CurFramePtr->HotSpot.y;
r.extent.width = r.extent.height = 1; r.extent.width = r.extent.height = 1;
if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) & SCREEN_DRAWABLE) if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE)
TFB_DrawScreen_Rect (&r, color->r, color->g, color->b, TFB_SCREEN_MAIN); TFB_DrawScreen_Rect (&r, color->r, color->g, color->b, TFB_SCREEN_MAIN);
else else
TFB_DrawImage_Rect (&r, color->r, color->g, color->b, _CurFramePtr->image); TFB_DrawImage_Rect (&r, color->r, color->g, color->b, _CurFramePtr->image);
@@ -86,7 +86,7 @@ TFB_Prim_FillRect (PRECT r, TFB_Palette *color)
rect.extent.height) >> 1; rect.extent.height) >> 1;
} }
if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) & SCREEN_DRAWABLE) if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE)
TFB_DrawScreen_Rect (&rect, color->r, color->g, color->b, TFB_SCREEN_MAIN); TFB_DrawScreen_Rect (&rect, color->r, color->g, color->b, TFB_SCREEN_MAIN);
else else
TFB_DrawImage_Rect (&rect, color->r, color->g, color->b, _CurFramePtr->image); TFB_DrawImage_Rect (&rect, color->r, color->g, color->b, _CurFramePtr->image);
@@ -102,7 +102,7 @@ TFB_Prim_Line (PLINE line, TFB_Palette *color)
x2=line->second.x - _CurFramePtr->HotSpot.x; x2=line->second.x - _CurFramePtr->HotSpot.x;
y2=line->second.y - _CurFramePtr->HotSpot.y; y2=line->second.y - _CurFramePtr->HotSpot.y;
if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) & SCREEN_DRAWABLE) if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE)
TFB_DrawScreen_Line (x1, y1, x2, y2, color->r, color->g, color->b, TFB_SCREEN_MAIN); TFB_DrawScreen_Line (x1, y1, x2, y2, color->r, color->g, color->b, TFB_SCREEN_MAIN);
else else
TFB_DrawImage_Line (x1, y1, x2, y2, color->r, color->g, color->b, _CurFramePtr->image); TFB_DrawImage_Line (x1, y1, x2, y2, color->r, color->g, color->b, _CurFramePtr->image);
@@ -155,7 +155,7 @@ TFB_Prim_Stamp (PSTAMP stmp)
UnlockMutex (img->mutex); UnlockMutex (img->mutex);
if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) & SCREEN_DRAWABLE) if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE)
{ {
TFB_DrawScreen_Image (img, x, y, gscale, (paletted ? palette : NULL), TFB_DrawScreen_Image (img, x, y, gscale, (paletted ? palette : NULL),
TFB_SCREEN_MAIN); TFB_SCREEN_MAIN);
@@ -209,7 +209,7 @@ TFB_Prim_StampFill (PSTAMP stmp, TFB_Palette *color)
UnlockMutex (img->mutex); UnlockMutex (img->mutex);
if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) & SCREEN_DRAWABLE) if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE)
{ {
TFB_DrawScreen_FilledImage (img, x, y, gscale, r, g, b, TFB_DrawScreen_FilledImage (img, x, y, gscale, r, g, b,
TFB_SCREEN_MAIN); TFB_SCREEN_MAIN);