rem: incr = 1;
add: if (fstrength != NORMAL_F_STRENGTH) { STAMP s;  ClearDrawable ();  SetGraphicStrength (fstrength > 0 ? fstrength : -fstrength, 16);  s.origin.x = s.origin.y = 0; s.frame = flash_frame; DrawStamp (&s);  if (fstrength < 0) SetGraphicStrength (-8, 8); else SetGraphicStrength (8, -8); }  DrawFromExtraScreen (&flash_rect);
context: int flash_rect_func(void *data){#define NORMAL_STRENGTH 4#define NORMAL_F_STRENGTH 0#define MIN_F_STRENGTH -3#define MAX_F_STRENGTH 3#define MIN_STRENGTH 4#define MAX_STRENGTH 6	DWORD TimeIn, WaitTime;	SIZE strength, fstrength, incr;	Task task = (Task)data;	FRAME FlashFrame= NULL;	FRAME cur_frame = NULL;	FRAME BackupExtraFrame = NULL;	CONTEXT OldContext;	RECT old_rect;	int pos, max_pos;	TimeIn = GetTimeCounter ();	WaitTime = ONE_SECOND / 16;	while (!Task_ReadState(task, TASK_EXIT))	{		SetSemaphore (GraphicsSem);		if (flash_changed)		{			// FlushGraphics is called because it is necessary that the DCQ empties			// and thus initializes flash_extra_frame before generating the individual			// flash frames			ClearSemaphore (GraphicsSem);			FlushGraphics ();			SetSemaphore (GraphicsSem);			flash_changed = 0;			if (FlashFrame)				DestroyDrawable (ReleaseDrawable (FlashFrame));			FlashFrame = 0;			BackupExtraFrame = flash_extra_frame;			old_rect = flash_rect;			if (flash_rect.extent.width && flash_extra_frame)			{				// There is something to flash				int i;				if (flash_frame)				{					// Flash an image.  This is used for the startup screen					FlashFrame =  CaptureDrawable (						CreateDrawable (WANT_PIXMAP, flash_rect.extent.width, 							flash_rect.extent.height, 							(COUNT)(1 + MAX_F_STRENGTH - MIN_F_STRENGTH))						);					for (i = 1, fstrength = MIN_F_STRENGTH; 						fstrength <= MAX_F_STRENGTH; i++, fstrength++)					{						cur_frame = SetAbsFrameIndex (FlashFrame, (COUNT)i);						if (fstrength == NORMAL_F_STRENGTH)						{							arith_frame_blit (flash_extra_frame, NULL, 								cur_frame, NULL, 0, 0); 							pos = i;						}						else						{							arith_frame_blit (flash_frame, NULL, cur_frame, NULL, 								(fstrength  > 0) ? fstrength : -fstrength, 16);							if (fstrength < 0)								// add to -(partial mask)								arith_frame_blit (flash_extra_frame, NULL, cur_frame, NULL, -8, 8);							else								// add to (partial mask)								arith_frame_blit (flash_extra_frame, NULL, cur_frame, NULL, 8, -8);						}					}					max_pos = i;				}				else				{					// Flash a rectangle					FlashFrame =  CaptureDrawable (						CreateDrawable (WANT_PIXMAP, flash_rect.extent.width, 							flash_rect.extent.height, (COUNT)(1 + ((MAX_STRENGTH - MIN_STRENGTH) >> 1)))						);					for (i = 1, strength = MIN_STRENGTH; strength <= MAX_STRENGTH; i++, strength += 2)					{						cur_frame = SetAbsFrameIndex (FlashFrame, (COUNT)i);						arith_frame_blit (flash_extra_frame, NULL, cur_frame, NULL, strength, 4);					}					pos = 1;					max_pos = i;				}				incr = 1;			}			TimeIn = GetTimeCounter ();			WaitTime = ONE_SECOND / 16;		}		if (flash_rect.extent.width && FlashFrame)		{			STAMP s;			if ((pos += incr) == max_pos)			{				pos--;				incr = -1;			}			if (pos == 0)			{				pos =1;				incr =1;			}			OldContext = SetContext (ScreenContext);			SetContextClipRect (&flash_rect);			s.origin.x = s.origin.y = 0;			s.frame = SetAbsFrameIndex (FlashFrame, (COUNT)pos);			DrawStamp (&s);			SetContextClipRect (NULL_PTR); // this will flush whatever			SetContext (OldContext);			ClearSemaphore (GraphicsSem);			FlushGraphics ();		}		else			ClearSemaphore (GraphicsSem);		SleepThreadUntil (TimeIn + WaitTime);		TimeIn = GetTimeCounter ();	}	if (FlashFrame)		DestroyDrawable (ReleaseDrawable (FlashFrame));	SetSemaphore (GraphicsSem);	// how is it possible for extent to have '0' values?	// it is bad to call DrawStamp in that case though	if (BackupExtraFrame && BackupExtraFrame == flash_extra_frame &&		old_rect.extent.width && old_rect.extent.height)	{		STAMP s;		OldContext = SetContext (ScreenContext);		SetContextClipRect (&old_rect);		s.origin.x = s.origin.y = 0;		s.frame = flash_extra_frame;		DrawStamp (&s);		SetContextClipRect (NULL_PTR); // this will flush whatever		SetContext (OldContext);		DestroyDrawable (ReleaseDrawable (flash_extra_frame));		flash_extra_frame = 0;	}	ClearSemaphore (GraphicsSem);	flash_task = 0;	FinishTask (task);	return(0);}