src/video/SDL_surface.c
changeset 11289 ca3c2c98f2e1
parent 11254 390de4b9f84f
child 11448 52dcef74bdc5
     1.1 --- a/src/video/SDL_surface.c	Mon Aug 14 10:28:47 2017 -0700
     1.2 +++ b/src/video/SDL_surface.c	Mon Aug 14 13:37:14 2017 -0700
     1.3 @@ -871,6 +871,15 @@
     1.4  }
     1.5  
     1.6  /*
     1.7 + * Creates a new surface identical to the existing surface
     1.8 + */
     1.9 +SDL_Surface *
    1.10 +SDL_DuplicateSurface(SDL_Surface * surface)
    1.11 +{
    1.12 +    return SDL_ConvertSurface(surface, surface->format, surface->flags);
    1.13 +}
    1.14 +
    1.15 +/*
    1.16   * Convert a surface into the specified pixel format.
    1.17   */
    1.18  SDL_Surface *
    1.19 @@ -882,6 +891,15 @@
    1.20      SDL_Color copy_color;
    1.21      SDL_Rect bounds;
    1.22  
    1.23 +    if (!surface) {
    1.24 +        SDL_InvalidParamError("surface");
    1.25 +        return NULL;
    1.26 +    }
    1.27 +    if (!format) {
    1.28 +        SDL_InvalidParamError("format");
    1.29 +        return NULL;
    1.30 +    }
    1.31 +
    1.32      /* Check for empty destination palette! (results in empty image) */
    1.33      if (format->palette != NULL) {
    1.34          int i;