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);
|
LockMutex (GraphicsLock);
|
||||||
OldContext = SetContext (SpaceContext);
|
OldContext = SetContext (SpaceContext);
|
||||||
|
|
||||||
DlgStamp.origin.x = 0;
|
|
||||||
DlgStamp.origin.y = 0;
|
|
||||||
// Save the current state of the screen for later restoration
|
// Save the current state of the screen for later restoration
|
||||||
DlgRect.corner.x = SIS_ORG_X;
|
DlgStamp = SaveContextFrame (NULL);
|
||||||
DlgRect.corner.y = SIS_ORG_Y;
|
GetContextClipRect (&DlgRect);
|
||||||
DlgRect.extent.width = SIS_SCREEN_WIDTH;
|
|
||||||
DlgRect.extent.height = SIS_SCREEN_HEIGHT;
|
|
||||||
DlgStamp.frame = CaptureDrawable (LoadDisplayPixmap (
|
|
||||||
&DlgRect, (FRAME)0));
|
|
||||||
|
|
||||||
pMS->Initialized = FALSE;
|
pMS->Initialized = FALSE;
|
||||||
pMS->InputFunc = DoPickGame;
|
pMS->InputFunc = DoPickGame;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "../controls.h"
|
#include "../controls.h"
|
||||||
#include "../gamestr.h"
|
#include "../gamestr.h"
|
||||||
#include "../setup.h"
|
#include "../setup.h"
|
||||||
|
#include "../util.h"
|
||||||
#include "../sounds.h"
|
#include "../sounds.h"
|
||||||
#include "../uqmdebug.h"
|
#include "../uqmdebug.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
@@ -238,6 +239,7 @@ DoDiscoveryReport (SOUND ReadOutSounds)
|
|||||||
CONTEXT OldContext;
|
CONTEXT OldContext;
|
||||||
CONTEXT context;
|
CONTEXT context;
|
||||||
BOOLEAN ownContext;
|
BOOLEAN ownContext;
|
||||||
|
STAMP saveStamp;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (disableInteractivity)
|
if (disableInteractivity)
|
||||||
@@ -246,6 +248,7 @@ DoDiscoveryReport (SOUND ReadOutSounds)
|
|||||||
|
|
||||||
context = GetScanContext (&ownContext);
|
context = GetScanContext (&ownContext);
|
||||||
OldContext = SetContext (context);
|
OldContext = SetContext (context);
|
||||||
|
saveStamp = SaveContextFrame (NULL);
|
||||||
{
|
{
|
||||||
FONT OldFont;
|
FONT OldFont;
|
||||||
FRAME OldFontEffect;
|
FRAME OldFontEffect;
|
||||||
@@ -265,14 +268,8 @@ DoDiscoveryReport (SOUND ReadOutSounds)
|
|||||||
SetContextFontEffect (OldFontEffect);
|
SetContextFontEffect (OldFontEffect);
|
||||||
SetContextFont (OldFont);
|
SetContextFont (OldFont);
|
||||||
}
|
}
|
||||||
#ifdef OLD
|
// Restore previous screen
|
||||||
ClearDrawable ();
|
DrawStamp (&saveStamp);
|
||||||
if (pSolarSysState->MenuState.Initialized >= 3)
|
|
||||||
DrawScannedObjects (FALSE);
|
|
||||||
#else /* !OLD */
|
|
||||||
if (pSolarSysState->MenuState.Initialized < 3)
|
|
||||||
ClearDrawable ();
|
|
||||||
#endif /* OLD */
|
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
// TODO: Make CONTEXT ref-counted
|
// TODO: Make CONTEXT ref-counted
|
||||||
if (ownContext)
|
if (ownContext)
|
||||||
|
|||||||
@@ -111,6 +111,32 @@ SeedRandomNumbers (void)
|
|||||||
return (cur_time);
|
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
|
BOOLEAN
|
||||||
PauseGame (void)
|
PauseGame (void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,5 +25,8 @@ extern void DrawStarConBox (RECT *pRect, SIZE BorderWidth,
|
|||||||
COLOR InteriorColor);
|
COLOR InteriorColor);
|
||||||
extern DWORD SeedRandomNumbers (void);
|
extern DWORD SeedRandomNumbers (void);
|
||||||
|
|
||||||
|
// saveRect can be NULL to save the entire context frame
|
||||||
|
extern STAMP SaveContextFrame (RECT *saveRect);
|
||||||
|
|
||||||
#endif /* _UTIL_H */
|
#endif /* _UTIL_H */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user