Standardized context frame save/restore; not yet used everywhere it should be
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3345 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1105,15 +1105,9 @@ PickGame (MENU_STATE *pMS)
|
||||
LockMutex (GraphicsLock);
|
||||
OldContext = SetContext (SpaceContext);
|
||||
|
||||
DlgStamp.origin.x = 0;
|
||||
DlgStamp.origin.y = 0;
|
||||
// Save the current state of the screen for later restoration
|
||||
DlgRect.corner.x = SIS_ORG_X;
|
||||
DlgRect.corner.y = SIS_ORG_Y;
|
||||
DlgRect.extent.width = SIS_SCREEN_WIDTH;
|
||||
DlgRect.extent.height = SIS_SCREEN_HEIGHT;
|
||||
DlgStamp.frame = CaptureDrawable (LoadDisplayPixmap (
|
||||
&DlgRect, (FRAME)0));
|
||||
DlgStamp = SaveContextFrame (NULL);
|
||||
GetContextClipRect (&DlgRect);
|
||||
|
||||
pMS->Initialized = FALSE;
|
||||
pMS->InputFunc = DoPickGame;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "../controls.h"
|
||||
#include "../gamestr.h"
|
||||
#include "../setup.h"
|
||||
#include "../util.h"
|
||||
#include "../sounds.h"
|
||||
#include "../uqmdebug.h"
|
||||
#include "options.h"
|
||||
@@ -238,6 +239,7 @@ DoDiscoveryReport (SOUND ReadOutSounds)
|
||||
CONTEXT OldContext;
|
||||
CONTEXT context;
|
||||
BOOLEAN ownContext;
|
||||
STAMP saveStamp;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (disableInteractivity)
|
||||
@@ -246,6 +248,7 @@ DoDiscoveryReport (SOUND ReadOutSounds)
|
||||
|
||||
context = GetScanContext (&ownContext);
|
||||
OldContext = SetContext (context);
|
||||
saveStamp = SaveContextFrame (NULL);
|
||||
{
|
||||
FONT OldFont;
|
||||
FRAME OldFontEffect;
|
||||
@@ -265,14 +268,8 @@ DoDiscoveryReport (SOUND ReadOutSounds)
|
||||
SetContextFontEffect (OldFontEffect);
|
||||
SetContextFont (OldFont);
|
||||
}
|
||||
#ifdef OLD
|
||||
ClearDrawable ();
|
||||
if (pSolarSysState->MenuState.Initialized >= 3)
|
||||
DrawScannedObjects (FALSE);
|
||||
#else /* !OLD */
|
||||
if (pSolarSysState->MenuState.Initialized < 3)
|
||||
ClearDrawable ();
|
||||
#endif /* OLD */
|
||||
// Restore previous screen
|
||||
DrawStamp (&saveStamp);
|
||||
SetContext (OldContext);
|
||||
// TODO: Make CONTEXT ref-counted
|
||||
if (ownContext)
|
||||
|
||||
@@ -111,6 +111,32 @@ SeedRandomNumbers (void)
|
||||
return (cur_time);
|
||||
}
|
||||
|
||||
STAMP
|
||||
SaveContextFrame (RECT *saveRect)
|
||||
{
|
||||
STAMP s;
|
||||
RECT r;
|
||||
|
||||
GetContextClipRect (&r);
|
||||
if (saveRect)
|
||||
{ // a portion of the context
|
||||
r.corner.x += saveRect->corner.x;
|
||||
r.corner.y += saveRect->corner.y;
|
||||
r.extent = saveRect->extent;
|
||||
|
||||
s.origin = saveRect->corner;
|
||||
}
|
||||
else
|
||||
{ // the entire context
|
||||
s.origin.x = 0;
|
||||
s.origin.y = 0;
|
||||
}
|
||||
|
||||
s.frame = CaptureDrawable (LoadDisplayPixmap (&r, NULL));
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
PauseGame (void)
|
||||
{
|
||||
|
||||
@@ -25,5 +25,8 @@ extern void DrawStarConBox (RECT *pRect, SIZE BorderWidth,
|
||||
COLOR InteriorColor);
|
||||
extern DWORD SeedRandomNumbers (void);
|
||||
|
||||
// saveRect can be NULL to save the entire context frame
|
||||
extern STAMP SaveContextFrame (RECT *saveRect);
|
||||
|
||||
#endif /* _UTIL_H */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user