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
36 changed files with 212 additions and 558 deletions

View File

@@ -50,17 +50,16 @@ void draw()
void save_surface_to_bmp()
{
SDL_Surface *surface;
Uint32 r_mask, g_mask, b_mask, a_mask;
SDL_Surface* surface;
Uint32 pixel_format;
char file[128];
int bbp;
pixel_format = SDL_GetWindowPixelFormat(window);
SDL_PixelFormatEnumToMasks(pixel_format, &bbp, &r_mask, &g_mask, &b_mask, &a_mask);
surface = SDL_CreateRGBSurface(width, height, bbp, r_mask, g_mask, b_mask, a_mask);
SDL_RenderReadPixels(renderer, NULL, pixel_format, (void *)surface->pixels, surface->pitch);
surface = SDL_CreateSurface(width, height, pixel_format);
SDL_RenderReadPixels(renderer, NULL, pixel_format, (void*)surface->pixels, surface->pitch);
SDL_snprintf(file, sizeof(file), "SDL_window%" SDL_PRIs32 "-%8.8d.bmp",
SDL_GetWindowID(window), ++frame_number);