@@ -1496,8 +1496,6 @@ surf_set_alpha(pgSurfaceObject *self, PyObject *args)
1496
1496
PyObject * alpha_obj = NULL , * intobj = NULL ;
1497
1497
Uint8 alpha ;
1498
1498
int alphaval = 255 ;
1499
- SDL_Rect sdlrect ;
1500
- SDL_Surface * surface ;
1501
1499
1502
1500
if (!PyArg_ParseTuple (args , "|Oi" , & alpha_obj , & flags )) {
1503
1501
return NULL ;
@@ -1546,24 +1544,24 @@ surf_set_alpha(pgSurfaceObject *self, PyObject *args)
1546
1544
bool success =
1547
1545
PG_SetSurfaceRLE (surf , (flags & PGS_RLEACCEL ) ? SDL_TRUE : SDL_FALSE );
1548
1546
/* HACK HACK HACK */
1549
- #if SDL_VERSION_ATLEAST (3 , 0 , 0 )
1550
- if (SDL_SurfaceHasRLE (surf ) && (!(flags & PGS_RLEACCEL )))
1551
- #else
1552
- if ((surf -> flags & SDL_RLEACCEL ) && (!(flags & PGS_RLEACCEL )))
1553
- #endif
1554
- {
1547
+ // TODO: SDL3: figure out how to port this or if it's relevant to SDL3.
1548
+ #if !SDL_VERSION_ATLEAST (3 , 0 , 0 )
1549
+ if ((surf -> flags & SDL_RLEACCEL ) && (!(flags & PGS_RLEACCEL ))) {
1555
1550
/* hack to strip SDL_RLEACCEL flag off surface immediately when
1556
1551
it is not requested */
1552
+ SDL_Rect sdlrect ;
1557
1553
sdlrect .x = 0 ;
1558
1554
sdlrect .y = 0 ;
1559
1555
sdlrect .h = 0 ;
1560
1556
sdlrect .w = 0 ;
1561
1557
1562
- surface = PG_CreateSurface (1 , 1 , PG_SURF_FORMATENUM (surf ));
1558
+ SDL_Surface * surface =
1559
+ PG_CreateSurface (1 , 1 , PG_SURF_FORMATENUM (surf ));
1563
1560
1564
1561
SDL_LowerBlit (surf , & sdlrect , surface , & sdlrect );
1565
1562
SDL_FreeSurface (surface );
1566
1563
}
1564
+ #endif
1567
1565
/* HACK HACK HACK */
1568
1566
if (success ) {
1569
1567
success = PG_SetSurfaceAlphaMod (surf , alpha );
0 commit comments