Fix problem where pressing 'down' when selecting SIS ship, caused flash

rect to gradually turn white (closes bug #130).  Fixed a potential
crash in the flash code when going from main-menu to load-screen


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@691 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
ghaushe
2003-02-06 04:27:14 +00:00
parent 406a322a5d
commit f6bb075813
2 changed files with 11 additions and 8 deletions
+1
View File
@@ -203,6 +203,7 @@ ChangeSelection:
font_DrawText (&t); font_DrawText (&t);
} }
SetFlashRect ((RECT *)0, (FRAME)0);
SetFlashRect (&pMS->flash_rect0, (FRAME)0); SetFlashRect (&pMS->flash_rect0, (FRAME)0);
ClearSemaphore (GraphicsSem); ClearSemaphore (GraphicsSem);
} }
+10 -8
View File
@@ -1335,7 +1335,7 @@ int flash_rect_func(void *data)
void void
SetFlashRect (PRECT pRect, FRAME f) SetFlashRect (PRECT pRect, FRAME f)
{ {
RECT clip_r, temp_r, old_r; RECT clip_r, temp_r, flash_rect1, old_r;
CONTEXT OldContext; CONTEXT OldContext;
FRAME old_f; FRAME old_f;
int create_flash = 0; int create_flash = 0;
@@ -1345,6 +1345,7 @@ SetFlashRect (PRECT pRect, FRAME f)
old_r = flash_rect; old_r = flash_rect;
old_f = flash_frame; old_f = flash_frame;
flash_rect1 = flash_rect;
if (pRect != (PRECT)~0L) if (pRect != (PRECT)~0L)
{ {
@@ -1374,7 +1375,7 @@ SetFlashRect (PRECT pRect, FRAME f)
if (pRect == 0 || pRect->extent.width == 0) if (pRect == 0 || pRect->extent.width == 0)
{ {
flash_rect.extent.width = 0; flash_rect1.extent.width = 0;
if (flash_task) if (flash_task)
{ {
ClearSemaphore (GraphicsSem); ClearSemaphore (GraphicsSem);
@@ -1384,16 +1385,18 @@ SetFlashRect (PRECT pRect, FRAME f)
} }
else else
{ {
flash_rect = *pRect; flash_rect1 = *pRect;
flash_rect.corner.x += clip_r.corner.x; flash_rect1.corner.x += clip_r.corner.x;
flash_rect.corner.y += clip_r.corner.y; flash_rect1.corner.y += clip_r.corner.y;
flash_rect.extent.height += flash_rect.corner.y & 1; flash_rect1.extent.height += flash_rect.corner.y & 1;
flash_rect.corner.y &= ~1; flash_rect1.corner.y &= ~1;
create_flash = 1; create_flash = 1;
} }
LockMutex (flash_mutex);
flash_frame = f; flash_frame = f;
flash_rect = flash_rect1;
if (old_r.extent.width if (old_r.extent.width
&& (old_r.extent.width != flash_rect.extent.width && (old_r.extent.width != flash_rect.extent.width
@@ -1422,7 +1425,6 @@ SetFlashRect (PRECT pRect, FRAME f)
DestroyDrawable (ReleaseDrawable (flash_screen_frame)); DestroyDrawable (ReleaseDrawable (flash_screen_frame));
flash_screen_frame = CaptureDrawable (LoadDisplayPixmap (&flash_rect, (FRAME)0)); flash_screen_frame = CaptureDrawable (LoadDisplayPixmap (&flash_rect, (FRAME)0));
} }
LockMutex (flash_mutex);
flash_changed = 1; flash_changed = 1;
UnlockMutex (flash_mutex); UnlockMutex (flash_mutex);
// we create the thread after the LoadIntoExtraScreen // we create the thread after the LoadIntoExtraScreen