Remove mask versions of SDL_CreateRGBSurface* #6701 (#6711)

* Rename SDL_CreateRGBSurface{,From} to SDL_CreateSurface{,From}, which now takes a format parameter
This commit is contained in:
Sylvain Becker 2022-12-01 17:04:02 +01:00 committed by GitHub
parent 778b8926b4
commit 932f61348d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 212 additions and 558 deletions

View file

@ -327,8 +327,6 @@ void
initializeTexture()
{
int bpp; /* texture bits per pixel */
Uint32 Rmask, Gmask, Bmask, Amask; /* masks for pixel format passed into OpenGL */
SDL_Surface *bmp_surface; /* the bmp is loaded here */
SDL_Surface *bmp_surface_rgba8888; /* this serves as a destination to convert the BMP
to format passed into OpenGL */
@ -338,13 +336,9 @@ initializeTexture()
fatalError("could not load stroke.bmp");
}
/* Grab info about format that will be passed into OpenGL */
SDL_PixelFormatEnumToMasks(SDL_PIXELFORMAT_ABGR8888, &bpp, &Rmask, &Gmask,
&Bmask, &Amask);
/* Create surface that will hold pixels passed into OpenGL */
bmp_surface_rgba8888 =
SDL_CreateRGBSurface(bmp_surface->w, bmp_surface->h, bpp, Rmask,
Gmask, Bmask, Amask);
bmp_surface_rgba8888 = SDL_CreateSurface(bmp_surface->w, bmp_surface->h, SDL_PIXELFORMAT_ABGR8888);
/* Blit to this surface, effectively converting the format */
SDL_BlitSurface(bmp_surface, NULL, bmp_surface_rgba8888, NULL);

View file

@ -173,13 +173,9 @@ loadFont(void)
SDL_SetColorKey(surface, 1, SDL_MapRGB(surface->format, 238, 0, 252));
/* now we convert the surface to our desired pixel format */
int format = SDL_PIXELFORMAT_ABGR8888; /* desired texture format */
Uint32 Rmask, Gmask, Bmask, Amask; /* masks for desired format */
int bpp; /* bits per pixel for desired format */
SDL_PixelFormatEnumToMasks(format, &bpp, &Rmask, &Gmask, &Bmask,
&Amask);
SDL_Surface *converted =
SDL_CreateRGBSurface(surface->w, surface->h, bpp, Rmask, Gmask,
Bmask, Amask);
SDL_Surface *converted = SDL_CreateSurface(surface->w, surface->h, format);
SDL_BlitSurface(surface, NULL, converted, NULL);
/* create our texture */
texture = SDL_CreateTextureFromSurface(renderer, converted);