Skip to content

Commit 1c612f8

Browse files
committed
Remove pointer to RageSurface's own RageSurfaceFormat.
1 parent 51bcae3 commit 1c612f8

16 files changed

+184
-188
lines changed

src/BannerCache.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ struct BannerTexture: public RageTexture
233233
/* Find a supported texture format. If it happens to match the stored
234234
* file, we won't have to do any conversion here, and that'll happen
235235
* often with paletted images. */
236-
RagePixelFormat pf = m_pImage->format->BitsPerPixel == 8? RagePixelFormat_PAL: RagePixelFormat_RGB5A1;
236+
RagePixelFormat pf = m_pImage->fmt.BitsPerPixel == 8? RagePixelFormat_PAL: RagePixelFormat_RGB5A1;
237237
if( !DISPLAY->SupportsTextureFormat(pf) )
238238
pf = RagePixelFormat_RGBA4;
239239

src/RageBitmapTexture.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void RageBitmapTexture::Create()
129129
/* No iGrayscaleBits for images that are already paletted. We don't support
130130
* that; and that hint is intended for use on images that are already grayscale,
131131
* it's not intended to change a color image into a grayscale image. */
132-
if( actualID.iGrayscaleBits != -1 && pImg->format->BitsPerPixel == 8 )
132+
if( actualID.iGrayscaleBits != -1 && pImg->fmt.BitsPerPixel == 8 )
133133
actualID.iGrayscaleBits = -1;
134134

135135
/* Cap the max texture size to the hardware max. */
@@ -195,7 +195,7 @@ void RageBitmapTexture::Create()
195195
RagePixelFormat pixfmt;
196196

197197
// If the source is palleted, always load as paletted if supported.
198-
if( pImg->format->BitsPerPixel == 8 && DISPLAY->SupportsTextureFormat(RagePixelFormat_PAL) )
198+
if( pImg->fmt.BitsPerPixel == 8 && DISPLAY->SupportsTextureFormat(RagePixelFormat_PAL) )
199199
{
200200
pixfmt = RagePixelFormat_PAL;
201201
}
@@ -207,7 +207,7 @@ void RageBitmapTexture::Create()
207207
case 16:
208208
{
209209
// Bits of alpha in the source:
210-
int iSourceAlphaBits = 8 - pImg->format->Loss[3];
210+
int iSourceAlphaBits = 8 - pImg->fmt.Loss[3];
211211

212212
// Don't use more than we were hinted to.
213213
iSourceAlphaBits = min( actualID.iAlphaBits, iSourceAlphaBits );

src/RageDisplay_D3D.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -701,9 +701,9 @@ RageSurface* RageDisplay_D3D::CreateScreenshot()
701701
// We need to make a copy, since lr.pBits will go away when we call UnlockRect().
702702
result =
703703
CreateSurface( surface->w, surface->h,
704-
surface->format->BitsPerPixel,
705-
surface->format->Rmask, surface->format->Gmask,
706-
surface->format->Bmask, surface->format->Amask );
704+
surface->fmt.BitsPerPixel,
705+
surface->fmt.Rmask, surface->fmt.Gmask,
706+
surface->fmt.Bmask, surface->fmt.Amask );
707707
RageSurfaceUtils::CopySurface( surface, result );
708708
delete surface;
709709

