update
This commit is contained in:
@@ -728,7 +728,6 @@ void Font::Load( const RString &sIniPath, RString sChars )
|
||||
Font subfont;
|
||||
subfont.Load(fPath,"");
|
||||
MergeFont(subfont);
|
||||
//FONT->UnloadFont(subfont);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+14
-8
@@ -22,7 +22,7 @@ FontManager::~FontManager()
|
||||
{
|
||||
const FontName &fn = i->first;
|
||||
Font* pFont = i->second;
|
||||
if(pFont->m_iRefCount>0) {
|
||||
if(pFont->m_iRefCount > 0) {
|
||||
LOG->Trace( "FONT LEAK: '%s', RefCount = %d.", fn.first.c_str(), pFont->m_iRefCount );
|
||||
}
|
||||
delete pFont;
|
||||
@@ -53,14 +53,13 @@ Font* FontManager::LoadFont( const RString &sFontOrTextureFilePath, RString sCha
|
||||
{
|
||||
pFont=p->second;
|
||||
pFont->m_iRefCount++;
|
||||
}
|
||||
else {
|
||||
pFont= new Font;
|
||||
pFont->Load(sFontOrTextureFilePath, sChars);
|
||||
g_mapPathToFont[NewName] = pFont;
|
||||
return pFont;
|
||||
}
|
||||
|
||||
return pFont;
|
||||
Font *f = new Font;
|
||||
f->Load(sFontOrTextureFilePath, sChars);
|
||||
g_mapPathToFont[NewName] = f;
|
||||
return f;
|
||||
}
|
||||
|
||||
Font *FontManager::CopyFont( Font *pFont )
|
||||
@@ -79,16 +78,22 @@ void FontManager::UnloadFont( Font *fp )
|
||||
if(i->second != fp)
|
||||
continue;
|
||||
|
||||
ASSERT_M(fp->m_iRefCount>0,"Attempting to unload a font with zero ref count!");
|
||||
ASSERT_M(fp->m_iRefCount > 0,"Attempting to unload a font with zero ref count!");
|
||||
|
||||
i->second->m_iRefCount--;
|
||||
|
||||
if( fp->m_iRefCount == 0 )
|
||||
{
|
||||
delete i->second; // free the texture
|
||||
g_mapPathToFont.erase( i ); // and remove the key in the map
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
FAIL_M( ssprintf("Unloaded an unknown font (%p)", fp) );
|
||||
}
|
||||
|
||||
/*
|
||||
void FontManager::PruneFonts() {
|
||||
for( std::map<FontName, Font*>::iterator i = g_mapPathToFont.begin();i != g_mapPathToFont.end();) {
|
||||
Font *fp=i->second;
|
||||
@@ -101,6 +106,7 @@ void FontManager::PruneFonts() {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
* (c) 2001-2003 Chris Danford, Glenn Maynard
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ public:
|
||||
Font* LoadFont( const RString &sFontOrTextureFilePath, RString sChars = "" );
|
||||
Font *CopyFont( Font *pFont );
|
||||
void UnloadFont( Font *fp );
|
||||
void PruneFonts();
|
||||
//void PruneFonts();
|
||||
|
||||
/* Warning: This reloads fonts completely, so all BitmapTexts need to be
|
||||
* reset, too. If this isn't done, best case they end up with old font
|
||||
|
||||
@@ -786,7 +786,7 @@ static void ReadGlobalTags( const NameToData_t &mapNameToData, Song &out, Measur
|
||||
LOG->UserLog( "Song file", out.GetSongDir(), "references key \"%s\" that can't be found", nData.c_str() );
|
||||
|
||||
sWavID.MakeUpper(); // HACK: undo the MakeLower()
|
||||
out.m_vsKeysoundFile.push_back( sData );
|
||||
out.m_vsKeysoundFile.push_back( nData );
|
||||
idToKeySoundIndexOut[ sWavID ] = out.m_vsKeysoundFile.size()-1;
|
||||
LOG->Trace( "Inserting keysound index %u '%s'", unsigned(out.m_vsKeysoundFile.size()-1), sWavID.c_str() );
|
||||
}
|
||||
|
||||
@@ -155,9 +155,6 @@ RString DeviceButtonToString( DeviceButton key )
|
||||
if( key >= MIDI_FIRST && key <= MIDI_LAST )
|
||||
return ssprintf( "Midi %d", key-MIDI_FIRST );
|
||||
|
||||
if( key >= MOUSE_LEFT && key <= MOUSE_WHEELDOWN )
|
||||
return ssprintf( "Mouse %d", key-MOUSE_LEFT );
|
||||
|
||||
map<DeviceButton,RString>::const_iterator it = g_mapNamesToString.find( key );
|
||||
if( it != g_mapNamesToString.end() )
|
||||
return it->second;
|
||||
|
||||
@@ -321,7 +321,7 @@ public:
|
||||
/* Whether this button is pressed. This is level with a threshold and
|
||||
* debouncing applied. */
|
||||
bool bDown;
|
||||
|
||||
|
||||
RageTimer ts;
|
||||
|
||||
DeviceInput(): device(InputDevice_Invalid), button(DeviceButton_Invalid), level(0), x(0), y(0), bDown(false), ts(RageZeroTimer) { }
|
||||
|
||||
+21
-14
@@ -76,7 +76,7 @@
|
||||
ScreenManager* SCREENMAN = NULL; // global and accessable from anywhere in our program
|
||||
|
||||
static Preference<bool> g_bDelayedScreenLoad( "DelayedScreenLoad", false );
|
||||
static Preference<bool> g_bPruneFonts( "PruneFonts", true );
|
||||
//static Preference<bool> g_bPruneFonts( "PruneFonts", true );
|
||||
|
||||
// Screen registration
|
||||
static map<RString,CreateScreenFn> *g_pmapRegistrees = NULL;
|
||||
@@ -592,9 +592,11 @@ void ScreenManager::PrepareScreen( const RString &sScreenName )
|
||||
}
|
||||
|
||||
// Prune any unused fonts now that we have had a chance to reference the fonts
|
||||
/*
|
||||
if(g_bPruneFonts) {
|
||||
FONT->PruneFonts();
|
||||
}
|
||||
*/
|
||||
|
||||
TEXTUREMAN->DiagnosticOutput();
|
||||
}
|
||||
@@ -690,17 +692,19 @@ void ScreenManager::LoadDelayedScreen()
|
||||
* cleanup, so it doesn't get deleted by cleanup. */
|
||||
bool bLoaded = ActivatePreparedScreenAndBackground( sScreenName );
|
||||
|
||||
bool deletePrepared=g_setGroupedScreens.find(sScreenName) == g_setGroupedScreens.end();
|
||||
|
||||
/* It's time to delete all old prepared screens. Depending on DelayedScreenLoad,
|
||||
* we can either delete the screens before or after we load the new screen.
|
||||
* Either way, we must remove them from the prepared list before we prepare
|
||||
* new screens.
|
||||
* If DelayedScreenLoad is true, delete them now; this lowers memory
|
||||
* requirements, but results in redundant loads as we unload common data. */
|
||||
if( deletePrepared && g_bDelayedScreenLoad ) {
|
||||
DeletePreparedScreens();
|
||||
deletePrepared=false;
|
||||
vector<Actor*> apActorsToDelete;
|
||||
if( g_setGroupedScreens.find(sScreenName) == g_setGroupedScreens.end() )
|
||||
{
|
||||
/* It's time to delete all old prepared screens. Depending on
|
||||
* DelayedScreenLoad, we can either delete the screens before or after
|
||||
* we load the new screen. Either way, we must remove them from the
|
||||
* prepared list before we prepare new screens.
|
||||
* If DelayedScreenLoad is true, delete them now; this lowers memory
|
||||
* requirements, but results in redundant loads as we unload common data. */
|
||||
if( g_bDelayedScreenLoad )
|
||||
DeletePreparedScreens();
|
||||
else
|
||||
GrabPreparedActors( apActorsToDelete );
|
||||
}
|
||||
|
||||
// If the screen wasn't already prepared, load it.
|
||||
@@ -717,9 +721,12 @@ void ScreenManager::LoadDelayedScreen()
|
||||
ASSERT( bLoaded );
|
||||
}
|
||||
|
||||
if( deletePrepared )
|
||||
if( !apActorsToDelete.empty() )
|
||||
{
|
||||
DeletePreparedScreens();
|
||||
BeforeDeleteScreen();
|
||||
FOREACH( Actor*, apActorsToDelete, a )
|
||||
SAFE_DELETE( *a );
|
||||
AfterDeleteScreen();
|
||||
}
|
||||
|
||||
MESSAGEMAN->Broadcast( Message_ScreenChanged );
|
||||
|
||||
Reference in New Issue
Block a user