mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-18 18:58:27 +00:00
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:
parent
40ed098ce8
commit
2ba76dbe80
123 changed files with 1865 additions and 1838 deletions
|
@ -236,7 +236,7 @@ static SDL_Texture *CreateTexture(SDL_Renderer *r, unsigned char *data, unsigned
|
|||
surface = SDL_LoadBMP_IO(src, SDL_TRUE);
|
||||
if (surface) {
|
||||
/* Treat white as transparent */
|
||||
SDL_SetSurfaceColorKey(surface, SDL_TRUE, SDL_MapRGB(surface->format, 255, 255, 255));
|
||||
SDL_SetSurfaceColorKey(surface, SDL_TRUE, SDL_MapSurfaceRGB(surface, 255, 255, 255));
|
||||
|
||||
texture = SDL_CreateTextureFromSurface(r, surface);
|
||||
*w = surface->w;
|
||||
|
@ -279,7 +279,7 @@ static void MoveSprite(void)
|
|||
}
|
||||
}
|
||||
|
||||
static SDL_PixelFormatEnum GetTextureFormat(enum AVPixelFormat format)
|
||||
static SDL_PixelFormat GetTextureFormat(enum AVPixelFormat format)
|
||||
{
|
||||
switch (format) {
|
||||
case AV_PIX_FMT_RGB8:
|
||||
|
@ -511,7 +511,7 @@ static SDL_Colorspace GetFrameColorspace(AVFrame *frame)
|
|||
return colorspace;
|
||||
}
|
||||
|
||||
static SDL_PropertiesID CreateVideoTextureProperties(AVFrame *frame, SDL_PixelFormatEnum format, int access)
|
||||
static SDL_PropertiesID CreateVideoTextureProperties(AVFrame *frame, SDL_PixelFormat format, int access)
|
||||
{
|
||||
AVFrameSideData *pSideData;
|
||||
SDL_PropertiesID props;
|
||||
|
@ -571,12 +571,12 @@ static void SDLCALL FreeSwsContextContainer(void *userdata, void *value)
|
|||
static SDL_bool GetTextureForMemoryFrame(AVFrame *frame, SDL_Texture **texture)
|
||||
{
|
||||
int texture_width = 0, texture_height = 0;
|
||||
SDL_PixelFormatEnum texture_format = SDL_PIXELFORMAT_UNKNOWN;
|
||||
SDL_PixelFormatEnum frame_format = GetTextureFormat(frame->format);
|
||||
SDL_PixelFormat texture_format = SDL_PIXELFORMAT_UNKNOWN;
|
||||
SDL_PixelFormat frame_format = GetTextureFormat(frame->format);
|
||||
|
||||
if (*texture) {
|
||||
SDL_PropertiesID props = SDL_GetTextureProperties(*texture);
|
||||
texture_format = (SDL_PixelFormatEnum)SDL_GetNumberProperty(props, SDL_PROP_TEXTURE_FORMAT_NUMBER, SDL_PIXELFORMAT_UNKNOWN);
|
||||
texture_format = (SDL_PixelFormat)SDL_GetNumberProperty(props, SDL_PROP_TEXTURE_FORMAT_NUMBER, SDL_PIXELFORMAT_UNKNOWN);
|
||||
texture_width = (int)SDL_GetNumberProperty(props, SDL_PROP_TEXTURE_WIDTH_NUMBER, 0);
|
||||
texture_height = (int)SDL_GetNumberProperty(props, SDL_PROP_TEXTURE_HEIGHT_NUMBER, 0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue