use only a supported texture format for movie textures

This commit is contained in:
Chris Danford
2003-05-28 23:08:40 +00:00
parent b64d5d5a08
commit 7fbd29eb18
@@ -316,9 +316,29 @@ void MovieTexture_DShow::CreateTexture()
* Some way to figure this out dynamically would be nice, but it's probably
* impossible. (For example, 24-bit textures may even be cheaper on pure
* AGP cards; 16-bit requires a conversion.) */
m_PixelFormat = FMT_RGB8;
if(TEXTUREMAN->GetTextureColorDepth() == 16)
m_PixelFormat = FMT_RGB5;
switch( TEXTUREMAN->GetTextureColorDepth() )
{
default:
ASSERT(0);
case 16:
if( DISPLAY->SupportsTextureFormat(FMT_RGB5) )
m_PixelFormat = FMT_RGB5;
else
m_PixelFormat = FMT_RGBA4; // everything supports RGBA4
break;
case 32:
if( DISPLAY->SupportsTextureFormat(FMT_RGB8) )
m_PixelFormat = FMT_RGB8;
else if( DISPLAY->SupportsTextureFormat(FMT_RGBA8) )
m_PixelFormat = FMT_RGBA8;
else if( DISPLAY->SupportsTextureFormat(FMT_RGB5) )
m_PixelFormat = FMT_RGB5;
else
m_PixelFormat = FMT_RGBA4; // everything supports RGBA4
break;
}
const PixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc(m_PixelFormat);
m_img = SDL_CreateRGBSurfaceSane(SDL_SWSURFACE, m_iTextureWidth, m_iTextureHeight,