cleanup
don't create a max size (usually 2048x2048) texture; fixes major speed issues when movie textures fail to load
This commit is contained in:
@@ -16,14 +16,15 @@
|
|||||||
#include "MovieTexture_Null.h"
|
#include "MovieTexture_Null.h"
|
||||||
#include "SDL_utils.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)");
|
LOG->Trace("MovieTexture_Null::MovieTexture_Null(ID)");
|
||||||
texHandle = 0;
|
texHandle = 0;
|
||||||
|
|
||||||
RageTextureID actualID = GetID();
|
RageTextureID actualID = GetID();
|
||||||
|
|
||||||
actualID.iAlphaBits = 0;
|
actualID.iAlphaBits = 0;
|
||||||
long size = actualID.iMaxSize = min(actualID.iMaxSize, DISPLAY->GetMaxTextureSize());
|
int size = 64;
|
||||||
m_iSourceWidth = size;
|
m_iSourceWidth = size;
|
||||||
m_iSourceHeight = size;
|
m_iSourceHeight = size;
|
||||||
m_iImageWidth = size;
|
m_iImageWidth = size;
|
||||||
@@ -35,39 +36,18 @@ MovieTexture_Null::MovieTexture_Null(RageTextureID ID) : RageMovieTexture(ID) {
|
|||||||
|
|
||||||
CreateFrameRects();
|
CreateFrameRects();
|
||||||
|
|
||||||
RageDisplay::PixelFormat pixfmt;
|
RageDisplay::PixelFormat pixfmt = RageDisplay::FMT_RGBA4;
|
||||||
|
|
||||||
switch( TEXTUREMAN->GetMovieColorDepth() ){
|
const RageDisplay::PixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc( pixfmt );
|
||||||
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);
|
|
||||||
SDL_Surface *img = SDL_CreateRGBSurfaceSane(SDL_SWSURFACE, size, size, pfd->bpp, pfd->masks[0],
|
SDL_Surface *img = SDL_CreateRGBSurfaceSane(SDL_SWSURFACE, size, size, pfd->bpp, pfd->masks[0],
|
||||||
pfd->masks[1], pfd->masks[2], pfd->masks[3]);
|
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);
|
SDL_FreeSurface(img);
|
||||||
}
|
}
|
||||||
|
|
||||||
MovieTexture_Null::~MovieTexture_Null() {
|
MovieTexture_Null::~MovieTexture_Null()
|
||||||
DISPLAY->DeleteTexture(texHandle);
|
{
|
||||||
|
DISPLAY->DeleteTexture( texHandle );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user