Implement the rest of BannerTexture
This commit is contained in:
@@ -61,9 +61,22 @@ struct BannerTexture: public RageTexture
|
|||||||
{
|
{
|
||||||
unsigned m_uTexHandle;
|
unsigned m_uTexHandle;
|
||||||
unsigned GetTexHandle() { return m_uTexHandle; }; // accessed by RageDisplay
|
unsigned GetTexHandle() { return m_uTexHandle; }; // accessed by RageDisplay
|
||||||
|
/* This is a reference to a pointer in m_BannerPathToImage. */
|
||||||
|
SDL_Surface *&img;
|
||||||
|
int width, height;
|
||||||
|
|
||||||
BannerTexture( RageTextureID name, SDL_Surface *&img, int width, int height ):
|
BannerTexture( RageTextureID name, SDL_Surface *&img_, int width_, int height_ ):
|
||||||
RageTexture(name)
|
RageTexture(name), img(img_), width(width_), height(height_)
|
||||||
|
{
|
||||||
|
Create();
|
||||||
|
}
|
||||||
|
|
||||||
|
~BannerTexture()
|
||||||
|
{
|
||||||
|
Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Create()
|
||||||
{
|
{
|
||||||
/* The image is preprocessed; do as little work as possible. */
|
/* The image is preprocessed; do as little work as possible. */
|
||||||
|
|
||||||
@@ -81,7 +94,7 @@ struct BannerTexture: public RageTexture
|
|||||||
if( img->w > DISPLAY->GetMaxTextureSize() ||
|
if( img->w > DISPLAY->GetMaxTextureSize() ||
|
||||||
img->h > DISPLAY->GetMaxTextureSize() )
|
img->h > DISPLAY->GetMaxTextureSize() )
|
||||||
{
|
{
|
||||||
LOG->Warn("Converted %s at runtime", name.filename.c_str() );
|
LOG->Warn("Converted %s at runtime", GetID().filename.c_str() );
|
||||||
ConvertSDLSurface(img, img->w, img->h, 32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000);
|
ConvertSDLSurface(img, img->w, img->h, 32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000);
|
||||||
zoomSurface(img, width, height);
|
zoomSurface(img, width, height);
|
||||||
}
|
}
|
||||||
@@ -108,10 +121,21 @@ struct BannerTexture: public RageTexture
|
|||||||
CreateFrameRects();
|
CreateFrameRects();
|
||||||
}
|
}
|
||||||
|
|
||||||
~BannerTexture()
|
void Destroy()
|
||||||
{
|
{
|
||||||
DISPLAY->DeleteTexture( m_uTexHandle );
|
DISPLAY->DeleteTexture( m_uTexHandle );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Reload()
|
||||||
|
{
|
||||||
|
Destroy();
|
||||||
|
Create();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Invalidate()
|
||||||
|
{
|
||||||
|
m_uTexHandle = 0; /* don't Destroy() */
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
RageTextureID BannerCache::LoadCachedSongBanner( CString BannerPath )
|
RageTextureID BannerCache::LoadCachedSongBanner( CString BannerPath )
|
||||||
|
|||||||
Reference in New Issue
Block a user