From 58329ee2d8826c06b9742d9b34574a4d9bebbc46 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 18 Dec 2003 02:57:18 +0000 Subject: [PATCH] simplify, speed up f2 --- stepmania/src/RageTextureManager.cpp | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/stepmania/src/RageTextureManager.cpp b/stepmania/src/RageTextureManager.cpp index cac84a1c1f..b359ff0fbd 100644 --- a/stepmania/src/RageTextureManager.cpp +++ b/stepmania/src/RageTextureManager.cpp @@ -266,6 +266,10 @@ void RageTextureManager::ReloadAll() { TEXTUREMAN->DisableOddDimensionWarning(); + /* Let's get rid of all unreferenced textures, so we don't reload a + * ton of cached data that we're not necessarily going to use. */ + DoDelayedDelete(); + for( std::map::iterator i = m_mapPathToTexture.begin(); i != m_mapPathToTexture.end(); ++i) { @@ -289,28 +293,6 @@ void RageTextureManager::InvalidateTextures() RageTexture* pTexture = i->second; pTexture->Invalidate(); } - - /* We're going to have to reload all loaded textures. Let's get rid - * of all unreferenced textures, so we don't reload a ton of cached - * data that we're not necessarily going to use. - * - * This must be done *after* we Invalidate above, to let the texture - * know its OpenGL texture number is invalid. If we don't do that, - * it'll try to free it. */ - for( i = m_mapPathToTexture.begin(); - i != m_mapPathToTexture.end(); ) - { - std::map::iterator j = i; - i++; - - CString sPath = j->first.filename; - RageTexture* pTexture = j->second; - if( pTexture->m_iRefCount==0 ) - { - SAFE_DELETE( pTexture ); // free the texture - m_mapPathToTexture.erase(j); // and remove the key in the map - } - } } bool RageTextureManager::SetPrefs( int iTextureColorDepth, int iMovieColorDepth, bool bDelayedDelete, int iMaxTextureResolution )