Skip to content

Commit

Permalink
Fixed bug 5304 - add SDL_HasSurfaceRLE() (Thanks Rene Dudfield and Da…
Browse files Browse the repository at this point in the history
…n Lawrence)
  • Loading branch information
1bsyl committed Oct 18, 2020
1 parent 19a65a4 commit ffb307e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/SDL_surface.h
Expand Up @@ -237,6 +237,13 @@ extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
int flag);

/**
* \brief Returns whether the surface is RLE enabled
*
* \return SDL_TRUE if the surface is RLE enabled, or SDL_FALSE if the surface is NULL or not RLE enabled
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasSurfaceRLE(SDL_Surface * surface);

/**
* \brief Sets the color key (transparent pixel) in a blittable surface.
*
Expand Down
1 change: 1 addition & 0 deletions src/dynapi/SDL_dynapi_overrides.h
Expand Up @@ -767,3 +767,4 @@
#define SDL_SIMDRealloc SDL_SIMDRealloc_REAL
#define SDL_AndroidRequestPermission SDL_AndroidRequestPermission_REAL
#define SDL_OpenURL SDL_OpenURL_REAL
#define SDL_HasSurfaceRLE SDL_HasSurfaceRLE_REAL
1 change: 1 addition & 0 deletions src/dynapi/SDL_dynapi_procs.h
Expand Up @@ -828,3 +828,4 @@ SDL_DYNAPI_PROC(void*,SDL_SIMDRealloc,(void *a, const size_t b),(a, b),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_AndroidRequestPermission,(const char *a),(a),return)
#endif
SDL_DYNAPI_PROC(int,SDL_OpenURL,(const char *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_HasSurfaceRLE,(SDL_Surface *a),(a),return)
14 changes: 14 additions & 0 deletions src/video/SDL_surface.c
Expand Up @@ -249,6 +249,20 @@ SDL_SetSurfaceRLE(SDL_Surface * surface, int flag)
return 0;
}

SDL_bool
SDL_HasSurfaceRLE(SDL_Surface * surface)
{
if (!surface) {
return SDL_FALSE;
}

if (!(surface->map->info.flags & SDL_COPY_RLE_DESIRED)) {
return SDL_FALSE;
}

return SDL_TRUE;
}

int
SDL_SetColorKey(SDL_Surface * surface, int flag, Uint32 key)
{
Expand Down

0 comments on commit ffb307e

Please sign in to comment.