@@ -686,7 +686,7 @@ surface_init(pgSurfaceObject *self, PyObject *args, PyObject *kwds)
686
686
}
687
687
}
688
688
689
- if (SDL_ISPIXELFORMAT_INDEXED (surface -> format -> format )) {
689
+ if (SDL_ISPIXELFORMAT_INDEXED (PG_SURF_FORMATENUM ( surface ) )) {
690
690
/* Give the surface something other than an all white palette.
691
691
* */
692
692
if (SDL_SetPaletteColors (surface -> format -> palette ,
@@ -936,7 +936,7 @@ surf_unmap_rgb(PyObject *self, PyObject *arg)
936
936
}
937
937
SURF_INIT_CHECK (surf )
938
938
939
- if (SDL_ISPIXELFORMAT_ALPHA (surf -> format -> format ))
939
+ if (SDL_ISPIXELFORMAT_ALPHA (PG_SURF_FORMATENUM ( surf ) ))
940
940
SDL_GetRGBA (col , surf - > format , rgba , rgba + 1 , rgba + 2 , rgba + 3 );
941
941
else {
942
942
SDL_GetRGB (col , surf -> format , rgba , rgba + 1 , rgba + 2 );
@@ -1109,7 +1109,7 @@ surf_set_palette(PyObject *self, PyObject *seq)
1109
1109
1110
1110
pal = surf -> format -> palette ;
1111
1111
1112
- if (!SDL_ISPIXELFORMAT_INDEXED (surf -> format -> format ))
1112
+ if (!SDL_ISPIXELFORMAT_INDEXED (PG_SURF_FORMATENUM ( surf ) ))
1113
1113
return RAISE (pgExc_SDLError , "Surface colors are not indexed\n" );
1114
1114
1115
1115
if (!pal )
@@ -1164,7 +1164,7 @@ surf_set_palette_at(PyObject *self, PyObject *args)
1164
1164
return NULL ;
1165
1165
}
1166
1166
1167
- if (!SDL_ISPIXELFORMAT_INDEXED (surf -> format -> format ))
1167
+ if (!SDL_ISPIXELFORMAT_INDEXED (PG_SURF_FORMATENUM ( surf ) ))
1168
1168
return RAISE (pgExc_SDLError , "Surface colors are not indexed\n" );
1169
1169
1170
1170
pal = surf -> format -> palette ;
@@ -1248,7 +1248,7 @@ surf_get_colorkey(pgSurfaceObject *self, PyObject *_null)
1248
1248
1249
1249
SDL_GetColorKey (surf , & mapped_color );
1250
1250
1251
- if (SDL_ISPIXELFORMAT_ALPHA (surf -> format -> format ))
1251
+ if (SDL_ISPIXELFORMAT_ALPHA (PG_SURF_FORMATENUM ( surf ) ))
1252
1252
SDL_GetRGBA (mapped_color , surf -> format , & r , & g , & b , & a );
1253
1253
else
1254
1254
SDL_GetRGB (mapped_color , surf -> format , & r , & g , & b );
@@ -1314,7 +1314,7 @@ surf_set_alpha(pgSurfaceObject *self, PyObject *args)
1314
1314
sdlrect .h = 0 ;
1315
1315
sdlrect .w = 0 ;
1316
1316
1317
- surface = PG_CreateSurface (1 , 1 , surf -> format -> format );
1317
+ surface = PG_CreateSurface (1 , 1 , PG_SURF_FORMATENUM ( surf ) );
1318
1318
1319
1319
SDL_LowerBlit (surf , & sdlrect , surface , & sdlrect );
1320
1320
SDL_FreeSurface (surface );
@@ -1411,7 +1411,7 @@ surf_convert(pgSurfaceObject *self, PyObject *args)
1411
1411
1412
1412
if ((has_colorkey = SDL_HasColorKey (surf ))) {
1413
1413
SDL_GetColorKey (surf , & colorkey );
1414
- if (SDL_ISPIXELFORMAT_ALPHA (surf -> format -> format ))
1414
+ if (SDL_ISPIXELFORMAT_ALPHA (PG_SURF_FORMATENUM ( surf ) ))
1415
1415
SDL_GetRGBA (colorkey , surf -> format , & key_r , & key_g , & key_b ,
1416
1416
& key_a );
1417
1417
else
@@ -1535,7 +1535,7 @@ surf_convert(pgSurfaceObject *self, PyObject *args)
1535
1535
if (SDL_ISPIXELFORMAT_INDEXED (SDL_MasksToPixelFormatEnum (
1536
1536
PG_FORMAT_BitsPerPixel ((& format )), format .Rmask ,
1537
1537
format .Gmask , format .Bmask , format .Amask ))) {
1538
- if (SDL_ISPIXELFORMAT_INDEXED (surf -> format -> format )) {
1538
+ if (SDL_ISPIXELFORMAT_INDEXED (PG_SURF_FORMATENUM ( surf ) )) {
1539
1539
SDL_SetPixelFormatPalette (& format , surf -> format -> palette );
1540
1540
}
1541
1541
else {
@@ -2768,7 +2768,7 @@ surf_subsurface(PyObject *self, PyObject *args)
2768
2768
return RAISE (pgExc_SDLError , SDL_GetError ());
2769
2769
2770
2770
/* copy the colormap if we need it */
2771
- if (SDL_ISPIXELFORMAT_INDEXED (surf -> format -> format ) &&
2771
+ if (SDL_ISPIXELFORMAT_INDEXED (PG_SURF_FORMATENUM ( surf ) ) &&
2772
2772
surf -> format -> palette ) {
2773
2773
SDL_Color * colors = surf -> format -> palette -> colors ;
2774
2774
int ncolors = surf -> format -> palette -> ncolors ;
@@ -4011,7 +4011,7 @@ pgSurface_Blit(pgSurfaceObject *dstobj, pgSurfaceObject *srcobj,
4011
4011
}
4012
4012
/* can't blit alpha to 8bit, crashes SDL */
4013
4013
else if (PG_SURF_BytesPerPixel (dst ) == 1 &&
4014
- (SDL_ISPIXELFORMAT_ALPHA (src -> format -> format ) ||
4014
+ (SDL_ISPIXELFORMAT_ALPHA (PG_SURF_FORMATENUM ( src ) ) ||
4015
4015
((SDL_GetSurfaceAlphaMod (src , & alpha ) == 0 && alpha != 255 )))) {
4016
4016
/* Py_BEGIN_ALLOW_THREADS */
4017
4017
if (PG_SURF_BytesPerPixel (src ) == 1 ) {
@@ -4057,7 +4057,7 @@ pgSurface_Blit(pgSurfaceObject *dstobj, pgSurfaceObject *srcobj,
4057
4057
(PG_SURF_BytesPerPixel (dst ) == 4 ||
4058
4058
PG_SURF_BytesPerPixel (dst ) == 2 ) &&
4059
4059
_PgSurface_SrcAlpha (src ) &&
4060
- (SDL_ISPIXELFORMAT_ALPHA (src -> format -> format )) &&
4060
+ (SDL_ISPIXELFORMAT_ALPHA (PG_SURF_FORMATENUM ( src ) )) &&
4061
4061
!PG_SurfaceHasRLE (src ) && !PG_SurfaceHasRLE (dst ) &&
4062
4062
!(src -> flags & SDL_RLEACCEL ) && !(dst -> flags & SDL_RLEACCEL )) {
4063
4063
/* If we have a 32bit source surface with per pixel alpha
0 commit comments