mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-28 16:58:44 +00:00
Fixed bug 2441 - SDL_DuplicateSurface
Rainer Deyke I've written a small patch that adds a small SDL_DuplicateSurface function to SDL. I've written the function as part of a larger (as yet unfinished) patch, but I think this function is useful enough that it merits inclusion in SDL on its own.
This commit is contained in:
parent
362d549690
commit
f142a7961e
4 changed files with 25 additions and 0 deletions
|
|
@ -870,6 +870,15 @@ SDL_UnlockSurface(SDL_Surface * surface)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Creates a new surface identical to the existing surface
|
||||
*/
|
||||
SDL_Surface *
|
||||
SDL_DuplicateSurface(SDL_Surface * surface)
|
||||
{
|
||||
return SDL_ConvertSurface(surface, surface->format, surface->flags);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a surface into the specified pixel format.
|
||||
*/
|
||||
|
|
@ -882,6 +891,15 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format,
|
|||
SDL_Color copy_color;
|
||||
SDL_Rect bounds;
|
||||
|
||||
if (!surface) {
|
||||
SDL_InvalidParamError("surface");
|
||||
return NULL;
|
||||
}
|
||||
if (!format) {
|
||||
SDL_InvalidParamError("format");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Check for empty destination palette! (results in empty image) */
|
||||
if (format->palette != NULL) {
|
||||
int i;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue