optimize: reduce theme calls
This commit is contained in:
@@ -954,6 +954,24 @@ bool PrintRecentScores( RageFile &f, const Profile *pProfile, CString sTitle, ve
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (experimental) Short-term internal cache timer. */
|
||||||
|
struct CacheTimer
|
||||||
|
{
|
||||||
|
float fExpiration, fDuration;
|
||||||
|
CacheTimer( float duration = 1 ) { fExpiration = -999; fDuration = duration; }
|
||||||
|
|
||||||
|
/* Return true if the timer has expired (fDuration has elapsed since the last
|
||||||
|
* true IsExpired call) or if this is the first call. */
|
||||||
|
bool IsExpired()
|
||||||
|
{
|
||||||
|
float fNow = RageTimer::GetTimeSinceStart();
|
||||||
|
if( fNow < fExpiration )
|
||||||
|
return false;
|
||||||
|
fExpiration = fNow + fDuration;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
bool PrintCatalogForSong( RageFile &f, const Profile *pProfile, Song* pSong )
|
bool PrintCatalogForSong( RageFile &f, const Profile *pProfile, Song* pSong )
|
||||||
{
|
{
|
||||||
if( pSong->NeverDisplayed() || UNLOCKMAN->SongIsLocked(pSong) )
|
if( pSong->NeverDisplayed() || UNLOCKMAN->SongIsLocked(pSong) )
|
||||||
@@ -961,13 +979,18 @@ bool PrintCatalogForSong( RageFile &f, const Profile *pProfile, Song* pSong )
|
|||||||
|
|
||||||
vector<Steps*> vpSteps = pSong->GetAllSteps();
|
vector<Steps*> vpSteps = pSong->GetAllSteps();
|
||||||
|
|
||||||
bool bShowRadarCategory[NUM_RADAR_CATEGORIES];
|
static bool bShowRadarCategory[NUM_RADAR_CATEGORIES];
|
||||||
CString sThemedRadarCategory[NUM_RADAR_CATEGORIES];
|
static CString sThemedRadarCategory[NUM_RADAR_CATEGORIES];
|
||||||
|
|
||||||
|
static CacheTimer timer;
|
||||||
|
if( timer.IsExpired() )
|
||||||
|
{
|
||||||
FOREACH_RadarCategory(rc)
|
FOREACH_RadarCategory(rc)
|
||||||
{
|
{
|
||||||
bShowRadarCategory[rc] = SHOW_RADAR_CATEGORY(rc);
|
bShowRadarCategory[rc] = SHOW_RADAR_CATEGORY(rc);
|
||||||
sThemedRadarCategory[rc] = RadarCategoryToThemedString(rc);
|
sThemedRadarCategory[rc] = RadarCategoryToThemedString(rc);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PRINT_OPEN(f, pSong->GetFullDisplayTitle() );
|
PRINT_OPEN(f, pSong->GetFullDisplayTitle() );
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user