Simplified SDL_Surface

SDL_Surface has been simplified and internal details are no longer in the public structure.

The `format` member of SDL_Surface is now an enumerated pixel format value. You can get the full details of the pixel format by calling `SDL_GetPixelFormatDetails(surface->format)`. You can get the palette associated with the surface by calling SDL_GetSurfacePalette(). You can get the clip rectangle by calling SDL_GetSurfaceClipRect().

SDL_PixelFormat has been renamed SDL_PixelFormatDetails and just describes the pixel format, it does not include a palette for indexed pixel types.

SDL_PixelFormatEnum has been renamed SDL_PixelFormat and is used instead of Uint32 for API functions that refer to pixel format by enumerated value.

SDL_MapRGB(), SDL_MapRGBA(), SDL_GetRGB(), and SDL_GetRGBA() take an optional palette parameter for indexed color lookups.
This commit is contained in:
Sam Lantinga
2024-07-08 14:59:18 -07:00
parent 40ed098ce8
commit 2ba76dbe80
123 changed files with 1865 additions and 1838 deletions

View File

@@ -357,7 +357,7 @@ static void param_update(struct spa_list *param_list, struct spa_list *pending_l
}
static struct sdl_video_format {
SDL_PixelFormatEnum format;
SDL_PixelFormat format;
SDL_Colorspace colorspace;
uint32_t id;
} sdl_video_formats[] = {
@@ -389,7 +389,7 @@ static struct sdl_video_format {
#endif
};
static uint32_t sdl_format_to_id(SDL_PixelFormatEnum format)
static uint32_t sdl_format_to_id(SDL_PixelFormat format)
{
struct sdl_video_format *f;
SPA_FOR_EACH_ELEMENT(sdl_video_formats, f) {
@@ -399,7 +399,7 @@ static uint32_t sdl_format_to_id(SDL_PixelFormatEnum format)
return SPA_VIDEO_FORMAT_UNKNOWN;
}
static void id_to_sdl_format(uint32_t id, SDL_PixelFormatEnum *format, SDL_Colorspace *colorspace)
static void id_to_sdl_format(uint32_t id, SDL_PixelFormat *format, SDL_Colorspace *colorspace)
{
struct sdl_video_format *f;
SPA_FOR_EACH_ELEMENT(sdl_video_formats, f) {
@@ -603,7 +603,7 @@ static void PIPEWIRECAMERA_ReleaseFrame(SDL_CameraDevice *device, SDL_Surface *f
PIPEWIRE_pw_thread_loop_unlock(hotplug.loop);
}
static void collect_rates(CameraFormatAddData *data, struct param *p, SDL_PixelFormatEnum sdlfmt, SDL_Colorspace colorspace, const struct spa_rectangle *size)
static void collect_rates(CameraFormatAddData *data, struct param *p, SDL_PixelFormat sdlfmt, SDL_Colorspace colorspace, const struct spa_rectangle *size)
{
const struct spa_pod_prop *prop;
struct spa_pod * values;
@@ -636,7 +636,7 @@ static void collect_rates(CameraFormatAddData *data, struct param *p, SDL_PixelF
}
}
static void collect_size(CameraFormatAddData *data, struct param *p, SDL_PixelFormatEnum sdlfmt, SDL_Colorspace colorspace)
static void collect_size(CameraFormatAddData *data, struct param *p, SDL_PixelFormat sdlfmt, SDL_Colorspace colorspace)
{
const struct spa_pod_prop *prop;
struct spa_pod * values;
@@ -670,7 +670,7 @@ static void collect_size(CameraFormatAddData *data, struct param *p, SDL_PixelFo
static void collect_format(CameraFormatAddData *data, struct param *p)
{
const struct spa_pod_prop *prop;
SDL_PixelFormatEnum sdlfmt;
SDL_PixelFormat sdlfmt;
SDL_Colorspace colorspace;
struct spa_pod * values;
uint32_t i, n_vals, choice, *ids;