src/video/riscos/SDL_riscossprite.c
branchSDL-1.2
changeset 12913 d07b4feae69c
parent 12786 4e73be7b4787
     1.1 --- a/src/video/riscos/SDL_riscossprite.c	Tue Jun 11 06:28:12 2019 -0700
     1.2 +++ b/src/video/riscos/SDL_riscossprite.c	Tue Jun 18 23:55:01 2019 +0100
     1.3 @@ -96,6 +96,7 @@
     1.4     char sprite_name[12] = "display";
     1.5     unsigned char *buffer;
     1.6     _kernel_swi_regs regs;
     1.7 +   _kernel_oserror *error;
     1.8     int bytesPerPixel = 1 << (format->log2bpp-3);
     1.9     int bytesPerRow;
    1.10     int offsetToSpriteData = 60;
    1.11 @@ -114,7 +115,10 @@
    1.12     size = bytesPerRow * height;
    1.13  
    1.14     buffer = SDL_malloc( (size_t) size + offsetToSpriteData );
    1.15 -   if (!buffer) return NULL;
    1.16 +   if (!buffer) {
    1.17 +      SDL_OutOfMemory();
    1.18 +      return NULL;
    1.19 +   }
    1.20  
    1.21     /* Initialise a sprite area */
    1.22  
    1.23 @@ -132,7 +136,8 @@
    1.24     regs.r[4] = width;
    1.25     regs.r[5] = height;
    1.26     regs.r[6] = format->sprite_mode_word;
    1.27 -   if (_kernel_swi(OS_SpriteOp, &regs, &regs) == NULL)
    1.28 +   error = _kernel_swi(OS_SpriteOp, &regs, &regs);
    1.29 +   if (error == NULL)
    1.30     {
    1.31         if (format->log2bpp == 3)
    1.32         {
    1.33 @@ -162,6 +167,7 @@
    1.34         }
    1.35     } else
    1.36     {
    1.37 +      SDL_SetError("Unable to create sprite: %s (%i)", error->errmess, error->errnum);
    1.38        SDL_free(buffer);
    1.39        buffer = NULL;
    1.40     }