src/video/SDL_surface.c
changeset 12587 b2d4dcb4ba33
parent 12584 233b2a61cad1
child 12589 85bc5436a005
equal deleted inserted replaced
12586:eb449394ec0e 12587:b2d4dcb4ba33
    24 #include "SDL_sysvideo.h"
    24 #include "SDL_sysvideo.h"
    25 #include "SDL_blit.h"
    25 #include "SDL_blit.h"
    26 #include "SDL_RLEaccel_c.h"
    26 #include "SDL_RLEaccel_c.h"
    27 #include "SDL_pixels_c.h"
    27 #include "SDL_pixels_c.h"
    28 #include "SDL_yuv_c.h"
    28 #include "SDL_yuv_c.h"
       
    29 #include "../../cpuinfo/SDL_simd.h"
    29 
    30 
    30 
    31 
    31 /* Check to make sure we can safely check multiplication of surface w and pitch and it won't overflow size_t */
    32 /* Check to make sure we can safely check multiplication of surface w and pitch and it won't overflow size_t */
    32 SDL_COMPILE_TIME_ASSERT(surface_size_assumptions,
    33 SDL_COMPILE_TIME_ASSERT(surface_size_assumptions,
    33     sizeof(int) == sizeof(Sint32) && sizeof(size_t) >= sizeof(Sint32));
    34     sizeof(int) == sizeof(Sint32) && sizeof(size_t) >= sizeof(Sint32));
   287 
   288 
   288     if (!(surface->map->info.flags & SDL_COPY_COLORKEY)) {
   289     if (!(surface->map->info.flags & SDL_COPY_COLORKEY)) {
   289         return SDL_FALSE;
   290         return SDL_FALSE;
   290     }
   291     }
   291 
   292 
   292 	return SDL_TRUE;
   293     return SDL_TRUE;
   293 }
   294 }
   294 
   295 
   295 int
   296 int
   296 SDL_GetColorKey(SDL_Surface * surface, Uint32 * key)
   297 SDL_GetColorKey(SDL_Surface * surface, Uint32 * key)
   297 {
   298 {
  1256     if (surface->format) {
  1257     if (surface->format) {
  1257         SDL_SetSurfacePalette(surface, NULL);
  1258         SDL_SetSurfacePalette(surface, NULL);
  1258         SDL_FreeFormat(surface->format);
  1259         SDL_FreeFormat(surface->format);
  1259         surface->format = NULL;
  1260         surface->format = NULL;
  1260     }
  1261     }
  1261     if (!(surface->flags & SDL_PREALLOC)) {
  1262     if (surface->flags & SDL_PREALLOC) {
       
  1263         /* Don't free */
       
  1264     } else if (surface->flags & SDL_MEMALIGNED) {
       
  1265         /* Free aligned */
       
  1266         SDL_SIMDFree(surface->pixels);
       
  1267     } else {
       
  1268         /* Normal */
  1262         SDL_free(surface->pixels);
  1269         SDL_free(surface->pixels);
  1263     }
  1270     }
  1264     if (surface->map) {
  1271     if (surface->map) {
  1265         SDL_FreeBlitMap(surface->map);
  1272         SDL_FreeBlitMap(surface->map);
  1266     }
  1273     }