mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-25 09:17:12 +01:00
Add SDL_MEMALIGNED flag for SDL_Surface using aligned memory.
If an SDL_Surface has an aligned memory pointers, it should be freed using SDL_SIMDFree() (will be used by SDL_ttf).
This commit is contained in:
parent
7b8bac5958
commit
e5d194e902
@ -53,6 +53,7 @@ extern "C" {
|
|||||||
#define SDL_PREALLOC 0x00000001 /**< Surface uses preallocated memory */
|
#define SDL_PREALLOC 0x00000001 /**< Surface uses preallocated memory */
|
||||||
#define SDL_RLEACCEL 0x00000002 /**< Surface is RLE encoded */
|
#define SDL_RLEACCEL 0x00000002 /**< Surface is RLE encoded */
|
||||||
#define SDL_DONTFREE 0x00000004 /**< Surface is referenced internally */
|
#define SDL_DONTFREE 0x00000004 /**< Surface is referenced internally */
|
||||||
|
#define SDL_MEMALIGNED 0x00000008 /**< Surface uses aligned memory */
|
||||||
/* @} *//* Surface flags */
|
/* @} *//* Surface flags */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "SDL_RLEaccel_c.h"
|
#include "SDL_RLEaccel_c.h"
|
||||||
#include "SDL_pixels_c.h"
|
#include "SDL_pixels_c.h"
|
||||||
#include "SDL_yuv_c.h"
|
#include "SDL_yuv_c.h"
|
||||||
|
#include "../../cpuinfo/SDL_simd.h"
|
||||||
|
|
||||||
|
|
||||||
/* Check to make sure we can safely check multiplication of surface w and pitch and it won't overflow size_t */
|
/* Check to make sure we can safely check multiplication of surface w and pitch and it won't overflow size_t */
|
||||||
@ -289,7 +290,7 @@ SDL_HasColorKey(SDL_Surface * surface)
|
|||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SDL_TRUE;
|
return SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -1258,7 +1259,13 @@ SDL_FreeSurface(SDL_Surface * surface)
|
|||||||
SDL_FreeFormat(surface->format);
|
SDL_FreeFormat(surface->format);
|
||||||
surface->format = NULL;
|
surface->format = NULL;
|
||||||
}
|
}
|
||||||
if (!(surface->flags & SDL_PREALLOC)) {
|
if (surface->flags & SDL_PREALLOC) {
|
||||||
|
/* Don't free */
|
||||||
|
} else if (surface->flags & SDL_MEMALIGNED) {
|
||||||
|
/* Free aligned */
|
||||||
|
SDL_SIMDFree(surface->pixels);
|
||||||
|
} else {
|
||||||
|
/* Normal */
|
||||||
SDL_free(surface->pixels);
|
SDL_free(surface->pixels);
|
||||||
}
|
}
|
||||||
if (surface->map) {
|
if (surface->map) {
|
||||||
|
Loading…
Reference in New Issue
Block a user