don't create a max size (usually 2048x2048) texture; fixes major speed
issues when movie textures fail to load
This commit is contained in:
Glenn Maynard
2004-04-04 00:54:22 +00:00
parent 688e1e5553
commit 4f0aa75a00
@@ -16,14 +16,15 @@
#include "MovieTexture_Null.h"
#include "SDL_utils.h"
MovieTexture_Null::MovieTexture_Null(RageTextureID ID) : RageMovieTexture(ID) {
MovieTexture_Null::MovieTexture_Null(RageTextureID ID) : RageMovieTexture(ID)
{
LOG->Trace("MovieTexture_Null::MovieTexture_Null(ID)");
texHandle = 0;
RageTextureID actualID = GetID();
actualID.iAlphaBits = 0;
long size = actualID.iMaxSize = min(actualID.iMaxSize, DISPLAY->GetMaxTextureSize());
int size = 64;
m_iSourceWidth = size;
m_iSourceHeight = size;
m_iImageWidth = size;
@@ -35,39 +36,18 @@ MovieTexture_Null::MovieTexture_Null(RageTextureID ID) : RageMovieTexture(ID) {
CreateFrameRects();
RageDisplay::PixelFormat pixfmt;
RageDisplay::PixelFormat pixfmt = RageDisplay::FMT_RGBA4;
switch( TEXTUREMAN->GetMovieColorDepth() ){
default:
ASSERT(0);
case 16:
if( DISPLAY->SupportsTextureFormat(RageDisplay::FMT_RGB5) )
pixfmt = RageDisplay::FMT_RGB5;
else
pixfmt = RageDisplay::FMT_RGBA4; // everything supports RGBA4
break;
case 32:
if( DISPLAY->SupportsTextureFormat(RageDisplay::FMT_RGB8) )
pixfmt = RageDisplay::FMT_RGB8;
else if( DISPLAY->SupportsTextureFormat(RageDisplay::FMT_RGBA8) )
pixfmt = RageDisplay::FMT_RGBA8;
else if( DISPLAY->SupportsTextureFormat(RageDisplay::FMT_RGB5) )
pixfmt = RageDisplay::FMT_RGB5;
else
pixfmt = RageDisplay::FMT_RGBA4; // everything supports RGBA4
break;
}
const RageDisplay::PixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc(pixfmt);
const RageDisplay::PixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc( pixfmt );
SDL_Surface *img = SDL_CreateRGBSurfaceSane(SDL_SWSURFACE, size, size, pfd->bpp, pfd->masks[0],
pfd->masks[1], pfd->masks[2], pfd->masks[3]);
texHandle = DISPLAY->CreateTexture(pixfmt, img, false);
texHandle = DISPLAY->CreateTexture( pixfmt, img, false );
//DISPLAY->UpdateTexture(texHandle, img, 0, 0, size, size);
SDL_FreeSurface(img);
}
MovieTexture_Null::~MovieTexture_Null() {
DISPLAY->DeleteTexture(texHandle);
MovieTexture_Null::~MovieTexture_Null()
{
DISPLAY->DeleteTexture( texHandle );
}