add RageTexturePreloader.

This obsoletes Cached and Permanent textures, implementing them more
simply: if you want to keep the texture loaded, just load it and keep the texture
around as long as you want it.  The old "texture policy" scheme of "keep the
texture around for the duration of the screen" was ambiguous--we can have any
number of screens loaded.
This commit is contained in:
Glenn Maynard
2005-06-30 22:04:10 +00:00
parent 738b938f5a
commit f90e4cdf42
4 changed files with 113 additions and 4 deletions
+8 -4
View File
@@ -16,7 +16,6 @@
#include "ThemeManager.h"
#include "GameManager.h"
#include "RageFile.h"
#include "RageTextureManager.h"
#include "Sprite.h"
#include "ProfileManager.h"
#include "MemoryCardManager.h"
@@ -266,10 +265,13 @@ void SongManager::LoadGroupSymLinks(CString sDir, CString sGroupFolder)
void SongManager::PreloadSongImages()
{
ASSERT( TEXTUREMAN );
if( PREFSMAN->m_BannerCache != PrefsManager::BNCACHE_FULL )
return;
/* Load textures before unloading old ones, so we don't reload textures
* that we don't need to. */
RageTexturePreloader preload;
const vector<Song*> &songs = SONGMAN->GetAllSongs();
for( unsigned i = 0; i < songs.size(); ++i )
{
@@ -277,7 +279,7 @@ void SongManager::PreloadSongImages()
continue;
const RageTextureID ID = Sprite::SongBannerTexture( songs[i]->GetBannerPath() );
TEXTUREMAN->PermanentTexture( ID );
preload.Load( ID );
}
vector<Course*> courses;
@@ -288,8 +290,10 @@ void SongManager::PreloadSongImages()
continue;
const RageTextureID ID = Sprite::SongBannerTexture( courses[i]->m_sBannerPath );
TEXTUREMAN->PermanentTexture( ID );
preload.Load( ID );
}
preload.Swap( m_TexturePreload );
}
void SongManager::FreeSongs()