@@ -1496,8 +1496,6 @@ surf_set_alpha(pgSurfaceObject *self, PyObject *args)
14961496 PyObject * alpha_obj = NULL , * intobj = NULL ;
14971497 Uint8 alpha ;
14981498 int alphaval = 255 ;
1499- SDL_Rect sdlrect ;
1500- SDL_Surface * surface ;
15011499
15021500 if (!PyArg_ParseTuple (args , "|Oi" , & alpha_obj , & flags )) {
15031501 return NULL ;
@@ -1546,24 +1544,24 @@ surf_set_alpha(pgSurfaceObject *self, PyObject *args)
15461544 bool success =
15471545 PG_SetSurfaceRLE (surf , (flags & PGS_RLEACCEL ) ? SDL_TRUE : SDL_FALSE );
15481546 /* 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 ))) {
15551550 /* hack to strip SDL_RLEACCEL flag off surface immediately when
15561551 it is not requested */
1552+ SDL_Rect sdlrect ;
15571553 sdlrect .x = 0 ;
15581554 sdlrect .y = 0 ;
15591555 sdlrect .h = 0 ;
15601556 sdlrect .w = 0 ;
15611557
1562- surface = PG_CreateSurface (1 , 1 , PG_SURF_FORMATENUM (surf ));
1558+ SDL_Surface * surface =
1559+ PG_CreateSurface (1 , 1 , PG_SURF_FORMATENUM (surf ));
15631560
15641561 SDL_LowerBlit (surf , & sdlrect , surface , & sdlrect );
15651562 SDL_FreeSurface (surface );
15661563 }
1564+ #endif
15671565 /* HACK HACK HACK */
15681566 if (success ) {
15691567 success = PG_SetSurfaceAlphaMod (surf , alpha );
0 commit comments