cleanup
This commit is contained in:
@@ -9,12 +9,9 @@
|
||||
RageTexture::RageTexture( RageTextureID name ):
|
||||
m_ID(name)
|
||||
{
|
||||
// LOG->Trace( "RageTexture::RageTexture()" );
|
||||
|
||||
m_iRefCount = 1;
|
||||
m_bWasUsed = false;
|
||||
|
||||
// SetActualID();
|
||||
m_iSourceWidth = m_iSourceHeight = 0;
|
||||
m_iTextureWidth = m_iTextureHeight = 0;
|
||||
m_iImageWidth = m_iImageHeight = 0;
|
||||
@@ -22,21 +19,6 @@ RageTexture::RageTexture( RageTextureID name ):
|
||||
}
|
||||
|
||||
|
||||
/* Set the initial ActualID; this is what the actual texture will start
|
||||
* from. */
|
||||
//void RageTexture::SetActualID()
|
||||
//{
|
||||
// m_ActualID = m_ID;
|
||||
//
|
||||
// /* Texture color depth preference can be overridden. */
|
||||
// if(m_ID.iColorDepth == -1)
|
||||
// m_ActualID.iColorDepth = TEXTUREMAN->GetTextureColorDepth();
|
||||
//
|
||||
// /* The max texture size can never be higher than the preference,
|
||||
// * since it might be set to something to fix driver problems. */
|
||||
// m_ActualID.iMaxSize = min(m_ActualID.iMaxSize, TEXTUREMAN->GetMaxTextureResolution());
|
||||
//}
|
||||
|
||||
RageTexture::~RageTexture()
|
||||
{
|
||||
|
||||
@@ -47,9 +29,9 @@ void RageTexture::CreateFrameRects()
|
||||
{
|
||||
GetFrameDimensionsFromFileName( GetID().filename, &m_iFramesWide, &m_iFramesHigh );
|
||||
|
||||
///////////////////////////////////
|
||||
//
|
||||
// Fill in the m_FrameRects with the bounds of each frame in the animation.
|
||||
///////////////////////////////////
|
||||
//
|
||||
m_TextureCoordRects.clear();
|
||||
|
||||
for( int j=0; j<m_iFramesHigh; j++ ) // traverse along Y
|
||||
@@ -78,7 +60,6 @@ void RageTexture::GetFrameDimensionsFromFileName( CString sPath, int* piFramesWi
|
||||
CStringArray arrayBits;
|
||||
split( sFName, " ", arrayBits, false );
|
||||
|
||||
/* XXX: allow dims to be in parens */
|
||||
for( unsigned i=0; i<arrayBits.size(); i++ )
|
||||
{
|
||||
CString &sBit = arrayBits[ i ];
|
||||
@@ -102,14 +83,14 @@ void RageTexture::GetFrameDimensionsFromFileName( CString sPath, int* piFramesWi
|
||||
|
||||
int RageTexture::GetFrameCountFromFileName( CString sPath )
|
||||
{
|
||||
int wide, high;
|
||||
GetFrameDimensionsFromFileName(sPath, &wide, &high );
|
||||
return wide*high;
|
||||
int iWide, iHigh;
|
||||
GetFrameDimensionsFromFileName( sPath, &iWide, &iHigh );
|
||||
return iWide * iHigh;
|
||||
}
|
||||
|
||||
const RectF *RageTexture::GetTextureCoordRect( int frameNo ) const
|
||||
const RectF *RageTexture::GetTextureCoordRect( int iFrameNo ) const
|
||||
{
|
||||
return &m_TextureCoordRects[frameNo];
|
||||
return &m_TextureCoordRects[iFrameNo];
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -71,7 +71,7 @@ void RageTextureManager::Update( float fDeltaTime )
|
||||
}
|
||||
}
|
||||
|
||||
void RageTextureManager::AdjustTextureID(RageTextureID &ID) const
|
||||
void RageTextureManager::AdjustTextureID( RageTextureID &ID ) const
|
||||
{
|
||||
if( ID.iColorDepth == -1 )
|
||||
ID.iColorDepth = m_Prefs.m_iTextureColorDepth;
|
||||
@@ -183,12 +183,7 @@ void RageTextureManager::UnloadTexture( RageTexture *t )
|
||||
return; /* Never unload TEX_PERMANENT textures. */
|
||||
bool bDeleteThis = false;
|
||||
|
||||
/* Always unload movies, so we don't waste time decoding.
|
||||
*
|
||||
* Actually, multiple refs to a movie won't work; they should play independently,
|
||||
* but they'll actually share settings. Not worth fixing, since we don't currently
|
||||
* using movies for anything except BGAs (though we could).
|
||||
*/
|
||||
/* Always unload movies, so we don't waste time decoding. */
|
||||
if( t->IsAMovie() )
|
||||
bDeleteThis = true;
|
||||
|
||||
@@ -206,7 +201,7 @@ void RageTextureManager::UnloadTexture( RageTexture *t )
|
||||
|
||||
void RageTextureManager::DeleteTexture( RageTexture *t )
|
||||
{
|
||||
ASSERT( t->m_iRefCount==0 );
|
||||
ASSERT( t->m_iRefCount == 0 );
|
||||
LOG->Trace( "RageTextureManager: deleting '%s'.", t->GetID().filename.c_str() );
|
||||
|
||||
FOREACHM( RageTextureID, RageTexture*, m_mapPathToTexture, i )
|
||||
|
||||
@@ -52,8 +52,8 @@ class RageTextureManager
|
||||
{
|
||||
public:
|
||||
RageTextureManager();
|
||||
void Update( float fDeltaTime );
|
||||
~RageTextureManager();
|
||||
void Update( float fDeltaTime );
|
||||
|
||||
RageTexture* LoadTexture( RageTextureID ID );
|
||||
bool IsTextureRegistered( RageTextureID ID ) const;
|
||||
@@ -71,29 +71,27 @@ public:
|
||||
void SetDefaultTexturePolicy( RageTextureID::TexPolicy p ) { m_TexturePolicy = p; }
|
||||
|
||||
// call this between Screens
|
||||
void DeleteCachedTextures() { GarbageCollect(screen_changed); }
|
||||
void DeleteCachedTextures() { GarbageCollect( screen_changed ); }
|
||||
|
||||
// call this on switch theme
|
||||
void DoDelayedDelete() { GarbageCollect(delayed_delete); }
|
||||
void DoDelayedDelete() { GarbageCollect( delayed_delete ); }
|
||||
|
||||
void InvalidateTextures();
|
||||
|
||||
void AdjustTextureID(RageTextureID &ID) const;
|
||||
void AdjustTextureID( RageTextureID &ID ) const;
|
||||
void DiagnosticOutput() const;
|
||||
|
||||
void DisableOddDimensionWarning() { m_iNoWarnAboutOddDimensions++; }
|
||||
void EnableOddDimensionWarning() { m_iNoWarnAboutOddDimensions--; }
|
||||
bool GetOddDimensionWarning() const { return m_iNoWarnAboutOddDimensions == 0; }
|
||||
|
||||
protected:
|
||||
private:
|
||||
void DeleteTexture( RageTexture *t );
|
||||
enum GCType { screen_changed, delayed_delete };
|
||||
void GarbageCollect( GCType type );
|
||||
|
||||
RageTextureManagerPrefs m_Prefs;
|
||||
|
||||
RageTexture* LoadTextureInternal( RageTextureID ID );
|
||||
|
||||
RageTextureManagerPrefs m_Prefs;
|
||||
std::map<RageTextureID, RageTexture*> m_mapPathToTexture;
|
||||
int m_iNoWarnAboutOddDimensions;
|
||||
RageTextureID::TexPolicy m_TexturePolicy;
|
||||
|
||||
Reference in New Issue
Block a user