src/video/SDL_RLEaccel.c
changeset 12591 66cd8731c3b1
parent 12503 806492103856
     1.1 --- a/src/video/SDL_RLEaccel.c	Mon Feb 04 08:43:37 2019 +0100
     1.2 +++ b/src/video/SDL_RLEaccel.c	Mon Feb 04 09:11:07 2019 +0100
     1.3 @@ -89,6 +89,7 @@
     1.4  #include "SDL_sysvideo.h"
     1.5  #include "SDL_blit.h"
     1.6  #include "SDL_RLEaccel_c.h"
     1.7 +#include "../cpuinfo/SDL_simd.h"
     1.8  
     1.9  #ifndef MIN
    1.10  #define MIN(a, b) ((a) < (b) ? (a) : (b))
    1.11 @@ -1220,8 +1221,9 @@
    1.12  
    1.13      /* Now that we have it encoded, release the original pixels */
    1.14      if (!(surface->flags & SDL_PREALLOC)) {
    1.15 -        SDL_free(surface->pixels);
    1.16 +        SDL_SIMDFree(surface->pixels);
    1.17          surface->pixels = NULL;
    1.18 +        surface->flags &= ~SDL_SIMD_ALIGNED;
    1.19      }
    1.20  
    1.21      /* realloc the buffer to release unused memory */
    1.22 @@ -1383,8 +1385,9 @@
    1.23  
    1.24      /* Now that we have it encoded, release the original pixels */
    1.25      if (!(surface->flags & SDL_PREALLOC)) {
    1.26 -        SDL_free(surface->pixels);
    1.27 +        SDL_SIMDFree(surface->pixels);
    1.28          surface->pixels = NULL;
    1.29 +        surface->flags &= ~SDL_SIMD_ALIGNED;
    1.30      }
    1.31  
    1.32      /* realloc the buffer to release unused memory */
    1.33 @@ -1484,10 +1487,11 @@
    1.34          uncopy_opaque = uncopy_transl = uncopy_32;
    1.35      }
    1.36  
    1.37 -    surface->pixels = SDL_malloc(surface->h * surface->pitch);
    1.38 +    surface->pixels = SDL_SIMDAlloc(surface->h * surface->pitch);
    1.39      if (!surface->pixels) {
    1.40          return (SDL_FALSE);
    1.41      }
    1.42 +    surface->flags |= SDL_SIMD_ALIGNED;
    1.43      /* fill background with transparent pixels */
    1.44      SDL_memset(surface->pixels, 0, surface->h * surface->pitch);
    1.45  
    1.46 @@ -1549,12 +1553,13 @@
    1.47                  SDL_Rect full;
    1.48  
    1.49                  /* re-create the original surface */
    1.50 -                surface->pixels = SDL_malloc(surface->h * surface->pitch);
    1.51 +                surface->pixels = SDL_SIMDAlloc(surface->h * surface->pitch);
    1.52                  if (!surface->pixels) {
    1.53                      /* Oh crap... */
    1.54                      surface->flags |= SDL_RLEACCEL;
    1.55                      return;
    1.56                  }
    1.57 +                surface->flags |= SDL_SIMD_ALIGNED;
    1.58  
    1.59                  /* fill it with the background color */
    1.60                  SDL_FillRect(surface, NULL, surface->map->info.colorkey);