mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-19 16:21:44 +00:00
Implemented SDL_LoadBMP() and SDL_SaveBMP() as functions
Fixes https://github.com/libsdl-org/SDL/issues/7902
This commit is contained in:
@@ -867,6 +867,8 @@ SDL3_0.0.0 {
|
||||
SDL_HasWindowSurface;
|
||||
SDL_DestroyWindowSurface;
|
||||
SDL_GetNaturalDisplayOrientation;
|
||||
SDL_LoadBMP;
|
||||
SDL_SaveBMP;
|
||||
# extra symbols go here (don't modify this line)
|
||||
local: *;
|
||||
};
|
||||
|
@@ -893,3 +893,5 @@
|
||||
#define SDL_HasWindowSurface SDL_HasWindowSurface_REAL
|
||||
#define SDL_DestroyWindowSurface SDL_DestroyWindowSurface_REAL
|
||||
#define SDL_GetNaturalDisplayOrientation SDL_GetNaturalDisplayOrientation_REAL
|
||||
#define SDL_LoadBMP SDL_LoadBMP_REAL
|
||||
#define SDL_SaveBMP SDL_SaveBMP_REAL
|
||||
|
@@ -938,3 +938,5 @@ SDL_DYNAPI_PROC(int,SDL_hid_get_report_descriptor,(SDL_hid_device *a, unsigned c
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_HasWindowSurface,(SDL_Window *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_DestroyWindowSurface,(SDL_Window *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_DisplayOrientation,SDL_GetNaturalDisplayOrientation,(SDL_DisplayID a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Surface*,SDL_LoadBMP,(const char *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SaveBMP,(SDL_Surface *a, const char *b),(a,b),return)
|
||||
|
@@ -624,6 +624,11 @@ done:
|
||||
return surface;
|
||||
}
|
||||
|
||||
SDL_Surface *SDL_LoadBMP(const char *file)
|
||||
{
|
||||
return SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1);
|
||||
}
|
||||
|
||||
int SDL_SaveBMP_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst)
|
||||
{
|
||||
/* !!! FIXME: this calls SDL_ClearError() and then checks if an error happened during this function to
|
||||
@@ -869,3 +874,8 @@ int SDL_SaveBMP_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst)
|
||||
}
|
||||
return (SDL_strcmp(SDL_GetError(), "") == 0) ? 0 : -1;
|
||||
}
|
||||
|
||||
int SDL_SaveBMP(SDL_Surface *surface, const char *file)
|
||||
{
|
||||
return SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user