Make pixel format querying a member (massaging for merge).
Remove a function from the header.
This commit is contained in:
@@ -230,9 +230,9 @@ void RageBitmapTexture::Create()
|
|||||||
(pixfmt==FMT_RGBA4 || pixfmt==FMT_RGB5A1) ) /* Don't dither if format is 32bpp; there's no point. */
|
(pixfmt==FMT_RGBA4 || pixfmt==FMT_RGB5A1) ) /* Don't dither if format is 32bpp; there's no point. */
|
||||||
{
|
{
|
||||||
/* Dither down to the destination format. */
|
/* Dither down to the destination format. */
|
||||||
SDL_Surface *dst = SDL_CreateRGBSurfaceSane(SDL_SWSURFACE, img->w, img->h, PIXEL_FORMAT_DESC[pixfmt].bpp,
|
const PixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc(pixfmt);
|
||||||
PIXEL_FORMAT_DESC[pixfmt].masks[0], PIXEL_FORMAT_DESC[pixfmt].masks[1],
|
SDL_Surface *dst = SDL_CreateRGBSurfaceSane(SDL_SWSURFACE, img->w, img->h,
|
||||||
PIXEL_FORMAT_DESC[pixfmt].masks[2], PIXEL_FORMAT_DESC[pixfmt].masks[3]);
|
pfd->bpp, pfd->masks[0], pfd->masks[1], pfd->masks[2], pfd->masks[3]);
|
||||||
|
|
||||||
SM_SDL_ErrorDiffusionDither(img, dst);
|
SM_SDL_ErrorDiffusionDither(img, dst);
|
||||||
SDL_FreeSurface(img);
|
SDL_FreeSurface(img);
|
||||||
@@ -247,9 +247,10 @@ void RageBitmapTexture::Create()
|
|||||||
|
|
||||||
/* Convert the data to the destination format and dimensions
|
/* Convert the data to the destination format and dimensions
|
||||||
* required by OpenGL if it's not in it already. */
|
* required by OpenGL if it's not in it already. */
|
||||||
ConvertSDLSurface(img, m_iTextureWidth, m_iTextureHeight, PIXEL_FORMAT_DESC[pixfmt].bpp,
|
|
||||||
PIXEL_FORMAT_DESC[pixfmt].masks[0], PIXEL_FORMAT_DESC[pixfmt].masks[1],
|
const PixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc(pixfmt);
|
||||||
PIXEL_FORMAT_DESC[pixfmt].masks[2], PIXEL_FORMAT_DESC[pixfmt].masks[3]);
|
ConvertSDLSurface(img, m_iTextureWidth, m_iTextureHeight,
|
||||||
|
pfd->bpp, pfd->masks[0], pfd->masks[1], pfd->masks[2], pfd->masks[3]);
|
||||||
|
|
||||||
m_uTexHandle = DISPLAY->CreateTexture( pixfmt, img );
|
m_uTexHandle = DISPLAY->CreateTexture( pixfmt, img );
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,18 @@ static int g_iFramesRenderedSinceLastCheck,
|
|||||||
g_iVertsRenderedSinceLastCheck,
|
g_iVertsRenderedSinceLastCheck,
|
||||||
g_iNumChecksSinceLastReset;
|
g_iNumChecksSinceLastReset;
|
||||||
|
|
||||||
|
CString PixelFormatToString( PixelFormat pixfmt )
|
||||||
|
{
|
||||||
|
const CString s[NUM_PIX_FORMATS] = {
|
||||||
|
"FMT_RGBA8",
|
||||||
|
"FMT_RGBA4",
|
||||||
|
"FMT_RGB5A1",
|
||||||
|
"FMT_RGB5",
|
||||||
|
"FMT_RGB8",
|
||||||
|
"FMT_PAL" };
|
||||||
|
return s[pixfmt];
|
||||||
|
};
|
||||||
|
|
||||||
void RageDisplay::ProcessStatsOnFlip()
|
void RageDisplay::ProcessStatsOnFlip()
|
||||||
{
|
{
|
||||||
g_iFramesRenderedSinceLastCheck++;
|
g_iFramesRenderedSinceLastCheck++;
|
||||||
|
|||||||
@@ -46,29 +46,20 @@ enum PixelFormat {
|
|||||||
FMT_PAL,
|
FMT_PAL,
|
||||||
NUM_PIX_FORMATS
|
NUM_PIX_FORMATS
|
||||||
};
|
};
|
||||||
inline CString PixelFormatToString( PixelFormat pixfmt )
|
|
||||||
{
|
CString PixelFormatToString( PixelFormat pixfmt );
|
||||||
const CString s[NUM_PIX_FORMATS] = {
|
|
||||||
"FMT_RGBA8",
|
|
||||||
"FMT_RGBA4",
|
|
||||||
"FMT_RGB5A1",
|
|
||||||
"FMT_RGB5",
|
|
||||||
"FMT_RGB8",
|
|
||||||
"FMT_PAL" };
|
|
||||||
return s[pixfmt];
|
|
||||||
};
|
|
||||||
struct PixelFormatDesc {
|
struct PixelFormatDesc {
|
||||||
int bpp;
|
int bpp;
|
||||||
unsigned int masks[4];
|
unsigned int masks[4];
|
||||||
};
|
};
|
||||||
/* This is info is different for OGL and D3D. */
|
|
||||||
extern const PixelFormatDesc PIXEL_FORMAT_DESC[NUM_PIX_FORMATS];
|
|
||||||
|
|
||||||
class RageDisplay
|
class RageDisplay
|
||||||
{
|
{
|
||||||
friend class RageTexture;
|
friend class RageTexture;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
const PixelFormatDesc *GetPixelFormatDesc(PixelFormat pf) const;
|
||||||
RageDisplay( bool windowed, int width, int height, int bpp, int rate, bool vsync, CString sWindowTitle, CString sIconFile );
|
RageDisplay( bool windowed, int width, int height, int bpp, int rate, bool vsync, CString sWindowTitle, CString sIconFile );
|
||||||
~RageDisplay();
|
~RageDisplay();
|
||||||
void Update(float fDeltaTime);
|
void Update(float fDeltaTime);
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ static void SetPalette( unsigned TexResource )
|
|||||||
#define D3DFVF_RAGEVERTEX (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_DIFFUSE|D3DFVF_TEX1) // D3D FVF flags which describe our vertex structure
|
#define D3DFVF_RAGEVERTEX (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_DIFFUSE|D3DFVF_TEX1) // D3D FVF flags which describe our vertex structure
|
||||||
|
|
||||||
|
|
||||||
const PixelFormatDesc PIXEL_FORMAT_DESC[NUM_PIX_FORMATS] = {
|
static const PixelFormatDesc PIXEL_FORMAT_DESC[NUM_PIX_FORMATS] = {
|
||||||
{
|
{
|
||||||
/* A8B8G8R8 */
|
/* A8B8G8R8 */
|
||||||
32,
|
32,
|
||||||
@@ -165,6 +165,13 @@ const PixelFormatDesc PIXEL_FORMAT_DESC[NUM_PIX_FORMATS] = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const PixelFormatDesc *RageDisplay::GetPixelFormatDesc(PixelFormat pf) const
|
||||||
|
{
|
||||||
|
ASSERT( pf < NUM_PIX_FORMATS );
|
||||||
|
return &PIXEL_FORMAT_DESC[pf];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RageDisplay::RageDisplay( bool windowed, int width, int height, int bpp, int rate, bool vsync, CString sWindowTitle, CString sIconFile )
|
RageDisplay::RageDisplay( bool windowed, int width, int height, int bpp, int rate, bool vsync, CString sWindowTitle, CString sIconFile )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -740,7 +740,7 @@ void RageDisplay::SetBackfaceCull( bool b )
|
|||||||
glDisable( GL_CULL_FACE );
|
glDisable( GL_CULL_FACE );
|
||||||
}
|
}
|
||||||
|
|
||||||
const PixelFormatDesc PIXEL_FORMAT_DESC[NUM_PIX_FORMATS] = {
|
static const PixelFormatDesc PIXEL_FORMAT_DESC[NUM_PIX_FORMATS] = {
|
||||||
{
|
{
|
||||||
/* B8G8R8A8 */
|
/* B8G8R8A8 */
|
||||||
32,
|
32,
|
||||||
@@ -783,6 +783,12 @@ const PixelFormatDesc PIXEL_FORMAT_DESC[NUM_PIX_FORMATS] = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const PixelFormatDesc *RageDisplay::GetPixelFormatDesc(PixelFormat pf) const
|
||||||
|
{
|
||||||
|
ASSERT( pf < NUM_PIX_FORMATS );
|
||||||
|
return &PIXEL_FORMAT_DESC[pf];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
struct GLPixFmtInfo_t {
|
struct GLPixFmtInfo_t {
|
||||||
GLenum internalfmt; /* target format */
|
GLenum internalfmt; /* target format */
|
||||||
|
|||||||
@@ -320,9 +320,9 @@ void MovieTexture_DShow::CreateTexture()
|
|||||||
if(TEXTUREMAN->GetTextureColorDepth() == 16)
|
if(TEXTUREMAN->GetTextureColorDepth() == 16)
|
||||||
m_PixelFormat = FMT_RGB5;
|
m_PixelFormat = FMT_RGB5;
|
||||||
|
|
||||||
m_img = SDL_CreateRGBSurfaceSane(SDL_SWSURFACE, m_iTextureWidth, m_iTextureHeight, PIXEL_FORMAT_DESC[m_PixelFormat].bpp,
|
const PixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc(m_PixelFormat);
|
||||||
PIXEL_FORMAT_DESC[m_PixelFormat].masks[0], PIXEL_FORMAT_DESC[m_PixelFormat].masks[1],
|
m_img = SDL_CreateRGBSurfaceSane(SDL_SWSURFACE, m_iTextureWidth, m_iTextureHeight,
|
||||||
PIXEL_FORMAT_DESC[m_PixelFormat].masks[2], PIXEL_FORMAT_DESC[m_PixelFormat].masks[3]);
|
pfd->bpp, pfd->masks[0], pfd->masks[1], pfd->masks[2], pfd->masks[3]);
|
||||||
|
|
||||||
m_uTexHandle = DISPLAY->CreateTexture( m_PixelFormat, m_img );
|
m_uTexHandle = DISPLAY->CreateTexture( m_PixelFormat, m_img );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user