move PixelFormat outside of RageDisplay because so many classes outside of RageDisplay use it.

Log PixelFormat strings instead of numbers for easier to read logs.
This commit is contained in:
Chris Danford
2005-09-29 17:15:12 +00:00
parent 4f15363eed
commit bc6c7c89bc
10 changed files with 114 additions and 112 deletions
+2 -2
View File
@@ -225,9 +225,9 @@ struct BannerTexture: public RageTexture
/* Find a supported texture format. If it happens to match the stored
* file, we won't have to do any conversion here, and that'll happen often
* with paletted images. */
RageDisplay::PixelFormat pf = img->format->BitsPerPixel == 8? RageDisplay::FMT_PAL: RageDisplay::FMT_RGB5A1;
PixelFormat pf = img->format->BitsPerPixel == 8? PixelFormat_PAL: PixelFormat_RGB5A1;
if( !DISPLAY->SupportsTextureFormat(pf) )
pf = RageDisplay::FMT_RGBA4;
pf = PixelFormat_RGBA4;
ASSERT( DISPLAY->SupportsTextureFormat(pf) );
ASSERT(img);
+11 -11
View File
@@ -153,7 +153,7 @@ void RageBitmapTexture::Create()
if( pImg->w != m_iImageWidth || pImg->h != m_iImageHeight )
RageSurfaceUtils::Zoom( pImg, m_iImageWidth, m_iImageHeight );
if( actualID.iGrayscaleBits != -1 && DISPLAY->SupportsTextureFormat(RageDisplay::FMT_PAL) )
if( actualID.iGrayscaleBits != -1 && DISPLAY->SupportsTextureFormat(PixelFormat_PAL) )
{
RageSurface *pGrayscale = RageSurfaceUtils::PalettizeToGrayscale( pImg, actualID.iGrayscaleBits, actualID.iAlphaBits );
@@ -162,12 +162,12 @@ void RageBitmapTexture::Create()
}
/* Figure out which texture format we want the renderer to use. */
RageDisplay::PixelFormat pixfmt;
PixelFormat pixfmt;
/* If the source is palleted, always load as paletted if supported. */
if( pImg->format->BitsPerPixel == 8 && DISPLAY->SupportsTextureFormat(RageDisplay::FMT_PAL) )
if( pImg->format->BitsPerPixel == 8 && DISPLAY->SupportsTextureFormat(PixelFormat_PAL) )
{
pixfmt = RageDisplay::FMT_PAL;
pixfmt = PixelFormat_PAL;
}
else
{
@@ -186,16 +186,16 @@ void RageBitmapTexture::Create()
{
case 0:
case 1:
pixfmt = RageDisplay::FMT_RGB5A1;
pixfmt = PixelFormat_RGB5A1;
break;
default:
pixfmt = RageDisplay::FMT_RGBA4;
pixfmt = PixelFormat_RGBA4;
break;
}
}
break;
case 32:
pixfmt = RageDisplay::FMT_RGBA8;
pixfmt = PixelFormat_RGBA8;
break;
default:
RageException::Throw( "Invalid color depth: %d bits", actualID.iColorDepth );
@@ -205,9 +205,9 @@ void RageBitmapTexture::Create()
/* Make we're using a supported format. Every card supports either RGBA8 or RGBA4. */
if( !DISPLAY->SupportsTextureFormat(pixfmt) )
{
pixfmt = RageDisplay::FMT_RGBA8;
pixfmt = PixelFormat_RGBA8;
if( !DISPLAY->SupportsTextureFormat(pixfmt) )
pixfmt = RageDisplay::FMT_RGBA4;
pixfmt = PixelFormat_RGBA4;
}
/* Dither if appropriate. XXX: This is a special case: don't bother dithering to
@@ -215,7 +215,7 @@ void RageBitmapTexture::Create()
* depth on at least one color channel than the source. For example, it doesn't
* make sense to do this when pixfmt is RGBA5551 if the image is only RGBA555. */
if( actualID.bDither &&
(pixfmt==RageDisplay::FMT_RGBA4 || pixfmt==RageDisplay::FMT_RGB5A1) )
(pixfmt==PixelFormat_RGBA4 || pixfmt==PixelFormat_RGB5A1) )
{
/* Dither down to the destination format. */
const RageDisplay::PixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc(pixfmt);
@@ -288,7 +288,7 @@ void RageBitmapTexture::Create()
CString sProperties;
sProperties += RageDisplay::PixelFormatToString( pixfmt ) + " ";
sProperties += PixelFormatToString( pixfmt ) + " ";
if( actualID.iAlphaBits == 0 ) sProperties += "opaque ";
if( actualID.iAlphaBits == 1 ) sProperties += "matte ";
if( actualID.bStretch ) sProperties += "stretch ";
+13 -13
View File
@@ -34,17 +34,17 @@ RageDisplay* DISPLAY = NULL;
Preference<bool> LOG_FPS( "LogFPS", true );
Preference<bool> g_fFrameLimitPercent( "FrameLimitPercent", 0.0f );
CString RageDisplay::PixelFormatToString( PixelFormat pixfmt )
{
const CString s[NUM_PIX_FORMATS] = {
"FMT_RGBA8",
"FMT_RGBA4",
"FMT_RGB5A1",
"FMT_RGB5",
"FMT_RGB8",
"FMT_PAL" };
return s[pixfmt];
static const CString PixelFormatNames[] = {
"RGBA8",
"RGBA4",
"RGB5A1",
"RGB5",
"RGB8",
"PAL",
"BGR8",
"A1BGR5",
};
XToString( PixelFormat, NUM_PixelFormat );
/* bNeedReloadTextures is set to true if the device was re-created and we need
* to reload textures. On failure, an error message is returned.
@@ -548,12 +548,12 @@ RageSurface *RageDisplay::CreateSurfaceFromPixfmt( PixelFormat pixfmt,
return surf;
}
RageDisplay::PixelFormat RageDisplay::FindPixelFormat(
PixelFormat RageDisplay::FindPixelFormat(
int bpp, int Rmask, int Gmask, int Bmask, int Amask, bool realtime )
{
PixelFormatDesc tmp = { bpp, { Rmask, Gmask, Bmask, Amask } };
for(int pixfmt = 0; pixfmt < NUM_PIX_FORMATS; ++pixfmt)
for(int pixfmt = 0; pixfmt < NUM_PixelFormat; ++pixfmt)
{
const PixelFormatDesc *pf = GetPixelFormatDesc(PixelFormat(pixfmt));
if(!SupportsTextureFormat( PixelFormat(pixfmt), realtime ))
@@ -564,7 +564,7 @@ RageDisplay::PixelFormat RageDisplay::FindPixelFormat(
return PixelFormat(pixfmt);
}
return NUM_PIX_FORMATS;
return PixelFormat_INVALID;
}
/* These convert to OpenGL's coordinate system: -1,-1 is the bottom-left, +1,+1 is the
+18 -16
View File
@@ -39,6 +39,24 @@ protected:
bool m_bNeedsTextureMatrixScale;
};
enum PixelFormat
{
PixelFormat_RGBA8,
PixelFormat_RGBA4,
PixelFormat_RGB5A1,
PixelFormat_RGB5,
PixelFormat_RGB8,
PixelFormat_PAL,
/* The above formats differ between OpenGL and D3D. These are provided as
* alternatives for OpenGL that match some format in D3D. Don't use them
* directly; they'll be matched automatically by FindPixelFormat. */
PixelFormat_BGR8,
PixelFormat_A1BGR5,
NUM_PixelFormat,
PixelFormat_INVALID
};
const CString& PixelFormatToString( PixelFormat i );
class RageDisplay
{
friend class RageTexture;
@@ -50,22 +68,6 @@ public:
unsigned int masks[4];
};
enum PixelFormat {
FMT_RGBA8,
FMT_RGBA4,
FMT_RGB5A1,
FMT_RGB5,
FMT_RGB8,
FMT_PAL,
/* The above formats differ between OpenGL and D3D. These are provided as
* alternatives for OpenGL that match some format in D3D. Don't use them
* directly; they'll be matched automatically by FindPixelFormat. */
FMT_BGR8,
FMT_A1BGR5,
NUM_PIX_FORMATS
};
static CString PixelFormatToString( PixelFormat pixfmt );
virtual const PixelFormatDesc *GetPixelFormatDesc( PixelFormat pf ) const = 0;
struct VideoModeParams
+10 -10
View File
@@ -127,7 +127,7 @@ static void SetPalette( unsigned TexResource )
#define D3DFVF_RageModelVertex (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1)
static const RageDisplay::PixelFormatDesc PIXEL_FORMAT_DESC[RageDisplay::NUM_PIX_FORMATS] = {
static const RageDisplay::PixelFormatDesc PIXEL_FORMAT_DESC[NUM_PixelFormat] = {
{
/* A8B8G8R8 */
32,
@@ -176,7 +176,7 @@ static const RageDisplay::PixelFormatDesc PIXEL_FORMAT_DESC[RageDisplay::NUM_PIX
}
};
static D3DFORMAT D3DFORMATS[RageDisplay::NUM_PIX_FORMATS] =
static D3DFORMAT D3DFORMATS[NUM_PixelFormat] =
{
D3DFMT_A8R8G8B8,
D3DFMT_A4R4G4B4,
@@ -194,7 +194,7 @@ static D3DFORMAT D3DFORMATS[RageDisplay::NUM_PIX_FORMATS] =
const RageDisplay::PixelFormatDesc *RageDisplay_D3D::GetPixelFormatDesc(PixelFormat pf) const
{
ASSERT( pf < NUM_PIX_FORMATS );
ASSERT( pf < NUM_PixelFormat );
return &PIXEL_FORMAT_DESC[pf];
}
@@ -686,7 +686,7 @@ bool RageDisplay_D3D::SupportsTextureFormat( PixelFormat pixfmt, bool realtime )
// Some cards (Savage) don't support alpha in palettes.
// Don't allow paletted textures if this is the case.
if( pixfmt == FMT_PAL && !(g_DeviceCaps.TextureCaps & D3DPTEXTURECAPS_ALPHAPALETTE) )
if( pixfmt == PixelFormat_PAL && !(g_DeviceCaps.TextureCaps & D3DPTEXTURECAPS_ALPHAPALETTE) )
return false;
if( D3DFORMATS[pixfmt] == D3DFMT_UNKNOWN )
@@ -744,7 +744,7 @@ RageSurface* RageDisplay_D3D::CreateScreenshot()
pCopy->LockRect( &lr, &rect, D3DLOCK_READONLY );
}
RageSurface *surface = CreateSurfaceFromPixfmt( FMT_RGBA8, lr.pBits, desc.Width, desc.Height, lr.Pitch);
RageSurface *surface = CreateSurfaceFromPixfmt( PixelFormat_RGBA8, lr.pBits, desc.Width, desc.Height, lr.Pitch);
ASSERT( surface );
/* We need to make a copy, since lr.pBits will go away when we call UnlockRect(). */
@@ -1291,12 +1291,12 @@ unsigned RageDisplay_D3D::CreateTexture(
#endif
if( FAILED(hr) )
RageException::Throw( "CreateTexture(%i,%i,pixfmt=%i) failed: %s",
img->w, img->h, pixfmt, GetErrorString(hr).c_str() );
RageException::Throw( "CreateTexture(%i,%i,%s) failed: %s",
img->w, img->h, PixelFormatToString(pixfmt).c_str(), GetErrorString(hr).c_str() );
unsigned uTexHandle = (unsigned)pTex;
if( pixfmt == FMT_PAL )
if( pixfmt == PixelFormat_PAL )
{
// Save palette
TexturePalette pal;
@@ -1357,9 +1357,9 @@ void RageDisplay_D3D::UpdateTexture(
img->format->BytesPerPixel ); //BytesPerPixel
#else
int texpixfmt;
for(texpixfmt = 0; texpixfmt < NUM_PIX_FORMATS; ++texpixfmt)
for(texpixfmt = 0; texpixfmt < NUM_PixelFormat; ++texpixfmt)
if(D3DFORMATS[texpixfmt] == desc.Format) break;
ASSERT( texpixfmt != NUM_PIX_FORMATS );
ASSERT( texpixfmt != NUM_PixelFormat );
RageSurface *Texture = CreateSurfaceFromPixfmt(PixelFormat(texpixfmt), lr.pBits, width, height, lr.Pitch);
ASSERT( Texture );
+3 -3
View File
@@ -13,7 +13,7 @@
#include "RageUtil.h"
#include "RageSurface.h"
static RageDisplay::PixelFormatDesc PIXEL_FORMAT_DESC[RageDisplay::NUM_PIX_FORMATS] = {
static RageDisplay::PixelFormatDesc PIXEL_FORMAT_DESC[NUM_PixelFormat] = {
{
/* R8G8B8A8 */
32,
@@ -80,7 +80,7 @@ RageDisplay_Null::RageDisplay_Null( VideoModeParams p )
RageSurface* RageDisplay_Null::CreateScreenshot()
{
const PixelFormatDesc &desc = PIXEL_FORMAT_DESC[FMT_RGB8];
const PixelFormatDesc &desc = PIXEL_FORMAT_DESC[PixelFormat_RGB8];
RageSurface *image = CreateSurface(
640, 480, desc.bpp,
desc.masks[0], desc.masks[1], desc.masks[2], desc.masks[3] );
@@ -92,7 +92,7 @@ RageSurface* RageDisplay_Null::CreateScreenshot()
const RageDisplay::PixelFormatDesc *RageDisplay_Null::GetPixelFormatDesc(PixelFormat pf) const
{
ASSERT( pf < NUM_PIX_FORMATS );
ASSERT( pf >= 0 && pf < NUM_PixelFormat );
return &PIXEL_FORMAT_DESC[pf];
}
+31 -31
View File
@@ -88,7 +88,7 @@ LowLevelWindow *wind;
static void InvalidateAllGeometry();
static RageDisplay::PixelFormatDesc PIXEL_FORMAT_DESC[RageDisplay::NUM_PIX_FORMATS] = {
static RageDisplay::PixelFormatDesc PIXEL_FORMAT_DESC[NUM_PixelFormat] = {
{
/* R8G8B8A8 */
32,
@@ -169,9 +169,9 @@ static CString GLToString( GLenum e )
return ssprintf( "%i", int(e) );
}
/* GL_PIXFMT_INFO is used for both texture formats and surface formats. For example,
* it's fine to ask for a FMT_RGB5 texture, but to supply a surface matching
* FMT_RGB8. OpenGL will simply discard the extra bits.
/* g_GLPixFmtInfo is used for both texture formats and surface formats. For example,
* it's fine to ask for a PixelFormat_RGB5 texture, but to supply a surface matching
* PixelFormat_RGB8. OpenGL will simply discard the extra bits.
*
* It's possible for a format to be supported as a texture format but not as a
* surface format. For example, if packed pixels aren't supported, we can still
@@ -183,7 +183,7 @@ struct GLPixFmtInfo_t {
GLenum internalfmt; /* target format */
GLenum format; /* target format */
GLenum type; /* data format */
} GL_PIXFMT_INFO[RageDisplay::NUM_PIX_FORMATS] = {
} const g_GLPixFmtInfo[NUM_PixelFormat] = {
{
/* R8G8B8A8 */
GL_RGBA8,
@@ -236,13 +236,13 @@ static void FixLittleEndian()
return;
Initialized = true;
for( int i = 0; i < RageDisplay::NUM_PIX_FORMATS; ++i )
for( int i = 0; i < NUM_PixelFormat; ++i )
{
RageDisplay::PixelFormatDesc &pf = PIXEL_FORMAT_DESC[i];
/* OpenGL and RageSurface handle byte formats differently; we need
* to flip non-paletted masks to make them line up. */
if( GL_PIXFMT_INFO[i].type != GL_UNSIGNED_BYTE || pf.bpp == 8 )
if( g_GLPixFmtInfo[i].type != GL_UNSIGNED_BYTE || pf.bpp == 8 )
continue;
for( int mask = 0; mask < 4; ++mask)
@@ -524,9 +524,9 @@ static void CheckPalettedTextures()
}
/* Check to see if paletted textures really work. */
GLenum glTexFormat = GL_PIXFMT_INFO[RageDisplay::FMT_PAL].internalfmt;
GLenum glImageFormat = GL_PIXFMT_INFO[RageDisplay::FMT_PAL].format;
GLenum glImageType = GL_PIXFMT_INFO[RageDisplay::FMT_PAL].type;
GLenum glTexFormat = g_GLPixFmtInfo[PixelFormat_PAL].internalfmt;
GLenum glImageFormat = g_GLPixFmtInfo[PixelFormat_PAL].format;
GLenum glImageType = g_GLPixFmtInfo[PixelFormat_PAL].type;
int bits = 8;
@@ -779,7 +779,7 @@ RageSurface* RageDisplay_OGL::CreateScreenshot()
int width = wind->GetVideoModeParams().width;
int height = wind->GetVideoModeParams().height;
const PixelFormatDesc &desc = PIXEL_FORMAT_DESC[FMT_RGBA8];
const PixelFormatDesc &desc = PIXEL_FORMAT_DESC[PixelFormat_RGBA8];
RageSurface *image = CreateSurface( width, height, desc.bpp,
desc.masks[0], desc.masks[1], desc.masks[2], 0 );
@@ -1599,7 +1599,7 @@ void RageDisplay_OGL::SetCullMode( CullMode mode )
const RageDisplay::PixelFormatDesc *RageDisplay_OGL::GetPixelFormatDesc(PixelFormat pf) const
{
ASSERT( pf < NUM_PIX_FORMATS );
ASSERT( pf < NUM_PixelFormat );
return &PIXEL_FORMAT_DESC[pf];
}
@@ -1614,7 +1614,7 @@ void RageDisplay_OGL::DeleteTexture( unsigned uTexHandle )
}
RageDisplay::PixelFormat RageDisplay_OGL::GetImgPixelFormat( RageSurface* &img, bool &FreeImg, int width, int height, bool bPalettedTexture )
PixelFormat RageDisplay_OGL::GetImgPixelFormat( RageSurface* &img, bool &FreeImg, int width, int height, bool bPalettedTexture )
{
PixelFormat pixfmt = FindPixelFormat( img->format->BitsPerPixel, img->format->Rmask, img->format->Gmask, img->format->Bmask, img->format->Amask );
@@ -1624,7 +1624,7 @@ RageDisplay::PixelFormat RageDisplay_OGL::GetImgPixelFormat( RageSurface* &img,
if( !bPalettedTexture && img->fmt.BytesPerPixel == 1 && !g_bColorIndexTableWorks )
bSupported = false;
if( pixfmt == NUM_PIX_FORMATS || !SupportsSurfaceFormat(pixfmt) )
if( pixfmt == NUM_PixelFormat || !SupportsSurfaceFormat(pixfmt) )
bSupported = false;
if( !bSupported )
@@ -1633,7 +1633,7 @@ RageDisplay::PixelFormat RageDisplay_OGL::GetImgPixelFormat( RageSurface* &img,
* it ourself. Just convert it to RGBA8, and let OpenGL convert it back
* down to whatever the actual pixel format is. This is a very slow code
* path, which should almost never be used. */
pixfmt = FMT_RGBA8;
pixfmt = PixelFormat_RGBA8;
ASSERT( SupportsSurfaceFormat(pixfmt) );
const PixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc(pixfmt);
@@ -1685,17 +1685,17 @@ unsigned RageDisplay_OGL::CreateTexture(
RageSurface* img,
bool bGenerateMipMaps )
{
ASSERT( pixfmt < NUM_PIX_FORMATS );
ASSERT( pixfmt < NUM_PixelFormat );
ASSERT( img->w == power_of_two(img->w) && img->h == power_of_two(img->h) );
/* Find the pixel format of the image we've been given. */
bool FreeImg;
PixelFormat imgpixfmt = GetImgPixelFormat( img, FreeImg, img->w, img->h, pixfmt == FMT_PAL );
PixelFormat imgpixfmt = GetImgPixelFormat( img, FreeImg, img->w, img->h, pixfmt == PixelFormat_PAL );
GLenum glTexFormat = GL_PIXFMT_INFO[pixfmt].internalfmt;
GLenum glImageFormat = GL_PIXFMT_INFO[imgpixfmt].format;
GLenum glImageType = GL_PIXFMT_INFO[imgpixfmt].type;
GLenum glTexFormat = g_GLPixFmtInfo[pixfmt].internalfmt;
GLenum glImageFormat = g_GLPixFmtInfo[imgpixfmt].format;
GLenum glImageType = g_GLPixFmtInfo[imgpixfmt].type;
/* If the image is paletted, but we're not sending it to a paletted image,
* set up glPixelMap. */
@@ -1709,10 +1709,10 @@ unsigned RageDisplay_OGL::CreateTexture(
switch( pixfmt )
{
// OpenGL 1.1 types
case FMT_RGBA8:
case FMT_RGB8:
case FMT_PAL:
case FMT_BGR8:
case PixelFormat_RGBA8:
case PixelFormat_RGB8:
case PixelFormat_PAL:
case PixelFormat_BGR8:
break;
// OpenGL 1.2 types
default:
@@ -1756,7 +1756,7 @@ unsigned RageDisplay_OGL::CreateTexture(
glPixelStorei(GL_UNPACK_ROW_LENGTH, img->pitch / img->format->BytesPerPixel);
if( pixfmt == FMT_PAL )
if( pixfmt == PixelFormat_PAL )
{
/* The texture is paletted; set the texture palette. */
GLubyte palette[256*4];
@@ -1818,7 +1818,7 @@ unsigned RageDisplay_OGL::CreateTexture(
/* Sanity check: */
if( pixfmt == FMT_PAL )
if( pixfmt == PixelFormat_PAL )
{
GLint size = 0;
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GLenum(GL_TEXTURE_INDEX_SIZE_EXT), &size);
@@ -1848,9 +1848,9 @@ void RageDisplay_OGL::UpdateTexture(
glPixelStorei(GL_UNPACK_ROW_LENGTH, img->pitch / img->format->BytesPerPixel);
// GLenum glTexFormat = GL_PIXFMT_INFO[pixfmt].internalfmt;
GLenum glImageFormat = GL_PIXFMT_INFO[pixfmt].format;
GLenum glImageType = GL_PIXFMT_INFO[pixfmt].type;
// GLenum glTexFormat = g_GLPixFmtInfo[pixfmt].internalfmt;
GLenum glImageFormat = g_GLPixFmtInfo[pixfmt].format;
GLenum glImageType = g_GLPixFmtInfo[pixfmt].type;
glTexSubImage2D(GL_TEXTURE_2D, 0,
xoffset, yoffset,
@@ -1913,7 +1913,7 @@ void RageDisplay_OGL::SetAlphaTest( bool b )
*/
bool RageDisplay_OGL::SupportsSurfaceFormat( PixelFormat pixfmt )
{
switch( GL_PIXFMT_INFO[pixfmt].type )
switch( g_GLPixFmtInfo[pixfmt].type )
{
case GL_UNSIGNED_SHORT_1_5_5_5_REV:
return GLExt.m_bGL_EXT_bgra && g_bReversePackedPixelsWorks;
@@ -1931,7 +1931,7 @@ bool RageDisplay_OGL::SupportsTextureFormat( PixelFormat pixfmt, bool realtime )
if( realtime && !SupportsSurfaceFormat( pixfmt ) )
return false;
switch( GL_PIXFMT_INFO[pixfmt].format )
switch( g_GLPixFmtInfo[pixfmt].format )
{
case GL_COLOR_INDEX:
return GLExt.glColorTableEXT && GLExt.glGetColorTableParameterivEXT;
@@ -442,26 +442,26 @@ void MovieTexture_DShow::CreateTexture()
if(m_uTexHandle)
return;
RageDisplay::PixelFormat pixfmt;
PixelFormat pixfmt;
switch( TEXTUREMAN->GetPrefs().m_iMovieColorDepth )
{
default:
ASSERT(0);
case 16:
if( DISPLAY->SupportsTextureFormat(RageDisplay::FMT_RGB5) )
pixfmt = RageDisplay::FMT_RGB5;
if( DISPLAY->SupportsTextureFormat(PixelFormat_RGB5) )
pixfmt = PixelFormat_RGB5;
else
pixfmt = RageDisplay::FMT_RGBA4; // everything supports RGBA4
pixfmt = PixelFormat_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;
if( DISPLAY->SupportsTextureFormat(PixelFormat_RGB8) )
pixfmt = PixelFormat_RGB8;
else if( DISPLAY->SupportsTextureFormat(PixelFormat_RGBA8) )
pixfmt = PixelFormat_RGBA8;
else if( DISPLAY->SupportsTextureFormat(PixelFormat_RGB5) )
pixfmt = PixelFormat_RGB5;
else
pixfmt = RageDisplay::FMT_RGBA4; // everything supports RGBA4
pixfmt = PixelFormat_RGBA4; // everything supports RGBA4
break;
}
@@ -112,7 +112,7 @@ static void FixLilEndian()
#endif
}
static int FindCompatibleAVFormat( RageDisplay::PixelFormat &pixfmt, bool HighColor )
static int FindCompatibleAVFormat( PixelFormat &pixfmt, bool HighColor )
{
for( int i = 0; AVPixelFormats[i].bpp; ++i )
{
@@ -128,7 +128,7 @@ static int FindCompatibleAVFormat( RageDisplay::PixelFormat &pixfmt, bool HighCo
true /* realtime */
);
if( pixfmt == RageDisplay::NUM_PIX_FORMATS )
if( pixfmt == NUM_PixelFormat )
continue;
return i;
@@ -661,7 +661,7 @@ void MovieTexture_FFMpeg::CreateTexture()
m_iTextureHeight = power_of_two(m_iImageHeight);
/* Bogus assignment to shut gcc up. */
RageDisplay::PixelFormat pixfmt = RageDisplay::FMT_RGBA8;
PixelFormat pixfmt = PixelFormat_RGBA8;
bool PreferHighColor = (TEXTUREMAN->GetPrefs().m_iMovieColorDepth == 32);
m_AVTexfmt = FindCompatibleAVFormat( pixfmt, PreferHighColor );
@@ -682,22 +682,22 @@ void MovieTexture_FFMpeg::CreateTexture()
default:
ASSERT(0);
case 16:
if( DISPLAY->SupportsTextureFormat(RageDisplay::FMT_RGB5) )
pixfmt = RageDisplay::FMT_RGB5;
if( DISPLAY->SupportsTextureFormat(PixelFormat_RGB5) )
pixfmt = PixelFormat_RGB5;
else
pixfmt = RageDisplay::FMT_RGBA4; // everything supports RGBA4
pixfmt = PixelFormat_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;
if( DISPLAY->SupportsTextureFormat(PixelFormat_RGB8) )
pixfmt = PixelFormat_RGB8;
else if( DISPLAY->SupportsTextureFormat(PixelFormat_RGBA8) )
pixfmt = PixelFormat_RGBA8;
else if( DISPLAY->SupportsTextureFormat(PixelFormat_RGB5) )
pixfmt = PixelFormat_RGB5;
else
pixfmt = RageDisplay::FMT_RGBA4; // everything supports RGBA4
pixfmt = PixelFormat_RGBA4; // everything supports RGBA4
break;
}
}
@@ -27,9 +27,9 @@ MovieTexture_Null::MovieTexture_Null(RageTextureID ID) : RageMovieTexture(ID)
CreateFrameRects();
RageDisplay::PixelFormat pixfmt = RageDisplay::FMT_RGBA4;
PixelFormat pixfmt = PixelFormat_RGBA4;
if( !DISPLAY->SupportsTextureFormat(pixfmt) )
pixfmt = RageDisplay::FMT_RGBA8;
pixfmt = PixelFormat_RGBA8;
ASSERT( DISPLAY->SupportsTextureFormat(pixfmt) );
const RageDisplay::PixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc( pixfmt );