minor optimization for main-menu flash. No longer draw to the entire screen
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@571 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -319,6 +319,7 @@ extern void DrawBatch (PPRIMITIVE pBasePrim, PRIM_LINKS PrimLinks,
|
|||||||
extern void BatchGraphics (void);
|
extern void BatchGraphics (void);
|
||||||
extern void UnbatchGraphics (void);
|
extern void UnbatchGraphics (void);
|
||||||
extern void FlushGraphics (void);
|
extern void FlushGraphics (void);
|
||||||
|
extern void ClearBackGround (PRECT pClipRect);
|
||||||
extern void ClearDrawable (void);
|
extern void ClearDrawable (void);
|
||||||
extern CONTEXT_REF CreateContext (void);
|
extern CONTEXT_REF CreateContext (void);
|
||||||
extern BOOLEAN DestroyContext (CONTEXT_REF ContextRef);
|
extern BOOLEAN DestroyContext (CONTEXT_REF ContextRef);
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ GetFrameValidRect (PRECT pValidRect, HOT_SPOT *pOldHot)
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
ClearBackGround (PRECT pClipRect)
|
ClearBackGround (PRECT pClipRect)
|
||||||
{
|
{
|
||||||
if (_get_context_bg_func ())
|
if (_get_context_bg_func ())
|
||||||
|
|||||||
+17
-15
@@ -1133,8 +1133,8 @@ int flash_rect_func(void *data)
|
|||||||
#define CACHE_SIZE 10
|
#define CACHE_SIZE 10
|
||||||
DWORD TimeIn, WaitTime;
|
DWORD TimeIn, WaitTime;
|
||||||
SIZE strength, fstrength, incr;
|
SIZE strength, fstrength, incr;
|
||||||
RECT new_rect;
|
RECT cached_rect, framesize_rect;
|
||||||
FRAME new_frame;
|
FRAME cached_frame;
|
||||||
Task task = (Task)data;
|
Task task = (Task)data;
|
||||||
int cached[CACHE_SIZE];
|
int cached[CACHE_SIZE];
|
||||||
STAMP cached_stamp[CACHE_SIZE];
|
STAMP cached_stamp[CACHE_SIZE];
|
||||||
@@ -1157,12 +1157,14 @@ int flash_rect_func(void *data)
|
|||||||
LockMutex (flash_mutex);
|
LockMutex (flash_mutex);
|
||||||
if (flash_changed)
|
if (flash_changed)
|
||||||
{
|
{
|
||||||
new_rect = flash_rect;
|
cached_rect = flash_rect;
|
||||||
new_frame = flash_frame;
|
cached_frame = flash_frame;
|
||||||
flash_changed = 0;
|
flash_changed = 0;
|
||||||
UnlockMutex (flash_mutex);
|
UnlockMutex (flash_mutex);
|
||||||
// Wait for the ExtraScreen to get initialized
|
// Wait for the ExtraScreen to get initialized
|
||||||
FlushGraphics ();
|
FlushGraphics ();
|
||||||
|
if (cached_frame)
|
||||||
|
GetFrameRect (cached_frame, &framesize_rect);
|
||||||
for (i = 0; i < CACHE_SIZE; i++)
|
for (i = 0; i < CACHE_SIZE; i++)
|
||||||
{
|
{
|
||||||
cached[i] = 0;
|
cached[i] = 0;
|
||||||
@@ -1176,11 +1178,11 @@ int flash_rect_func(void *data)
|
|||||||
SetSemaphore (GraphicsSem);
|
SetSemaphore (GraphicsSem);
|
||||||
OldContext = SetContext (ScreenContext);
|
OldContext = SetContext (ScreenContext);
|
||||||
|
|
||||||
if (new_rect.extent.width)
|
if (cached_rect.extent.width)
|
||||||
{
|
{
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
SetContextClipRect (&new_rect);
|
SetContextClipRect (&cached_rect);
|
||||||
if (new_frame)
|
if (cached_frame)
|
||||||
{
|
{
|
||||||
#define MIN_F_STRENGTH -3
|
#define MIN_F_STRENGTH -3
|
||||||
#define MAX_F_STRENGTH 3
|
#define MAX_F_STRENGTH 3
|
||||||
@@ -1202,12 +1204,12 @@ int flash_rect_func(void *data)
|
|||||||
{
|
{
|
||||||
STAMP s;
|
STAMP s;
|
||||||
|
|
||||||
ClearDrawable ();
|
ClearBackGround (&framesize_rect);
|
||||||
|
|
||||||
SetGraphicStrength (fstrength > 0 ? fstrength : -fstrength, 16);
|
SetGraphicStrength (fstrength > 0 ? fstrength : -fstrength, 16);
|
||||||
|
|
||||||
s.origin.x = s.origin.y = 0;
|
s.origin.x = s.origin.y = 0;
|
||||||
s.frame = new_frame;
|
s.frame = cached_frame;
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
|
|
||||||
if (fstrength < 0)
|
if (fstrength < 0)
|
||||||
@@ -1216,15 +1218,15 @@ int flash_rect_func(void *data)
|
|||||||
SetGraphicStrength (8, -8); // add to (partial mask)
|
SetGraphicStrength (8, -8); // add to (partial mask)
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawFromExtraScreen (&new_rect);
|
DrawFromExtraScreen (&framesize_rect);
|
||||||
SetGraphicStrength (4, 4);
|
SetGraphicStrength (4, 4);
|
||||||
{
|
{
|
||||||
STAMP *pStamp;
|
STAMP *pStamp;
|
||||||
pStamp = &cached_stamp[fstrength - MIN_F_STRENGTH];
|
pStamp = &cached_stamp[fstrength - MIN_F_STRENGTH];
|
||||||
cached[fstrength - MIN_F_STRENGTH] = 1;
|
cached[fstrength - MIN_F_STRENGTH] = 1;
|
||||||
pStamp->origin.x = 0;
|
pStamp->origin.x = framesize_rect.corner.x;
|
||||||
pStamp->origin.y = 0;
|
pStamp->origin.y = framesize_rect.corner.y;
|
||||||
pStamp->frame = CaptureDrawable (LoadDisplayPixmap (&new_rect, (FRAME)0));
|
pStamp->frame = CaptureDrawable (LoadDisplayPixmap (&framesize_rect, (FRAME)0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1239,7 +1241,7 @@ int flash_rect_func(void *data)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetGraphicStrength (strength, 4);
|
SetGraphicStrength (strength, 4);
|
||||||
DrawFromExtraScreen (&new_rect);
|
DrawFromExtraScreen (&cached_rect);
|
||||||
SetGraphicStrength (4, 4);
|
SetGraphicStrength (4, 4);
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -1248,7 +1250,7 @@ int flash_rect_func(void *data)
|
|||||||
cached[strength - MIN_STRENGTH] = 1;
|
cached[strength - MIN_STRENGTH] = 1;
|
||||||
pStamp->origin.x = 0;
|
pStamp->origin.x = 0;
|
||||||
pStamp->origin.y = 0;
|
pStamp->origin.y = 0;
|
||||||
pStamp->frame = CaptureDrawable (LoadDisplayPixmap (&new_rect, (FRAME)0));
|
pStamp->frame = CaptureDrawable (LoadDisplayPixmap (&cached_rect, (FRAME)0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user