@@ -1466,9 +1466,9 @@ unsigned RageDisplay_D3D::CreateTexture(
14661466
// Save palette
14671467
TexturePalette pal;
14681468
memset( pal.p, 0, sizeof(pal.p) );
1469-
for( int i=0; i<img->format->palette->ncolors; i++ )
1469+
for( int i=0; i<img->fmt.palette->ncolors; i++ )
14701470
{
1471-
RageSurfaceColor &c = img->format->palette->colors[i];
1471+
RageSurfaceColor &c = img->fmt.palette->colors[i];
14721472
pal.p[i].peRed = c.r;
14731473
pal.p[i].peGreen = c.g;
14741474
pal.p[i].peBlue = c.b;

src/RageDisplay_OGL.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2053,7 +2053,7 @@ void RageDisplay_Legacy::DeleteTexture( unsigned iTexture )
20532053

20542054
RagePixelFormat RageDisplay_Legacy::GetImgPixelFormat( RageSurface* &img, bool &bFreeImg, int width, int height, bool bPalettedTexture )
20552055
{
2056-
RagePixelFormat pixfmt = FindPixelFormat( img->format->BitsPerPixel, img->format->Rmask, img->format->Gmask, img->format->Bmask, img->format->Amask );
2056+
RagePixelFormat pixfmt = FindPixelFormat( img->fmt.BitsPerPixel, img->fmt.Rmask, img->fmt.Gmask, img->fmt.Bmask, img->fmt.Amask );
20572057

20582058
/* If img is paletted, we're setting up a non-paletted texture, and color indexes
20592059
* are too small, depalettize. */
@@ -2137,7 +2137,7 @@ unsigned RageDisplay_Legacy::CreateTexture(
21372137

21382138
/* If the image is paletted, but we're not sending it to a paletted image,
21392139
* set up glPixelMap. */
2140-
SetPixelMapForSurface( glImageFormat, glTexFormat, pImg->format->palette );
2140+
SetPixelMapForSurface( glImageFormat, glTexFormat, pImg->fmt.palette );
21412141

21422142
// HACK: OpenGL 1.2 types aren't available in GLU 1.3. Don't call GLU for mip
21432143
// mapping if we're using an OGL 1.2 type and don't have >= GLU 1.3.
@@ -2180,7 +2180,7 @@ unsigned RageDisplay_Legacy::CreateTexture(
21802180
SetTextureFiltering( TextureUnit_1, true );
21812181
SetTextureWrapping( TextureUnit_1, false );
21822182

2183-
glPixelStorei( GL_UNPACK_ROW_LENGTH, pImg->pitch / pImg->format->BytesPerPixel );
2183+
glPixelStorei( GL_UNPACK_ROW_LENGTH, pImg->pitch / pImg->fmt.BytesPerPixel );
21842184

21852185

21862186
if (pixfmt == RagePixelFormat_PAL)
@@ -2190,12 +2190,12 @@ unsigned RageDisplay_Legacy::CreateTexture(
21902190
memset( palette, 0, sizeof(palette) );
21912191
int p = 0;
21922192
/* Copy the palette to the format OpenGL expects. */
2193-
for( int i = 0; i < pImg->format->palette->ncolors; ++i )
2193+
for( int i = 0; i < pImg->fmt.palette->ncolors; ++i )
21942194
{
2195-
palette[p++] = pImg->format->palette->colors[i].r;
2196-
palette[p++] = pImg->format->palette->colors[i].g;
2197-
palette[p++] = pImg->format->palette->colors[i].b;
2198-
palette[p++] = pImg->format->palette->colors[i].a;
2195+
palette[p++] = pImg->fmt.palette->colors[i].r;
2196+
palette[p++] = pImg->fmt.palette->colors[i].g;
2197+
palette[p++] = pImg->fmt.palette->colors[i].b;
2198+
palette[p++] = pImg->fmt.palette->colors[i].a;
21992199
}
22002200

22012201
/* Set the palette. */
@@ -2346,18 +2346,18 @@ void RageDisplay_Legacy::UpdateTexture(
23462346
bool bFreeImg;
23472347
RagePixelFormat SurfacePixFmt = GetImgPixelFormat( pImg, bFreeImg, iWidth, iHeight, false );
23482348

2349-
glPixelStorei( GL_UNPACK_ROW_LENGTH, pImg->pitch / pImg->format->BytesPerPixel );
2349+
glPixelStorei( GL_UNPACK_ROW_LENGTH, pImg->pitch / pImg->fmt.BytesPerPixel );
23502350

23512351
GLenum glImageFormat = g_GLPixFmtInfo[SurfacePixFmt].format;
23522352
GLenum glImageType = g_GLPixFmtInfo[SurfacePixFmt].type;
23532353

23542354
/* If the image is paletted, but we're not sending it to a paletted image,
23552355
* set up glPixelMap. */
2356-
if (pImg->format->palette)
2356+
if (pImg->fmt.palette)
23572357
{
23582358
GLenum glTexFormat = 0;
23592359
glGetTexLevelParameteriv( GL_PROXY_TEXTURE_2D, 0, GLenum(GL_TEXTURE_INTERNAL_FORMAT), (GLint *) &glTexFormat );
2360-
SetPixelMapForSurface( glImageFormat, glTexFormat, pImg->format->palette );
2360+
SetPixelMapForSurface( glImageFormat, glTexFormat, pImg->fmt.palette );
23612361
}
23622362

23632363
glTexSubImage2D( GL_TEXTURE_2D, 0,

src/RageSurface.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,12 @@ bool RageSurfaceFormat::Equivalent( const RageSurfaceFormat &rhs ) const
118118

119119
RageSurface::RageSurface()
120120
{
121-
format = &fmt;
122121
pixels = NULL;
123122
pixels_owned = true;
124123
}
125124

126125
RageSurface::RageSurface( const RageSurface &cpy )
127126
{
128-
format = &fmt;
129-
130127
w = cpy.w;
131128
h = cpy.h;
132129
pitch = cpy.pitch;

src/RageSurface.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ struct RageSurfaceFormat
7070

7171
struct RageSurface
7272
{
73-
RageSurfaceFormat *format; /* compatibility only */
7473
RageSurfaceFormat fmt;
7574

7675
uint8_t *pixels;

0 commit comments

Comments
 (0)