mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-29 20:57:59 +08: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:
@@ -558,6 +558,7 @@
|
||||
<ClInclude Include="..\..\src\video\SDL_pixels_c.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_rect_c.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_surface_c.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_sysvideo.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_vulkan_internal.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_yuv_c.h" />
|
||||
|
||||
@@ -436,6 +436,7 @@
|
||||
<ClInclude Include="..\..\src\video\SDL_pixels_c.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_rect_c.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_surface_c.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_sysvideo.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_vulkan_internal.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_yuv_c.h" />
|
||||
|
||||
@@ -185,6 +185,7 @@
|
||||
<ClInclude Include="..\src\video\SDL_pixels_c.h" />
|
||||
<ClInclude Include="..\src\video\SDL_rect_c.h" />
|
||||
<ClInclude Include="..\src\video\SDL_RLEaccel_c.h" />
|
||||
<ClInclude Include="..\src\video\SDL_surface_c.h" />
|
||||
<ClInclude Include="..\src\video\SDL_sysvideo.h" />
|
||||
<ClInclude Include="..\src\video\SDL_sysvidocapture.h" />
|
||||
<ClInclude Include="..\src\video\SDL_yuv_c.h" />
|
||||
|
||||
@@ -438,6 +438,9 @@
|
||||
<ClInclude Include="..\src\video\SDL_RLEaccel_c.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\video\SDL_surface_c.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\video\SDL_sysvideo.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
|
||||
@@ -464,6 +464,7 @@
|
||||
<ClInclude Include="..\..\src\video\SDL_pixels_c.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_rect_c.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_surface_c.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_sysvideo.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_vulkan_internal.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_yuv_c.h" />
|
||||
|
||||
@@ -615,6 +615,9 @@
|
||||
<ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h">
|
||||
<Filter>video</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\video\SDL_surface_c.h">
|
||||
<Filter>video</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\video\SDL_blit.h">
|
||||
<Filter>video</Filter>
|
||||
</ClInclude>
|
||||
|
||||
@@ -1566,7 +1566,7 @@ typedef SDL_GameControllerButton, SDL_GamepadButton;
|
||||
@@
|
||||
@@
|
||||
- SDL_AllocFormat
|
||||
+ SDL_CreatePixelFormat
|
||||
+ SDL_GetPixelFormatDetails
|
||||
(...)
|
||||
@@
|
||||
@@
|
||||
@@ -1575,23 +1575,18 @@ typedef SDL_GameControllerButton, SDL_GamepadButton;
|
||||
(...)
|
||||
@@
|
||||
@@
|
||||
- SDL_FreeFormat
|
||||
+ SDL_DestroyPixelFormat
|
||||
(...)
|
||||
@@
|
||||
@@
|
||||
- SDL_FreePalette
|
||||
+ SDL_DestroyPalette
|
||||
(...)
|
||||
@@
|
||||
@@
|
||||
- SDL_MasksToPixelFormatEnum
|
||||
+ SDL_GetPixelFormatEnumForMasks
|
||||
+ SDL_GetPixelFormatForMasks
|
||||
(...)
|
||||
@@
|
||||
@@
|
||||
- SDL_PixelFormatEnumToMasks
|
||||
+ SDL_GetMasksForPixelFormatEnum
|
||||
+ SDL_GetMasksForPixelFormat
|
||||
(...)
|
||||
@@
|
||||
@@
|
||||
@@ -3488,3 +3483,21 @@ typedef SDL_Colour, SDL_Color;
|
||||
@@
|
||||
- SDLK_z
|
||||
+ SDLK_Z
|
||||
@@
|
||||
typedef SDL_PixelFormat, SDL_PackedPixelDetails;
|
||||
@@
|
||||
- SDL_PixelFormat
|
||||
+ SDL_PixelFormatDetails
|
||||
@@
|
||||
@@
|
||||
- SDL_ConvertSurfaceFormat
|
||||
+ SDL_ConvertSurface
|
||||
(...)
|
||||
@@
|
||||
@@
|
||||
- SDL_PREALLOC
|
||||
+ SDL_SURFACE_PREALLOCATED
|
||||
@@
|
||||
@@
|
||||
- SDL_SIMD_ALIGNED
|
||||
+ SDL_SURFACE_SIMD_ALIGNED
|
||||
|
||||
@@ -15,7 +15,7 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
screenSurface = SDL_GetWindowSurface(window);
|
||||
SDL_FillSurfaceRect(screenSurface, NULL, SDL_MapRGB(screenSurface->format, 0xff, 0xff, 0xff));
|
||||
SDL_FillSurfaceRect(screenSurface, NULL, SDL_MapSurfaceRGB(screenSurface, 0xff, 0xff, 0xff));
|
||||
SDL_UpdateWindowSurface(window);
|
||||
SDL_Delay(100);
|
||||
SDL_DestroyWindow(window);
|
||||
|
||||
+41
-16
@@ -1092,19 +1092,22 @@ The following symbols have been renamed:
|
||||
|
||||
## SDL_pixels.h
|
||||
|
||||
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.
|
||||
|
||||
SDL_GetMasksForPixelFormat() now returns the standard int error code.
|
||||
|
||||
SDL_CalculateGammaRamp has been removed, because SDL_SetWindowGammaRamp has been removed as well due to poor support in modern operating systems (see [SDL_video.h](#sdl_videoh)).
|
||||
|
||||
The BitsPerPixel and BytesPerPixel fields of SDL_PixelFormat have been renamed bits_per_pixel and bytes_per_pixel.
|
||||
|
||||
SDL_PixelFormatEnum is used instead of Uint32 for API functions that refer to pixel format by enumerated value.
|
||||
|
||||
The following functions have been renamed:
|
||||
* SDL_AllocFormat() => SDL_CreatePixelFormat()
|
||||
* SDL_AllocFormat() => SDL_GetPixelFormatDetails()
|
||||
* SDL_AllocPalette() => SDL_CreatePalette()
|
||||
* SDL_FreeFormat() => SDL_DestroyPixelFormat()
|
||||
* SDL_FreePalette() => SDL_DestroyPalette()
|
||||
* SDL_MasksToPixelFormatEnum() => SDL_GetPixelFormatEnumForMasks()
|
||||
* SDL_PixelFormatEnumToMasks() => SDL_GetMasksForPixelFormatEnum()
|
||||
* SDL_MasksToPixelFormatEnum() => SDL_GetPixelFormatForMasks()
|
||||
* SDL_PixelFormatEnumToMasks() => SDL_GetMasksForPixelFormat()
|
||||
|
||||
The following symbols have been renamed:
|
||||
* SDL_PIXELFORMAT_BGR444 => SDL_PIXELFORMAT_XBGR4444
|
||||
@@ -1114,9 +1117,16 @@ The following symbols have been renamed:
|
||||
* SDL_PIXELFORMAT_RGB555 => SDL_PIXELFORMAT_XRGB1555
|
||||
* SDL_PIXELFORMAT_RGB888 => SDL_PIXELFORMAT_XRGB8888
|
||||
|
||||
The following functions have been removed:
|
||||
* SDL_FreeFormat()
|
||||
* SDL_SetPixelFormatPalette()
|
||||
|
||||
The following macros have been removed:
|
||||
* SDL_Colour - use SDL_Color instead
|
||||
|
||||
The following structures have been renamed:
|
||||
* SDL_PixelFormat => SDL_PixelFormatDetails
|
||||
|
||||
## SDL_platform.h
|
||||
|
||||
The following platform preprocessor macros have been renamed:
|
||||
@@ -1598,19 +1608,23 @@ The following functions have been removed:
|
||||
|
||||
## SDL_surface.h
|
||||
|
||||
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().
|
||||
|
||||
The userdata member of SDL_Surface has been replaced with a more general properties interface, which can be queried with SDL_GetSurfaceProperties()
|
||||
|
||||
Removed unused 'flags' parameter from SDL_ConvertSurface and SDL_ConvertSurfaceFormat.
|
||||
Removed the unused 'flags' parameter from SDL_ConvertSurface.
|
||||
|
||||
SDL_CreateRGBSurface() and SDL_CreateRGBSurfaceWithFormat() have been combined into a new function SDL_CreateSurface().
|
||||
SDL_CreateRGBSurfaceFrom() and SDL_CreateRGBSurfaceWithFormatFrom() have been combined into a new function SDL_CreateSurfaceFrom().
|
||||
SDL_CreateRGBSurfaceFrom() and SDL_CreateRGBSurfaceWithFormatFrom() have been combined into a new function SDL_CreateSurfaceFrom(), and the parameter order has changed for consistency with SDL_CreateSurface().
|
||||
|
||||
You can implement the old functions in your own code easily:
|
||||
```c
|
||||
SDL_Surface *SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
|
||||
{
|
||||
return SDL_CreateSurface(width, height,
|
||||
SDL_GetPixelFormatEnumForMasks(depth, Rmask, Gmask, Bmask, Amask));
|
||||
SDL_GetPixelFormatForMasks(depth, Rmask, Gmask, Bmask, Amask));
|
||||
}
|
||||
|
||||
SDL_Surface *SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, Uint32 format)
|
||||
@@ -1620,13 +1634,14 @@ SDL_Surface *SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height,
|
||||
|
||||
SDL_Surface *SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
|
||||
{
|
||||
return SDL_CreateSurfaceFrom(pixels, width, height, pitch,
|
||||
SDL_GetPixelFormatEnumForMasks(depth, Rmask, Gmask, Bmask, Amask));
|
||||
return SDL_CreateSurfaceFrom(width, height,
|
||||
SDL_GetPixelFormatForMasks(depth, Rmask, Gmask, Bmask, Amask),
|
||||
pixels, pitch);
|
||||
}
|
||||
|
||||
SDL_Surface *SDL_CreateRGBSurfaceWithFormatFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 format)
|
||||
{
|
||||
return SDL_CreateSurfaceFrom(pixels, width, height, pitch, format);
|
||||
return SDL_CreateSurfaceFrom(width, height, format, pixels, pitch);
|
||||
}
|
||||
|
||||
```
|
||||
@@ -1645,10 +1660,15 @@ SDL_BlitSurfaceScaled() and SDL_BlitSurfaceUncheckedScaled() now take a scale pa
|
||||
|
||||
SDL_SoftStretch() now takes a scale paramater.
|
||||
|
||||
SDL_PixelFormatEnum is used instead of Uint32 for API functions that refer to pixel format by enumerated value.
|
||||
SDL_PixelFormat is used instead of Uint32 for API functions that refer to pixel format by enumerated value.
|
||||
|
||||
SDL_SetSurfaceColorKey() takes an SDL_bool to enable and disable colorkey. RLE acceleration isn't controlled by the parameter, you should use SDL_SetSurfaceRLE() to change that separately.
|
||||
|
||||
SDL_SetSurfaceRLE() takes an SDL_bool to enable and disable RLE acceleration.
|
||||
|
||||
The following functions have been renamed:
|
||||
* SDL_BlitScaled() => SDL_BlitSurfaceScaled()
|
||||
* SDL_ConvertSurfaceFormat() => SDL_ConvertSurface()
|
||||
* SDL_FillRect() => SDL_FillSurfaceRect()
|
||||
* SDL_FillRects() => SDL_FillSurfaceRects()
|
||||
* SDL_FreeSurface() => SDL_DestroySurface()
|
||||
@@ -1669,11 +1689,16 @@ The following symbols have been removed:
|
||||
* SDL_SWSURFACE
|
||||
|
||||
The following functions have been removed:
|
||||
* SDL_FreeFormat()
|
||||
* SDL_GetYUVConversionMode()
|
||||
* SDL_GetYUVConversionModeForResolution()
|
||||
* SDL_SetYUVConversionMode() - use SDL_SetSurfaceColorspace() to set the surface colorspace and SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER with SDL_CreateTextureWithProperties() to set the texture colorspace. The default colorspace for YUV pixel formats is SDL_COLORSPACE_JPEG.
|
||||
* SDL_SoftStretchLinear() - use SDL_SoftStretch() with SDL_SCALEMODE_LINEAR
|
||||
|
||||
The following symbols have been renamed:
|
||||
* SDL_PREALLOC => SDL_SURFACE_PREALLOCATED
|
||||
* SDL_SIMD_ALIGNED => SDL_SURFACE_SIMD_ALIGNED
|
||||
|
||||
## SDL_system.h
|
||||
|
||||
SDL_WindowsMessageHook has changed signatures so the message may be modified and it can block further message processing.
|
||||
@@ -1835,7 +1860,7 @@ The callback passed to SDL_AddTimer() has changed parameters to:
|
||||
Uint32 SDLCALL TimerCallback(void *userdata, SDL_TimerID timerID, Uint32 interval);
|
||||
````
|
||||
|
||||
The return value of SDL_RemoveTimer() has changed to the standard int error code.
|
||||
SDL_RemoveTimer() now returns the standard int error code.
|
||||
|
||||
## SDL_touch.h
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ typedef struct SDL_Camera SDL_Camera;
|
||||
*/
|
||||
typedef struct SDL_CameraSpec
|
||||
{
|
||||
SDL_PixelFormatEnum format; /**< Frame format */
|
||||
SDL_PixelFormat format; /**< Frame format */
|
||||
SDL_Colorspace colorspace; /**< Frame colorspace */
|
||||
int width; /**< Frame width */
|
||||
int height; /**< Frame height */
|
||||
|
||||
@@ -453,19 +453,18 @@
|
||||
#define SDL_sem SDL_Semaphore
|
||||
|
||||
/* ##SDL_pixels.h */
|
||||
#define SDL_AllocFormat SDL_CreatePixelFormat
|
||||
#define SDL_AllocFormat SDL_GetPixelFormatDetails
|
||||
#define SDL_AllocPalette SDL_CreatePalette
|
||||
#define SDL_Colour SDL_Color
|
||||
#define SDL_FreeFormat SDL_DestroyPixelFormat
|
||||
#define SDL_FreePalette SDL_DestroyPalette
|
||||
#define SDL_MasksToPixelFormatEnum SDL_GetPixelFormatEnumForMasks
|
||||
#define SDL_MasksToPixelFormatEnum SDL_GetPixelFormatForMasks
|
||||
#define SDL_PIXELFORMAT_BGR444 SDL_PIXELFORMAT_XBGR4444
|
||||
#define SDL_PIXELFORMAT_BGR555 SDL_PIXELFORMAT_XBGR1555
|
||||
#define SDL_PIXELFORMAT_BGR888 SDL_PIXELFORMAT_XBGR8888
|
||||
#define SDL_PIXELFORMAT_RGB444 SDL_PIXELFORMAT_XRGB4444
|
||||
#define SDL_PIXELFORMAT_RGB555 SDL_PIXELFORMAT_XRGB1555
|
||||
#define SDL_PIXELFORMAT_RGB888 SDL_PIXELFORMAT_XRGB8888
|
||||
#define SDL_PixelFormatEnumToMasks SDL_GetMasksForPixelFormatEnum
|
||||
#define SDL_PixelFormatEnumToMasks SDL_GetMasksForPixelFormat
|
||||
|
||||
/* ##SDL_rect.h */
|
||||
#define SDL_EncloseFPoints SDL_GetRectEnclosingPointsFloat
|
||||
@@ -580,6 +579,7 @@
|
||||
|
||||
/* ##SDL_surface.h */
|
||||
#define SDL_BlitScaled SDL_BlitSurfaceScaled
|
||||
#define SDL_ConvertSurfaceFormat SDL_ConvertSurface
|
||||
#define SDL_FillRect SDL_FillSurfaceRect
|
||||
#define SDL_FillRects SDL_FillSurfaceRects
|
||||
#define SDL_FreeSurface SDL_DestroySurface
|
||||
@@ -590,6 +590,8 @@
|
||||
#define SDL_LoadBMP_RW SDL_LoadBMP_IO
|
||||
#define SDL_LowerBlit SDL_BlitSurfaceUnchecked
|
||||
#define SDL_LowerBlitScaled SDL_BlitSurfaceUncheckedScaled
|
||||
#define SDL_PREALLOC SDL_SURFACE_PREALLOCATED
|
||||
#define SDL_SIMD_ALIGNED SDL_SURFACE_SIMD_ALIGNED
|
||||
#define SDL_SaveBMP_RW SDL_SaveBMP_IO
|
||||
#define SDL_SetClipRect SDL_SetSurfaceClipRect
|
||||
#define SDL_SetColorKey SDL_SetSurfaceColorKey
|
||||
@@ -1048,19 +1050,18 @@
|
||||
#define SDL_sem SDL_sem_renamed_SDL_Semaphore
|
||||
|
||||
/* ##SDL_pixels.h */
|
||||
#define SDL_AllocFormat SDL_AllocFormat_renamed_SDL_CreatePixelFormat
|
||||
#define SDL_AllocFormat SDL_AllocFormat_renamed_SDL_GetPixelFormatDetails
|
||||
#define SDL_AllocPalette SDL_AllocPalette_renamed_SDL_CreatePalette
|
||||
#define SDL_Colour SDL_Colour_renamed_SDL_Color
|
||||
#define SDL_FreeFormat SDL_FreeFormat_renamed_SDL_DestroyPixelFormat
|
||||
#define SDL_FreePalette SDL_FreePalette_renamed_SDL_DestroyPalette
|
||||
#define SDL_MasksToPixelFormatEnum SDL_MasksToPixelFormatEnum_renamed_SDL_GetPixelFormatEnumForMasks
|
||||
#define SDL_MasksToPixelFormatEnum SDL_MasksToPixelFormatEnum_renamed_SDL_GetPixelFormatForMasks
|
||||
#define SDL_PIXELFORMAT_BGR444 SDL_PIXELFORMAT_BGR444_renamed_SDL_PIXELFORMAT_XBGR4444
|
||||
#define SDL_PIXELFORMAT_BGR555 SDL_PIXELFORMAT_BGR555_renamed_SDL_PIXELFORMAT_XBGR1555
|
||||
#define SDL_PIXELFORMAT_BGR888 SDL_PIXELFORMAT_BGR888_renamed_SDL_PIXELFORMAT_XBGR8888
|
||||
#define SDL_PIXELFORMAT_RGB444 SDL_PIXELFORMAT_RGB444_renamed_SDL_PIXELFORMAT_XRGB4444
|
||||
#define SDL_PIXELFORMAT_RGB555 SDL_PIXELFORMAT_RGB555_renamed_SDL_PIXELFORMAT_XRGB1555
|
||||
#define SDL_PIXELFORMAT_RGB888 SDL_PIXELFORMAT_RGB888_renamed_SDL_PIXELFORMAT_XRGB8888
|
||||
#define SDL_PixelFormatEnumToMasks SDL_PixelFormatEnumToMasks_renamed_SDL_GetMasksForPixelFormatEnum
|
||||
#define SDL_PixelFormatEnumToMasks SDL_PixelFormatEnumToMasks_renamed_SDL_GetMasksForPixelFormat
|
||||
|
||||
/* ##SDL_rect.h */
|
||||
#define SDL_EncloseFPoints SDL_EncloseFPoints_renamed_SDL_GetRectEnclosingPointsFloat
|
||||
@@ -1175,6 +1176,7 @@
|
||||
|
||||
/* ##SDL_surface.h */
|
||||
#define SDL_BlitScaled SDL_BlitScaled_renamed_SDL_BlitSurfaceScaled
|
||||
#define SDL_ConvertSurfaceFormat SDL_ConvertSurfaceFormat_renamed_SDL_ConvertSurface
|
||||
#define SDL_FillRect SDL_FillRect_renamed_SDL_FillSurfaceRect
|
||||
#define SDL_FillRects SDL_FillRects_renamed_SDL_FillSurfaceRects
|
||||
#define SDL_FreeSurface SDL_FreeSurface_renamed_SDL_DestroySurface
|
||||
@@ -1185,6 +1187,8 @@
|
||||
#define SDL_LoadBMP_RW SDL_LoadBMP_RW_renamed_SDL_LoadBMP_IO
|
||||
#define SDL_LowerBlit SDL_LowerBlit_renamed_SDL_BlitSurfaceUnchecked
|
||||
#define SDL_LowerBlitScaled SDL_LowerBlitScaled_renamed_SDL_BlitSurfaceUncheckedScaled
|
||||
#define SDL_PREALLOC SDL_PREALLOC_renamed_SDL_SURFACE_PREALLOCATED
|
||||
#define SDL_SIMD_ALIGNED SDL_SIMD_ALIGNED_renamed_SDL_SURFACE_SIMD_ALIGNED
|
||||
#define SDL_SaveBMP_RW SDL_SaveBMP_RW_renamed_SDL_SaveBMP_IO
|
||||
#define SDL_SetClipRect SDL_SetClipRect_renamed_SDL_SetSurfaceClipRect
|
||||
#define SDL_SetColorKey SDL_SetColorKey_renamed_SDL_SetSurfaceColorKey
|
||||
|
||||
+69
-98
@@ -133,7 +133,8 @@ typedef enum SDL_PackedLayout
|
||||
#define SDL_PIXELTYPE(X) (((X) >> 24) & 0x0F)
|
||||
#define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F)
|
||||
#define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F)
|
||||
#define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF)
|
||||
#define SDL_BITSPERPIXEL(X) \
|
||||
(SDL_ISPIXELFORMAT_FOURCC(X) ? 0 : (((X) >> 8) & 0xFF))
|
||||
#define SDL_BYTESPERPIXEL(X) \
|
||||
(SDL_ISPIXELFORMAT_FOURCC(X) ? \
|
||||
((((X) == SDL_PIXELFORMAT_YUY2) || \
|
||||
@@ -222,7 +223,7 @@ typedef enum SDL_PackedLayout
|
||||
*
|
||||
* \since This enum is available since SDL 3.0.0.
|
||||
*/
|
||||
typedef enum SDL_PixelFormatEnum
|
||||
typedef enum SDL_PixelFormat
|
||||
{
|
||||
SDL_PIXELFORMAT_UNKNOWN,
|
||||
SDL_PIXELFORMAT_INDEX1LSB =
|
||||
@@ -426,7 +427,7 @@ typedef enum SDL_PixelFormatEnum
|
||||
SDL_DEFINE_PIXELFOURCC('P', '0', '1', '0'),
|
||||
SDL_PIXELFORMAT_EXTERNAL_OES = /**< Android video texture format */
|
||||
SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ')
|
||||
} SDL_PixelFormatEnum;
|
||||
} SDL_PixelFormat;
|
||||
|
||||
/**
|
||||
* Pixels are a representation of a color in a particular color space.
|
||||
@@ -721,7 +722,6 @@ typedef struct SDL_FColor
|
||||
*
|
||||
* \since This struct is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_PixelFormat
|
||||
* \sa SDL_SetPaletteColors
|
||||
*/
|
||||
typedef struct SDL_Palette
|
||||
@@ -735,15 +735,11 @@ typedef struct SDL_Palette
|
||||
/**
|
||||
* Details about the format of a pixel.
|
||||
*
|
||||
* Generally this is used with SDL_Surface, and covers many possible
|
||||
* configurations, including paletted data and various bit patterns.
|
||||
*
|
||||
* \since This struct is available since SDL 3.0.0.
|
||||
*/
|
||||
typedef struct SDL_PixelFormat
|
||||
typedef struct SDL_PixelFormatDetails
|
||||
{
|
||||
SDL_PixelFormatEnum format;
|
||||
SDL_Palette *palette;
|
||||
SDL_PixelFormat format;
|
||||
Uint8 bits_per_pixel;
|
||||
Uint8 bytes_per_pixel;
|
||||
Uint8 padding[2];
|
||||
@@ -751,17 +747,15 @@ typedef struct SDL_PixelFormat
|
||||
Uint32 Gmask;
|
||||
Uint32 Bmask;
|
||||
Uint32 Amask;
|
||||
Uint8 Rloss;
|
||||
Uint8 Gloss;
|
||||
Uint8 Bloss;
|
||||
Uint8 Aloss;
|
||||
Uint8 Rbits;
|
||||
Uint8 Gbits;
|
||||
Uint8 Bbits;
|
||||
Uint8 Abits;
|
||||
Uint8 Rshift;
|
||||
Uint8 Gshift;
|
||||
Uint8 Bshift;
|
||||
Uint8 Ashift;
|
||||
int refcount;
|
||||
struct SDL_PixelFormat *next;
|
||||
} SDL_PixelFormat;
|
||||
} SDL_PixelFormatDetails;
|
||||
|
||||
/**
|
||||
* Get the human readable name of a pixel format.
|
||||
@@ -772,32 +766,31 @@ typedef struct SDL_PixelFormat
|
||||
* \returns the human readable name of the specified pixel format or
|
||||
* `SDL_PIXELFORMAT_UNKNOWN` if the format isn't recognized.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(SDL_PixelFormatEnum format);
|
||||
extern SDL_DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(SDL_PixelFormat format);
|
||||
|
||||
/**
|
||||
* Convert one of the enumerated pixel formats to a bpp value and RGBA masks.
|
||||
*
|
||||
* \param format one of the SDL_PixelFormatEnum values.
|
||||
* \param format one of the SDL_PixelFormat values.
|
||||
* \param bpp a bits per pixel value; usually 15, 16, or 32.
|
||||
* \param Rmask a pointer filled in with the red mask for the format.
|
||||
* \param Gmask a pointer filled in with the green mask for the format.
|
||||
* \param Bmask a pointer filled in with the blue mask for the format.
|
||||
* \param Amask a pointer filled in with the alpha mask for the format.
|
||||
* \returns SDL_TRUE on success or SDL_FALSE if the conversion wasn't
|
||||
* possible; call SDL_GetError() for more information.
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetPixelFormatEnumForMasks
|
||||
* \sa SDL_GetPixelFormatForMasks
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetMasksForPixelFormatEnum(SDL_PixelFormatEnum format,
|
||||
int *bpp,
|
||||
Uint32 * Rmask,
|
||||
Uint32 * Gmask,
|
||||
Uint32 * Bmask,
|
||||
Uint32 * Amask);
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_GetMasksForPixelFormat(SDL_PixelFormat format, int *bpp, Uint32 *Rmask, Uint32 *Gmask, Uint32 *Bmask, Uint32 *Amask);
|
||||
|
||||
/**
|
||||
* Convert a bpp value and RGBA masks to an enumerated pixel format.
|
||||
@@ -810,47 +803,33 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetMasksForPixelFormatEnum(SDL_PixelFor
|
||||
* \param Gmask the green mask for the format.
|
||||
* \param Bmask the blue mask for the format.
|
||||
* \param Amask the alpha mask for the format.
|
||||
* \returns the SDL_PixelFormatEnum value corresponding to the format masks,
|
||||
* \returns the SDL_PixelFormat value corresponding to the format masks,
|
||||
* or SDL_PIXELFORMAT_UNKNOWN if there isn't a match.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetMasksForPixelFormatEnum
|
||||
* \sa SDL_GetMasksForPixelFormat
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_PixelFormatEnum SDLCALL SDL_GetPixelFormatEnumForMasks(int bpp,
|
||||
Uint32 Rmask,
|
||||
Uint32 Gmask,
|
||||
Uint32 Bmask,
|
||||
Uint32 Amask);
|
||||
extern SDL_DECLSPEC SDL_PixelFormat SDLCALL SDL_GetPixelFormatForMasks(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
|
||||
|
||||
/**
|
||||
* Create an SDL_PixelFormat structure corresponding to a pixel format.
|
||||
* Create an SDL_PixelFormatDetails structure corresponding to a pixel format.
|
||||
*
|
||||
* Returned structure may come from a shared global cache (i.e. not newly
|
||||
* allocated), and hence should not be modified, especially the palette. Weird
|
||||
* errors such as `Blit combination not supported` may occur.
|
||||
*
|
||||
* \param pixel_format one of the SDL_PixelFormatEnum values.
|
||||
* \returns the new SDL_PixelFormat structure or NULL on failure; call
|
||||
* \param format one of the SDL_PixelFormat values.
|
||||
* \returns a pointer to a SDL_PixelFormatDetails structure or NULL on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_DestroyPixelFormat
|
||||
* \sa SDL_SetPixelFormatPalette
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_PixelFormat * SDLCALL SDL_CreatePixelFormat(SDL_PixelFormatEnum pixel_format);
|
||||
|
||||
/**
|
||||
* Free an SDL_PixelFormat structure allocated by SDL_CreatePixelFormat().
|
||||
*
|
||||
* \param format the SDL_PixelFormat structure to free.
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_CreatePixelFormat
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_DestroyPixelFormat(SDL_PixelFormat *format);
|
||||
extern SDL_DECLSPEC const SDL_PixelFormatDetails * SDLCALL SDL_GetPixelFormatDetails(SDL_PixelFormat format);
|
||||
|
||||
/**
|
||||
* Create a palette structure with the specified number of color entries.
|
||||
@@ -862,27 +841,16 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyPixelFormat(SDL_PixelFormat *format)
|
||||
* there wasn't enough memory); call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_DestroyPalette
|
||||
* \sa SDL_SetPaletteColors
|
||||
* \sa SDL_SetPixelFormatPalette
|
||||
* \sa SDL_SetSurfacePalette
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_Palette *SDLCALL SDL_CreatePalette(int ncolors);
|
||||
|
||||
/**
|
||||
* Set the palette for a pixel format structure.
|
||||
*
|
||||
* \param format the SDL_PixelFormat structure that will use the palette.
|
||||
* \param palette the SDL_Palette structure that will be used.
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_SetPixelFormatPalette(SDL_PixelFormat * format,
|
||||
SDL_Palette *palette);
|
||||
|
||||
/**
|
||||
* Set a range of colors in a palette.
|
||||
*
|
||||
@@ -893,22 +861,24 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetPixelFormatPalette(SDL_PixelFormat * form
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread, as long as the palette is not modified or destroyed in another thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette,
|
||||
const SDL_Color * colors,
|
||||
int firstcolor, int ncolors);
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette *palette, const SDL_Color *colors, int firstcolor, int ncolors);
|
||||
|
||||
/**
|
||||
* Free a palette created with SDL_CreatePalette().
|
||||
*
|
||||
* \param palette the SDL_Palette structure to be freed.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread, as long as the palette is not modified or destroyed in another thread.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_CreatePalette
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_DestroyPalette(SDL_Palette * palette);
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_DestroyPalette(SDL_Palette *palette);
|
||||
|
||||
/**
|
||||
* Map an RGB triple to an opaque pixel value for a given pixel format.
|
||||
@@ -928,20 +898,22 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyPalette(SDL_Palette * palette);
|
||||
* format the return value can be assigned to a Uint16, and similarly a Uint8
|
||||
* for an 8-bpp format).
|
||||
*
|
||||
* \param format an SDL_PixelFormat structure describing the pixel format.
|
||||
* \param format a pointer to SDL_PixelFormatDetails describing the pixel format.
|
||||
* \param palette an optional palette for indexed formats, may be NULL.
|
||||
* \param r the red component of the pixel in the range 0-255.
|
||||
* \param g the green component of the pixel in the range 0-255.
|
||||
* \param b the blue component of the pixel in the range 0-255.
|
||||
* \returns a pixel value.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread, as long as the palette is not modified.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetRGB
|
||||
* \sa SDL_GetRGBA
|
||||
* \sa SDL_MapRGBA
|
||||
* \sa SDL_MapSurfaceRGB
|
||||
*/
|
||||
extern SDL_DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format,
|
||||
Uint8 r, Uint8 g, Uint8 b);
|
||||
extern SDL_DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormatDetails *format, const SDL_Palette *palette, Uint8 r, Uint8 g, Uint8 b);
|
||||
|
||||
/**
|
||||
* Map an RGBA quadruple to a pixel value for a given pixel format.
|
||||
@@ -961,23 +933,23 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format,
|
||||
* format the return value can be assigned to a Uint16, and similarly a Uint8
|
||||
* for an 8-bpp format).
|
||||
*
|
||||
* \param format an SDL_PixelFormat structure describing the format of the
|
||||
* pixel.
|
||||
* \param format a pointer to SDL_PixelFormatDetails describing the pixel format.
|
||||
* \param palette an optional palette for indexed formats, may be NULL.
|
||||
* \param r the red component of the pixel in the range 0-255.
|
||||
* \param g the green component of the pixel in the range 0-255.
|
||||
* \param b the blue component of the pixel in the range 0-255.
|
||||
* \param a the alpha component of the pixel in the range 0-255.
|
||||
* \returns a pixel value.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread, as long as the palette is not modified.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetRGB
|
||||
* \sa SDL_GetRGBA
|
||||
* \sa SDL_MapRGB
|
||||
* \sa SDL_MapSurfaceRGBA
|
||||
*/
|
||||
extern SDL_DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format,
|
||||
Uint8 r, Uint8 g, Uint8 b,
|
||||
Uint8 a);
|
||||
extern SDL_DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormatDetails *format, const SDL_Palette *palette, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
|
||||
/**
|
||||
* Get RGB values from a pixel in the specified format.
|
||||
@@ -988,11 +960,13 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format,
|
||||
* 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).
|
||||
*
|
||||
* \param pixel a pixel value.
|
||||
* \param format an SDL_PixelFormat structure describing the format of the
|
||||
* pixel.
|
||||
* \param r a pointer filled in with the red component.
|
||||
* \param g a pointer filled in with the green component.
|
||||
* \param b a pointer filled in with the blue component.
|
||||
* \param format a pointer to SDL_PixelFormatDetails describing the pixel format.
|
||||
* \param palette an optional palette for indexed formats, may be NULL.
|
||||
* \param r a pointer filled in with the red component, may be NULL.
|
||||
* \param g a pointer filled in with the green component, may be NULL.
|
||||
* \param b a pointer filled in with the blue component, may be NULL.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread, as long as the palette is not modified.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
@@ -1000,9 +974,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format,
|
||||
* \sa SDL_MapRGB
|
||||
* \sa SDL_MapRGBA
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
|
||||
const SDL_PixelFormat * format,
|
||||
Uint8 * r, Uint8 * g, Uint8 * b);
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, const SDL_PixelFormatDetails *format, const SDL_Palette *palette, Uint8 *r, Uint8 *g, Uint8 *b);
|
||||
|
||||
/**
|
||||
* Get RGBA values from a pixel in the specified format.
|
||||
@@ -1016,12 +988,14 @@ extern SDL_DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
|
||||
* (100% opaque).
|
||||
*
|
||||
* \param pixel a pixel value.
|
||||
* \param format an SDL_PixelFormat structure describing the format of the
|
||||
* pixel.
|
||||
* \param r a pointer filled in with the red component.
|
||||
* \param g a pointer filled in with the green component.
|
||||
* \param b a pointer filled in with the blue component.
|
||||
* \param a a pointer filled in with the alpha component.
|
||||
* \param format a pointer to SDL_PixelFormatDetails describing the pixel format.
|
||||
* \param palette an optional palette for indexed formats, may be NULL.
|
||||
* \param r a pointer filled in with the red component, may be NULL.
|
||||
* \param g a pointer filled in with the green component, may be NULL.
|
||||
* \param b a pointer filled in with the blue component, may be NULL.
|
||||
* \param a a pointer filled in with the alpha component, may be NULL.
|
||||
*
|
||||
* \threadsafety It is safe to call this function from any thread, as long as the palette is not modified.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
@@ -1029,10 +1003,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
|
||||
* \sa SDL_MapRGB
|
||||
* \sa SDL_MapRGBA
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
|
||||
const SDL_PixelFormat * format,
|
||||
Uint8 * r, Uint8 * g, Uint8 * b,
|
||||
Uint8 * a);
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, const SDL_PixelFormatDetails *format, const SDL_Palette *palette, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
|
||||
@@ -350,8 +350,7 @@ extern SDL_DECLSPEC const char *SDLCALL SDL_GetRendererName(SDL_Renderer *render
|
||||
* - `SDL_PROP_RENDERER_VSYNC_NUMBER`: the current vsync setting
|
||||
* - `SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER`: the maximum texture width
|
||||
* and height
|
||||
* - `SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER`: a (const SDL_PixelFormatEnum
|
||||
* *) array of pixel formats, terminated with SDL_PIXELFORMAT_UNKNOWN,
|
||||
* - `SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER`: a (const SDL_PixelFormat *) array of pixel formats, terminated with SDL_PIXELFORMAT_UNKNOWN,
|
||||
* representing the available texture formats for this renderer.
|
||||
* - `SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER`: an SDL_ColorSpace value
|
||||
* describing the colorspace for output to the display, defaults to
|
||||
@@ -485,7 +484,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetCurrentRenderOutputSize(SDL_Renderer *ren
|
||||
* Create a texture for a rendering context.
|
||||
*
|
||||
* \param renderer the rendering context.
|
||||
* \param format one of the enumerated values in SDL_PixelFormatEnum.
|
||||
* \param format one of the enumerated values in SDL_PixelFormat.
|
||||
* \param access one of the enumerated values in SDL_TextureAccess.
|
||||
* \param w the width of the texture in pixels.
|
||||
* \param h the height of the texture in pixels.
|
||||
@@ -501,7 +500,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetCurrentRenderOutputSize(SDL_Renderer *ren
|
||||
* \sa SDL_GetTextureSize
|
||||
* \sa SDL_UpdateTexture
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_Texture *SDLCALL SDL_CreateTexture(SDL_Renderer *renderer, SDL_PixelFormatEnum format, int access, int w, int h);
|
||||
extern SDL_DECLSPEC SDL_Texture *SDLCALL SDL_CreateTexture(SDL_Renderer *renderer, SDL_PixelFormat format, int access, int w, int h);
|
||||
|
||||
/**
|
||||
* Create a texture from an existing surface.
|
||||
@@ -540,7 +539,7 @@ extern SDL_DECLSPEC SDL_Texture *SDLCALL SDL_CreateTextureFromSurface(SDL_Render
|
||||
* SDL_COLORSPACE_SRGB for other RGB textures and SDL_COLORSPACE_JPEG for
|
||||
* YUV textures.
|
||||
* - `SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER`: one of the enumerated values in
|
||||
* SDL_PixelFormatEnum, defaults to the best RGBA format for the renderer
|
||||
* SDL_PixelFormat, defaults to the best RGBA format for the renderer
|
||||
* - `SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER`: one of the enumerated values in
|
||||
* SDL_TextureAccess, defaults to SDL_TEXTUREACCESS_STATIC
|
||||
* - `SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER`: the width of the texture in
|
||||
@@ -672,7 +671,7 @@ extern SDL_DECLSPEC SDL_Texture *SDLCALL SDL_CreateTextureWithProperties(SDL_Ren
|
||||
* - `SDL_PROP_TEXTURE_COLORSPACE_NUMBER`: an SDL_ColorSpace value describing
|
||||
* the texture colorspace.
|
||||
* - `SDL_PROP_TEXTURE_FORMAT_NUMBER`: one of the enumerated values in
|
||||
* SDL_PixelFormatEnum.
|
||||
* SDL_PixelFormat.
|
||||
* - `SDL_PROP_TEXTURE_ACCESS_NUMBER`: one of the enumerated values in
|
||||
* SDL_TextureAccess.
|
||||
* - `SDL_PROP_TEXTURE_WIDTH_NUMBER`: the width of the texture in pixels.
|
||||
|
||||
+127
-93
@@ -45,34 +45,23 @@ extern "C" {
|
||||
/**
|
||||
* The flags on an SDL_Surface.
|
||||
*
|
||||
* These are generally meant to be considered read-only.
|
||||
* These are generally considered read-only.
|
||||
*
|
||||
* \since This datatype is available since SDL 3.0.0.
|
||||
*/
|
||||
typedef Uint32 SDL_SurfaceFlags;
|
||||
|
||||
#define SDL_PREALLOC 0x00000001u /**< Surface uses preallocated memory */
|
||||
#define SDL_RLEACCEL 0x00000002u /**< Surface is RLE encoded */
|
||||
#define SDL_DONTFREE 0x00000004u /**< Surface is referenced internally */
|
||||
#define SDL_SIMD_ALIGNED 0x00000008u /**< Surface uses aligned memory */
|
||||
#define SDL_SURFACE_USES_PROPERTIES 0x00000010u /**< Surface uses properties */
|
||||
#define SDL_SURFACE_PREALLOCATED 0x00000001u /**< Surface uses preallocated pixel memory */
|
||||
#define SDL_SURFACE_LOCK_NEEDED 0x00000002u /**< Surface needs to be locked to access pixels */
|
||||
#define SDL_SURFACE_LOCKED 0x00000004u /**< Surface is currently locked */
|
||||
#define SDL_SURFACE_SIMD_ALIGNED 0x00000008u /**< Surface uses pixel memory allocated with SDL_aligned_alloc() */
|
||||
|
||||
/**
|
||||
* Evaluates to true if the surface needs to be locked before access.
|
||||
*
|
||||
* \since This macro is available since SDL 3.0.0.
|
||||
*/
|
||||
#define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0)
|
||||
|
||||
/**
|
||||
* An opaque type used in SDL_Surface.
|
||||
*
|
||||
* This is used by SDL to keep track of how blit operations should work
|
||||
* internally; it is not for use directly by applications.
|
||||
*
|
||||
* \since This struct is available since SDL 3.0.0.
|
||||
*/
|
||||
typedef struct SDL_BlitMap SDL_BlitMap;
|
||||
#define SDL_MUSTLOCK(S) (((S)->flags & (SDL_SURFACE_LOCK_NEEDED | SDL_SURFACE_LOCKED)) == SDL_SURFACE_LOCK_NEEDED)
|
||||
|
||||
/**
|
||||
* The scaling mode.
|
||||
@@ -98,6 +87,9 @@ typedef enum SDL_FlipMode
|
||||
SDL_FLIP_VERTICAL /**< flip vertically */
|
||||
} SDL_FlipMode;
|
||||
|
||||
/* Internal surface data */
|
||||
typedef struct SDL_SurfaceData SDL_SurfaceData;
|
||||
|
||||
/**
|
||||
* A collection of pixels used in software blitting.
|
||||
*
|
||||
@@ -118,36 +110,24 @@ typedef enum SDL_FlipMode
|
||||
typedef struct SDL_Surface
|
||||
{
|
||||
SDL_SurfaceFlags flags; /**< Read-only */
|
||||
SDL_PixelFormat *format; /**< Read-only */
|
||||
SDL_PixelFormat format; /**< Read-only */
|
||||
int w, h; /**< Read-only */
|
||||
int pitch; /**< Read-only */
|
||||
void *pixels; /**< Read-write */
|
||||
void *pixels; /**< Read-only pointer, writable pixels if non-NULL */
|
||||
|
||||
void *reserved; /**< Private */
|
||||
int refcount; /**< Application reference count, used when freeing surface */
|
||||
|
||||
/** information needed for surfaces requiring locks */
|
||||
int locked; /**< Read-only */
|
||||
SDL_SurfaceData *internal; /**< Private */
|
||||
|
||||
/** list of BlitMap that hold a reference to this surface */
|
||||
void *list_blitmap; /**< Private */
|
||||
|
||||
/** clipping information */
|
||||
SDL_Rect clip_rect; /**< Read-only */
|
||||
|
||||
/** info for fast blit mapping to other surfaces */
|
||||
SDL_BlitMap *map; /**< Private */
|
||||
|
||||
/** Reference count -- used when freeing surface */
|
||||
int refcount; /**< Read-mostly */
|
||||
} SDL_Surface;
|
||||
|
||||
|
||||
/**
|
||||
* Allocate a new RGB surface with a specific pixel format.
|
||||
* Allocate a new surface with a specific pixel format.
|
||||
*
|
||||
* \param width the width of the surface.
|
||||
* \param height the height of the surface.
|
||||
* \param format the SDL_PixelFormatEnum for the new surface's pixel format.
|
||||
* \param format the SDL_PixelFormat for the new surface's pixel format.
|
||||
* \returns the new SDL_Surface structure that is created or NULL if it fails;
|
||||
* call SDL_GetError() for more information.
|
||||
*
|
||||
@@ -156,11 +136,10 @@ typedef struct SDL_Surface
|
||||
* \sa SDL_CreateSurfaceFrom
|
||||
* \sa SDL_DestroySurface
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_Surface *SDLCALL SDL_CreateSurface(int width, int height, SDL_PixelFormatEnum format);
|
||||
extern SDL_DECLSPEC SDL_Surface *SDLCALL SDL_CreateSurface(int width, int height, SDL_PixelFormat format);
|
||||
|
||||
/**
|
||||
* Allocate a new RGB surface with a specific pixel format and existing pixel
|
||||
* data.
|
||||
* Allocate a new surface with a specific pixel format and existing pixel data.
|
||||
*
|
||||
* No copy is made of the pixel data. Pixel data is not managed automatically;
|
||||
* you must free the surface before you free the pixel data.
|
||||
@@ -171,11 +150,11 @@ extern SDL_DECLSPEC SDL_Surface *SDLCALL SDL_CreateSurface(int width, int height
|
||||
* You may pass NULL for pixels and 0 for pitch to create a surface that you
|
||||
* will fill in with valid values later.
|
||||
*
|
||||
* \param pixels a pointer to existing pixel data.
|
||||
* \param width the width of the surface.
|
||||
* \param height the height of the surface.
|
||||
* \param format the SDL_PixelFormat for the new surface's pixel format.
|
||||
* \param pixels a pointer to existing pixel data.
|
||||
* \param pitch the number of bytes between each row, including padding.
|
||||
* \param format the SDL_PixelFormatEnum for the new surface's pixel format.
|
||||
* \returns the new SDL_Surface structure that is created or NULL if it fails;
|
||||
* call SDL_GetError() for more information.
|
||||
*
|
||||
@@ -184,10 +163,10 @@ extern SDL_DECLSPEC SDL_Surface *SDLCALL SDL_CreateSurface(int width, int height
|
||||
* \sa SDL_CreateSurface
|
||||
* \sa SDL_DestroySurface
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_Surface *SDLCALL SDL_CreateSurfaceFrom(void *pixels, int width, int height, int pitch, SDL_PixelFormatEnum format);
|
||||
extern SDL_DECLSPEC SDL_Surface *SDLCALL SDL_CreateSurfaceFrom(int width, int height, SDL_PixelFormat format, void *pixels, int pitch);
|
||||
|
||||
/**
|
||||
* Free an RGB surface.
|
||||
* Free a surface.
|
||||
*
|
||||
* It is safe to pass NULL to this function.
|
||||
*
|
||||
@@ -195,6 +174,7 @@ extern SDL_DECLSPEC SDL_Surface *SDLCALL SDL_CreateSurfaceFrom(void *pixels, int
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_CreateStackSurface
|
||||
* \sa SDL_CreateSurface
|
||||
* \sa SDL_CreateSurfaceFrom
|
||||
*/
|
||||
@@ -254,6 +234,8 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetSurfaceProperties(SDL_Surfac
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetSurfaceColorspace
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_SetSurfaceColorspace(SDL_Surface *surface, SDL_Colorspace colorspace);
|
||||
|
||||
@@ -265,14 +247,13 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetSurfaceColorspace(SDL_Surface *surface, S
|
||||
* other RGB surfaces and SDL_COLORSPACE_BT709_FULL for YUV textures.
|
||||
*
|
||||
* \param surface the SDL_Surface structure to query.
|
||||
* \param colorspace a pointer filled in with an SDL_ColorSpace value
|
||||
* describing the surface colorspace.
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
* \returns the colorspace used by the surface, or SDL_COLORSPACE_UNKNOWN if the surface is NULL.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_SetSurfaceColorspace
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_GetSurfaceColorspace(SDL_Surface *surface, SDL_Colorspace *colorspace);
|
||||
extern SDL_DECLSPEC SDL_Colorspace SDLCALL SDL_GetSurfaceColorspace(SDL_Surface *surface);
|
||||
|
||||
/**
|
||||
* Set the palette used by a surface.
|
||||
@@ -285,9 +266,24 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetSurfaceColorspace(SDL_Surface *surface, S
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_CreatePalette
|
||||
* \sa SDL_GetSurfacePalette
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette);
|
||||
|
||||
/**
|
||||
* Get the palette used by a surface.
|
||||
*
|
||||
* \param surface the SDL_Surface structure to query.
|
||||
* \returns a pointer to the palette used by the surface, or NULL if there is no palette used.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_SetSurfacePalette
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_Palette * SDLCALL SDL_GetSurfacePalette(SDL_Surface *surface);
|
||||
|
||||
/**
|
||||
* Set up a surface for directly accessing the pixels.
|
||||
*
|
||||
@@ -411,7 +407,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SaveBMP(SDL_Surface *surface, const char *fi
|
||||
* the surface must be locked before directly accessing the pixels.
|
||||
*
|
||||
* \param surface the SDL_Surface structure to optimize.
|
||||
* \param flag 0 to disable, non-zero to enable RLE acceleration.
|
||||
* \param enabled SDL_TRUE to enable RLE acceleration, SDL_FALSE to disable it.
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
@@ -421,7 +417,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SaveBMP(SDL_Surface *surface, const char *fi
|
||||
* \sa SDL_LockSurface
|
||||
* \sa SDL_UnlockSurface
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface *surface, int flag);
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface *surface, SDL_bool enabled);
|
||||
|
||||
/**
|
||||
* Returns whether the surface is RLE enabled.
|
||||
@@ -447,11 +443,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SurfaceHasRLE(SDL_Surface *surface);
|
||||
* It is a pixel of the format used by the surface, as generated by
|
||||
* SDL_MapRGB().
|
||||
*
|
||||
* RLE acceleration can substantially speed up blitting of images with large
|
||||
* horizontal runs of transparent pixels. See SDL_SetSurfaceRLE() for details.
|
||||
*
|
||||
* \param surface the SDL_Surface structure to update.
|
||||
* \param flag SDL_TRUE to enable color key, SDL_FALSE to disable color key.
|
||||
* \param enabled SDL_TRUE to enable color key, SDL_FALSE to disable color key.
|
||||
* \param key the transparent pixel.
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
@@ -459,9 +452,10 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SurfaceHasRLE(SDL_Surface *surface);
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetSurfaceColorKey
|
||||
* \sa SDL_SetSurfaceRLE
|
||||
* \sa SDL_SurfaceHasColorKey
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_SetSurfaceColorKey(SDL_Surface *surface, int flag, Uint32 key);
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_SetSurfaceColorKey(SDL_Surface *surface, SDL_bool enabled, Uint32 key);
|
||||
|
||||
/**
|
||||
* Returns whether the surface has a color key.
|
||||
@@ -681,41 +675,19 @@ extern SDL_DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface *surfa
|
||||
* surface. The new, optimized surface can then be used as the source for
|
||||
* future blits, making them faster.
|
||||
*
|
||||
* If you are converting to an indexed surface and want to map colors to a palette, you can use SDL_ConvertSurfaceAndColorspace() instead.
|
||||
*
|
||||
* \param surface the existing SDL_Surface structure to convert.
|
||||
* \param format the SDL_PixelFormat structure that the new surface is
|
||||
* optimized for.
|
||||
* \param format the new pixel format.
|
||||
* \returns the new SDL_Surface structure that is created or NULL if it fails;
|
||||
* call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_ConvertSurfaceFormat
|
||||
* \sa SDL_ConvertSurfaceFormatAndColorspace
|
||||
* \sa SDL_CreatePixelFormat
|
||||
* \sa SDL_ConvertSurfaceAndColorspace
|
||||
* \sa SDL_DestroySurface
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface(SDL_Surface *surface, const SDL_PixelFormat *format);
|
||||
|
||||
/**
|
||||
* Copy an existing surface to a new surface of the specified format.
|
||||
*
|
||||
* This function operates just like SDL_ConvertSurface(), but accepts an
|
||||
* SDL_PixelFormatEnum value instead of an SDL_PixelFormat structure. As such,
|
||||
* it might be easier to call but it doesn't have access to palette
|
||||
* information for the destination surface, in case that would be important.
|
||||
*
|
||||
* \param surface the existing SDL_Surface structure to convert.
|
||||
* \param pixel_format the new pixel format.
|
||||
* \returns the new SDL_Surface structure that is created or NULL if it fails;
|
||||
* call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_ConvertSurface
|
||||
* \sa SDL_ConvertSurfaceFormatAndColorspace
|
||||
* \sa SDL_DestroySurface
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat(SDL_Surface *surface, SDL_PixelFormatEnum pixel_format);
|
||||
extern SDL_DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface(SDL_Surface *surface, SDL_PixelFormat format);
|
||||
|
||||
/**
|
||||
* Copy an existing surface to a new surface of the specified format and
|
||||
@@ -726,7 +698,8 @@ extern SDL_DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat(SDL_Surface *s
|
||||
* colorspace conversion needed.
|
||||
*
|
||||
* \param surface the existing SDL_Surface structure to convert.
|
||||
* \param pixel_format the new pixel format.
|
||||
* \param format the new pixel format.
|
||||
* \param palette an optional palette to use for indexed formats, may be NULL.
|
||||
* \param colorspace the new colorspace.
|
||||
* \param props an SDL_PropertiesID with additional color properties, or 0.
|
||||
* \returns the new SDL_Surface structure that is created or NULL if it fails;
|
||||
@@ -735,20 +708,20 @@ extern SDL_DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat(SDL_Surface *s
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_ConvertSurface
|
||||
* \sa SDL_ConvertSurfaceFormat
|
||||
* \sa SDL_ConvertSurface
|
||||
* \sa SDL_DestroySurface
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormatAndColorspace(SDL_Surface *surface, SDL_PixelFormatEnum pixel_format, SDL_Colorspace colorspace, SDL_PropertiesID props);
|
||||
extern SDL_DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceAndColorspace(SDL_Surface *surface, SDL_PixelFormat format, const SDL_Palette *palette, SDL_Colorspace colorspace, SDL_PropertiesID props);
|
||||
|
||||
/**
|
||||
* Copy a block of pixels of one format to another format.
|
||||
*
|
||||
* \param width the width of the block to copy, in pixels.
|
||||
* \param height the height of the block to copy, in pixels.
|
||||
* \param src_format an SDL_PixelFormatEnum value of the `src` pixels format.
|
||||
* \param src_format an SDL_PixelFormat value of the `src` pixels format.
|
||||
* \param src a pointer to the source pixels.
|
||||
* \param src_pitch the pitch of the source pixels, in bytes.
|
||||
* \param dst_format an SDL_PixelFormatEnum value of the `dst` pixels format.
|
||||
* \param dst_format an SDL_PixelFormat value of the `dst` pixels format.
|
||||
* \param dst a pointer to be filled in with new pixel data.
|
||||
* \param dst_pitch the pitch of the destination pixels, in bytes.
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
@@ -758,7 +731,7 @@ extern SDL_DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormatAndColorspace(S
|
||||
*
|
||||
* \sa SDL_ConvertPixelsAndColorspace
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height, SDL_PixelFormatEnum src_format, const void *src, int src_pitch, SDL_PixelFormatEnum dst_format, void *dst, int dst_pitch);
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height, SDL_PixelFormat src_format, const void *src, int src_pitch, SDL_PixelFormat dst_format, void *dst, int dst_pitch);
|
||||
|
||||
/**
|
||||
* Copy a block of pixels of one format and colorspace to another format and
|
||||
@@ -766,14 +739,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height, SDL_Pix
|
||||
*
|
||||
* \param width the width of the block to copy, in pixels.
|
||||
* \param height the height of the block to copy, in pixels.
|
||||
* \param src_format an SDL_PixelFormatEnum value of the `src` pixels format.
|
||||
* \param src_format an SDL_PixelFormat value of the `src` pixels format.
|
||||
* \param src_colorspace an SDL_ColorSpace value describing the colorspace of
|
||||
* the `src` pixels.
|
||||
* \param src_properties an SDL_PropertiesID with additional source color
|
||||
* properties, or 0.
|
||||
* \param src a pointer to the source pixels.
|
||||
* \param src_pitch the pitch of the source pixels, in bytes.
|
||||
* \param dst_format an SDL_PixelFormatEnum value of the `dst` pixels format.
|
||||
* \param dst_format an SDL_PixelFormat value of the `dst` pixels format.
|
||||
* \param dst_colorspace an SDL_ColorSpace value describing the colorspace of
|
||||
* the `dst` pixels.
|
||||
* \param dst_properties an SDL_PropertiesID with additional destination color
|
||||
@@ -787,7 +760,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height, SDL_Pix
|
||||
*
|
||||
* \sa SDL_ConvertPixels
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_ConvertPixelsAndColorspace(int width, int height, SDL_PixelFormatEnum src_format, SDL_Colorspace src_colorspace, SDL_PropertiesID src_properties, const void *src, int src_pitch, SDL_PixelFormatEnum dst_format, SDL_Colorspace dst_colorspace, SDL_PropertiesID dst_properties, void *dst, int dst_pitch);
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_ConvertPixelsAndColorspace(int width, int height, SDL_PixelFormat src_format, SDL_Colorspace src_colorspace, SDL_PropertiesID src_properties, const void *src, int src_pitch, SDL_PixelFormat dst_format, SDL_Colorspace dst_colorspace, SDL_PropertiesID dst_properties, void *dst, int dst_pitch);
|
||||
|
||||
/**
|
||||
* Premultiply the alpha on a block of pixels.
|
||||
@@ -798,10 +771,10 @@ extern SDL_DECLSPEC int SDLCALL SDL_ConvertPixelsAndColorspace(int width, int he
|
||||
*
|
||||
* \param width the width of the block to convert, in pixels.
|
||||
* \param height the height of the block to convert, in pixels.
|
||||
* \param src_format an SDL_PixelFormatEnum value of the `src` pixels format.
|
||||
* \param src_format an SDL_PixelFormat value of the `src` pixels format.
|
||||
* \param src a pointer to the source pixels.
|
||||
* \param src_pitch the pitch of the source pixels, in bytes.
|
||||
* \param dst_format an SDL_PixelFormatEnum value of the `dst` pixels format.
|
||||
* \param dst_format an SDL_PixelFormat value of the `dst` pixels format.
|
||||
* \param dst a pointer to be filled in with premultiplied pixel data.
|
||||
* \param dst_pitch the pitch of the destination pixels, in bytes.
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
@@ -809,7 +782,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_ConvertPixelsAndColorspace(int width, int he
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_PremultiplyAlpha(int width, int height, SDL_PixelFormatEnum src_format, const void *src, int src_pitch, SDL_PixelFormatEnum dst_format, void *dst, int dst_pitch);
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_PremultiplyAlpha(int width, int height, SDL_PixelFormat src_format, const void *src, int src_pitch, SDL_PixelFormat dst_format, void *dst, int dst_pitch);
|
||||
|
||||
/**
|
||||
* Perform a fast fill of a rectangle with a specific color.
|
||||
@@ -1033,6 +1006,67 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceScaled(SDL_Surface *src, const SD
|
||||
*/
|
||||
extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode);
|
||||
|
||||
/**
|
||||
* Map an RGB triple to an opaque pixel value for a surface.
|
||||
*
|
||||
* This function maps the RGB color value to the specified pixel format and
|
||||
* returns the pixel value best approximating the given RGB color value for
|
||||
* the given pixel format.
|
||||
*
|
||||
* If the surface has a palette, the index of the closest matching color
|
||||
* in the palette will be returned.
|
||||
*
|
||||
* If the surface pixel format has an alpha component it will be returned as
|
||||
* all 1 bits (fully opaque).
|
||||
*
|
||||
* If the pixel format bpp (color depth) is less than 32-bpp then the unused
|
||||
* upper bits of the return value can safely be ignored (e.g., with a 16-bpp
|
||||
* format the return value can be assigned to a Uint16, and similarly a Uint8
|
||||
* for an 8-bpp format).
|
||||
*
|
||||
* \param surface the surface to use for the pixel format and palette.
|
||||
* \param r the red component of the pixel in the range 0-255.
|
||||
* \param g the green component of the pixel in the range 0-255.
|
||||
* \param b the blue component of the pixel in the range 0-255.
|
||||
* \returns a pixel value.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_MapSurfaceRGBA
|
||||
*/
|
||||
extern SDL_DECLSPEC Uint32 SDLCALL SDL_MapSurfaceRGB(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b);
|
||||
|
||||
/**
|
||||
* Map an RGBA quadruple to a pixel value for a surface.
|
||||
*
|
||||
* This function maps the RGBA color value to the specified pixel format and
|
||||
* returns the pixel value best approximating the given RGBA color value for
|
||||
* the given pixel format.
|
||||
*
|
||||
* If the surface pixel format has no alpha component the alpha value will
|
||||
* be ignored (as it will be in formats with a palette).
|
||||
*
|
||||
* If the surface has a palette, the index of the closest matching color
|
||||
* in the palette will be returned.
|
||||
*
|
||||
* If the pixel format bpp (color depth) is less than 32-bpp then the unused
|
||||
* upper bits of the return value can safely be ignored (e.g., with a 16-bpp
|
||||
* format the return value can be assigned to a Uint16, and similarly a Uint8
|
||||
* for an 8-bpp format).
|
||||
*
|
||||
* \param surface the surface to use for the pixel format and palette.
|
||||
* \param r the red component of the pixel in the range 0-255.
|
||||
* \param g the green component of the pixel in the range 0-255.
|
||||
* \param b the blue component of the pixel in the range 0-255.
|
||||
* \param a the alpha component of the pixel in the range 0-255.
|
||||
* \returns a pixel value.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_MapSurfaceRGB
|
||||
*/
|
||||
extern SDL_DECLSPEC Uint32 SDLCALL SDL_MapSurfaceRGBA(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
|
||||
/**
|
||||
* Retrieves a single pixel from a surface.
|
||||
*
|
||||
|
||||
@@ -88,7 +88,7 @@ typedef enum SDL_SystemTheme
|
||||
typedef struct SDL_DisplayMode
|
||||
{
|
||||
SDL_DisplayID displayID; /**< the display this mode is associated with */
|
||||
SDL_PixelFormatEnum format; /**< pixel format */
|
||||
SDL_PixelFormat format; /**< pixel format */
|
||||
int w; /**< width */
|
||||
int h; /**< height */
|
||||
float pixel_density; /**< scale converting size to pixels (e.g. a 1920x1080 mode with 2.0 scale would have 3840x2160 pixels) */
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "render/SDL_sysrender.h"
|
||||
#include "sensor/SDL_sensor_c.h"
|
||||
#include "stdlib/SDL_getenv_c.h"
|
||||
#include "video/SDL_pixels_c.h"
|
||||
#include "video/SDL_video_c.h"
|
||||
|
||||
#define SDL_INIT_EVERYTHING ~0U
|
||||
@@ -549,6 +550,8 @@ void SDL_Quit(void)
|
||||
SDL_ClearHints();
|
||||
SDL_AssertionsQuit();
|
||||
|
||||
SDL_QuitPixelFormatDetails();
|
||||
|
||||
SDL_QuitCPUInfo();
|
||||
|
||||
SDL_QuitProperties();
|
||||
|
||||
@@ -317,3 +317,8 @@ SDL_bool SDL_KeyMatchID(const void *a, const void *b, void *unused)
|
||||
}
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
void SDL_NukeFreeValue(const void *key, const void *value, void *unused)
|
||||
{
|
||||
SDL_free((void *)value);
|
||||
}
|
||||
|
||||
+20
-18
@@ -29,30 +29,32 @@ typedef Uint32 (*SDL_HashTable_HashFn)(const void *key, void *data);
|
||||
typedef SDL_bool (*SDL_HashTable_KeyMatchFn)(const void *a, const void *b, void *data);
|
||||
typedef void (*SDL_HashTable_NukeFn)(const void *key, const void *value, void *data);
|
||||
|
||||
SDL_HashTable *SDL_CreateHashTable(void *data,
|
||||
const Uint32 num_buckets,
|
||||
const SDL_HashTable_HashFn hashfn,
|
||||
const SDL_HashTable_KeyMatchFn keymatchfn,
|
||||
const SDL_HashTable_NukeFn nukefn,
|
||||
const SDL_bool stackable);
|
||||
extern SDL_HashTable *SDL_CreateHashTable(void *data,
|
||||
const Uint32 num_buckets,
|
||||
const SDL_HashTable_HashFn hashfn,
|
||||
const SDL_HashTable_KeyMatchFn keymatchfn,
|
||||
const SDL_HashTable_NukeFn nukefn,
|
||||
const SDL_bool stackable);
|
||||
|
||||
void SDL_EmptyHashTable(SDL_HashTable *table);
|
||||
void SDL_DestroyHashTable(SDL_HashTable *table);
|
||||
SDL_bool SDL_InsertIntoHashTable(SDL_HashTable *table, const void *key, const void *value);
|
||||
SDL_bool SDL_RemoveFromHashTable(SDL_HashTable *table, const void *key);
|
||||
SDL_bool SDL_FindInHashTable(const SDL_HashTable *table, const void *key, const void **_value);
|
||||
SDL_bool SDL_HashTableEmpty(SDL_HashTable *table);
|
||||
extern void SDL_EmptyHashTable(SDL_HashTable *table);
|
||||
extern void SDL_DestroyHashTable(SDL_HashTable *table);
|
||||
extern SDL_bool SDL_InsertIntoHashTable(SDL_HashTable *table, const void *key, const void *value);
|
||||
extern SDL_bool SDL_RemoveFromHashTable(SDL_HashTable *table, const void *key);
|
||||
extern SDL_bool SDL_FindInHashTable(const SDL_HashTable *table, const void *key, const void **_value);
|
||||
extern SDL_bool SDL_HashTableEmpty(SDL_HashTable *table);
|
||||
|
||||
// iterate all values for a specific key. This only makes sense if the hash is stackable. If not-stackable, just use SDL_FindInHashTable().
|
||||
SDL_bool SDL_IterateHashTableKey(const SDL_HashTable *table, const void *key, const void **_value, void **iter);
|
||||
extern SDL_bool SDL_IterateHashTableKey(const SDL_HashTable *table, const void *key, const void **_value, void **iter);
|
||||
|
||||
// iterate all key/value pairs in a hash (stackable hashes can have duplicate keys with multiple values).
|
||||
SDL_bool SDL_IterateHashTable(const SDL_HashTable *table, const void **_key, const void **_value, void **iter);
|
||||
extern SDL_bool SDL_IterateHashTable(const SDL_HashTable *table, const void **_key, const void **_value, void **iter);
|
||||
|
||||
Uint32 SDL_HashString(const void *key, void *unused);
|
||||
SDL_bool SDL_KeyMatchString(const void *a, const void *b, void *unused);
|
||||
extern Uint32 SDL_HashString(const void *key, void *unused);
|
||||
extern SDL_bool SDL_KeyMatchString(const void *a, const void *b, void *unused);
|
||||
|
||||
Uint32 SDL_HashID(const void *key, void *unused);
|
||||
SDL_bool SDL_KeyMatchID(const void *a, const void *b, void *unused);
|
||||
extern Uint32 SDL_HashID(const void *key, void *unused);
|
||||
extern SDL_bool SDL_KeyMatchID(const void *a, const void *b, void *unused);
|
||||
|
||||
extern void SDL_NukeFreeValue(const void *key, const void *value, void *unused);
|
||||
|
||||
#endif /* SDL_hashtable_h_ */
|
||||
|
||||
+11
-11
@@ -84,7 +84,7 @@ char *SDL_GetCameraThreadName(SDL_CameraDevice *device, char *buf, size_t buflen
|
||||
return buf;
|
||||
}
|
||||
|
||||
int SDL_AddCameraFormat(CameraFormatAddData *data, SDL_PixelFormatEnum format, SDL_Colorspace colorspace, int w, int h, int framerate_numerator, int framerate_denominator)
|
||||
int SDL_AddCameraFormat(CameraFormatAddData *data, SDL_PixelFormat format, SDL_Colorspace colorspace, int w, int h, int framerate_numerator, int framerate_denominator)
|
||||
{
|
||||
SDL_assert(data != NULL);
|
||||
if (data->allocated_specs <= data->num_specs) {
|
||||
@@ -130,7 +130,7 @@ static size_t GetFrameBufLen(const SDL_CameraSpec *spec)
|
||||
const size_t w = (const size_t) spec->width;
|
||||
const size_t h = (const size_t) spec->height;
|
||||
const size_t wxh = w * h;
|
||||
const SDL_PixelFormatEnum fmt = spec->format;
|
||||
const SDL_PixelFormat fmt = spec->format;
|
||||
|
||||
switch (fmt) {
|
||||
// Some YUV formats have a larger Y plane than their U or V planes.
|
||||
@@ -367,8 +367,8 @@ static int SDLCALL CameraSpecCmp(const void *vpa, const void *vpb)
|
||||
SDL_assert(b->width > 0);
|
||||
SDL_assert(b->height > 0);
|
||||
|
||||
const SDL_PixelFormatEnum afmt = a->format;
|
||||
const SDL_PixelFormatEnum bfmt = b->format;
|
||||
const SDL_PixelFormat afmt = a->format;
|
||||
const SDL_PixelFormat bfmt = b->format;
|
||||
if (SDL_ISPIXELFORMAT_FOURCC(afmt) && !SDL_ISPIXELFORMAT_FOURCC(bfmt)) {
|
||||
return -1;
|
||||
} else if (!SDL_ISPIXELFORMAT_FOURCC(afmt) && SDL_ISPIXELFORMAT_FOURCC(bfmt)) {
|
||||
@@ -879,8 +879,8 @@ SDL_bool SDL_CameraThreadIterate(SDL_CameraDevice *device)
|
||||
if (device->needs_conversion) {
|
||||
SDL_Surface *dstsurf = (device->needs_scaling == 1) ? device->conversion_surface : output_surface;
|
||||
SDL_ConvertPixels(srcsurf->w, srcsurf->h,
|
||||
srcsurf->format->format, srcsurf->pixels, srcsurf->pitch,
|
||||
dstsurf->format->format, dstsurf->pixels, dstsurf->pitch);
|
||||
srcsurf->format, srcsurf->pixels, srcsurf->pitch,
|
||||
dstsurf->format, dstsurf->pixels, dstsurf->pitch);
|
||||
srcsurf = dstsurf;
|
||||
}
|
||||
if (device->needs_scaling == 1) { // upscaling? Do it last. -1: downscale, 0: no scaling, 1: upscale
|
||||
@@ -1005,8 +1005,8 @@ static void ChooseBestCameraSpec(SDL_CameraDevice *device, const SDL_CameraSpec
|
||||
SDL_assert(closest->height > 0);
|
||||
|
||||
// okay, we have what we think is the best resolution, now we just need the best format that supports it...
|
||||
const SDL_PixelFormatEnum wantfmt = spec->format;
|
||||
SDL_PixelFormatEnum best_format = SDL_PIXELFORMAT_UNKNOWN;
|
||||
const SDL_PixelFormat wantfmt = spec->format;
|
||||
SDL_PixelFormat best_format = SDL_PIXELFORMAT_UNKNOWN;
|
||||
SDL_Colorspace best_colorspace = SDL_COLORSPACE_UNKNOWN;
|
||||
for (int i = 0; i < num_specs; i++) {
|
||||
const SDL_CameraSpec *thisspec = &device->all_specs[i];
|
||||
@@ -1124,7 +1124,7 @@ SDL_Camera *SDL_OpenCameraDevice(SDL_CameraDeviceID instance_id, const SDL_Camer
|
||||
|
||||
device->needs_conversion = (closest.format != device->spec.format);
|
||||
|
||||
device->acquire_surface = SDL_CreateSurfaceFrom(NULL, closest.width, closest.height, 0, closest.format);
|
||||
device->acquire_surface = SDL_CreateSurfaceFrom(closest.width, closest.height, closest.format, NULL, 0);
|
||||
if (!device->acquire_surface) {
|
||||
ClosePhysicalCameraDevice(device);
|
||||
ReleaseCameraDevice(device);
|
||||
@@ -1136,7 +1136,7 @@ SDL_Camera *SDL_OpenCameraDevice(SDL_CameraDeviceID instance_id, const SDL_Camer
|
||||
if (device->needs_scaling && device->needs_conversion) {
|
||||
const SDL_bool downsampling_first = (device->needs_scaling < 0);
|
||||
const SDL_CameraSpec *s = downsampling_first ? &device->spec : &closest;
|
||||
const SDL_PixelFormatEnum fmt = downsampling_first ? closest.format : device->spec.format;
|
||||
const SDL_PixelFormat fmt = downsampling_first ? closest.format : device->spec.format;
|
||||
device->conversion_surface = SDL_CreateSurface(s->width, s->height, fmt);
|
||||
if (!device->conversion_surface) {
|
||||
ClosePhysicalCameraDevice(device);
|
||||
@@ -1160,7 +1160,7 @@ SDL_Camera *SDL_OpenCameraDevice(SDL_CameraDeviceID instance_id, const SDL_Camer
|
||||
if (device->needs_scaling || device->needs_conversion) {
|
||||
surf = SDL_CreateSurface(device->spec.width, device->spec.height, device->spec.format);
|
||||
} else {
|
||||
surf = SDL_CreateSurfaceFrom(NULL, device->spec.width, device->spec.height, 0, device->spec.format);
|
||||
surf = SDL_CreateSurfaceFrom(device->spec.width, device->spec.height, device->spec.format, NULL, 0);
|
||||
}
|
||||
if (!surf) {
|
||||
ClosePhysicalCameraDevice(device);
|
||||
|
||||
@@ -64,7 +64,7 @@ typedef struct CameraFormatAddData
|
||||
int allocated_specs;
|
||||
} CameraFormatAddData;
|
||||
|
||||
int SDL_AddCameraFormat(CameraFormatAddData *data, SDL_PixelFormatEnum format, SDL_Colorspace colorspace, int w, int h, int framerate_numerator, int framerate_denominator);
|
||||
int SDL_AddCameraFormat(CameraFormatAddData *data, SDL_PixelFormat format, SDL_Colorspace colorspace, int w, int h, int framerate_numerator, int framerate_denominator);
|
||||
|
||||
typedef struct SurfaceList
|
||||
{
|
||||
|
||||
@@ -252,7 +252,7 @@ static void DestroyCameraManager(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void format_android_to_sdl(Uint32 fmt, SDL_PixelFormatEnum *format, SDL_Colorspace *colorspace)
|
||||
static void format_android_to_sdl(Uint32 fmt, SDL_PixelFormat *format, SDL_Colorspace *colorspace)
|
||||
{
|
||||
switch (fmt) {
|
||||
#define CASE(x, y, z) case x: *format = y; *colorspace = z; return
|
||||
@@ -274,7 +274,7 @@ static void format_android_to_sdl(Uint32 fmt, SDL_PixelFormatEnum *format, SDL_C
|
||||
*colorspace = SDL_COLORSPACE_UNKNOWN;
|
||||
}
|
||||
|
||||
static Uint32 format_sdl_to_android(SDL_PixelFormatEnum fmt)
|
||||
static Uint32 format_sdl_to_android(SDL_PixelFormat fmt)
|
||||
{
|
||||
switch (fmt) {
|
||||
#define CASE(x, y) case y: return x
|
||||
@@ -632,7 +632,7 @@ static void GatherCameraSpecs(const char *devid, CameraFormatAddData *add_data,
|
||||
const int w = (int) i32ptr[1];
|
||||
const int h = (int) i32ptr[2];
|
||||
const int32_t type = i32ptr[3];
|
||||
SDL_PixelFormatEnum sdlfmt = SDL_PIXELFORMAT_UNKNOWN;
|
||||
SDL_PixelFormat sdlfmt = SDL_PIXELFORMAT_UNKNOWN;
|
||||
SDL_Colorspace colorspace = SDL_COLORSPACE_UNKNOWN;
|
||||
|
||||
if (type == ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT) {
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
* <key>com.apple.security.device.camera</key> <true/>
|
||||
*/
|
||||
|
||||
static void CoreMediaFormatToSDL(FourCharCode fmt, SDL_PixelFormatEnum *pixel_format, SDL_Colorspace *colorspace)
|
||||
static void CoreMediaFormatToSDL(FourCharCode fmt, SDL_PixelFormat *pixel_format, SDL_Colorspace *colorspace)
|
||||
{
|
||||
switch (fmt) {
|
||||
#define CASE(x, y, z) case x: *pixel_format = y; *colorspace = z; return
|
||||
@@ -260,7 +260,7 @@ static int COREMEDIA_OpenDevice(SDL_CameraDevice *device, const SDL_CameraSpec *
|
||||
NSArray<AVCaptureDeviceFormat *> *formats = [avdevice formats];
|
||||
for (AVCaptureDeviceFormat *format in formats) {
|
||||
CMFormatDescriptionRef formatDescription = [format formatDescription];
|
||||
SDL_PixelFormatEnum device_format = SDL_PIXELFORMAT_UNKNOWN;
|
||||
SDL_PixelFormat device_format = SDL_PIXELFORMAT_UNKNOWN;
|
||||
SDL_Colorspace device_colorspace = SDL_COLORSPACE_UNKNOWN;
|
||||
CoreMediaFormatToSDL(CMFormatDescriptionGetMediaSubType(formatDescription), &device_format, &device_colorspace);
|
||||
if (device_format != spec->format || device_colorspace != spec->colorspace) {
|
||||
@@ -384,7 +384,7 @@ static void GatherCameraSpecs(AVCaptureDevice *device, CameraFormatAddData *add_
|
||||
}
|
||||
|
||||
//NSLog(@"Available camera format: %@\n", fmt);
|
||||
SDL_PixelFormatEnum device_format = SDL_PIXELFORMAT_UNKNOWN;
|
||||
SDL_PixelFormat device_format = SDL_PIXELFORMAT_UNKNOWN;
|
||||
SDL_Colorspace device_colorspace = SDL_COLORSPACE_UNKNOWN;
|
||||
CoreMediaFormatToSDL(CMFormatDescriptionGetMediaSubType(fmt.formatDescription), &device_format, &device_colorspace);
|
||||
if (device_format == SDL_PIXELFORMAT_UNKNOWN) {
|
||||
|
||||
@@ -85,7 +85,7 @@ SDL_DEFINE_MEDIATYPE_GUID(MFVideoFormat_NV21, FCC('NV21'));
|
||||
static const struct
|
||||
{
|
||||
const GUID *guid;
|
||||
SDL_PixelFormatEnum format;
|
||||
SDL_PixelFormat format;
|
||||
SDL_Colorspace colorspace;
|
||||
} fmtmappings[] = {
|
||||
// This is not every possible format, just popular ones that SDL can reasonably handle.
|
||||
@@ -281,7 +281,7 @@ static SDL_Colorspace GetMediaTypeColorspace(IMFMediaType *mediatype, SDL_Colors
|
||||
return colorspace;
|
||||
}
|
||||
|
||||
static void MediaTypeToSDLFmt(IMFMediaType *mediatype, SDL_PixelFormatEnum *format, SDL_Colorspace *colorspace)
|
||||
static void MediaTypeToSDLFmt(IMFMediaType *mediatype, SDL_PixelFormat *format, SDL_Colorspace *colorspace)
|
||||
{
|
||||
HRESULT ret;
|
||||
GUID type;
|
||||
@@ -300,7 +300,7 @@ static void MediaTypeToSDLFmt(IMFMediaType *mediatype, SDL_PixelFormatEnum *form
|
||||
*colorspace = SDL_COLORSPACE_UNKNOWN;
|
||||
}
|
||||
|
||||
static const GUID *SDLFmtToMFVidFmtGuid(SDL_PixelFormatEnum format)
|
||||
static const GUID *SDLFmtToMFVidFmtGuid(SDL_PixelFormat format)
|
||||
{
|
||||
for (size_t i = 0; i < SDL_arraysize(fmtmappings); i++) {
|
||||
if (fmtmappings[i].format == format) {
|
||||
@@ -930,7 +930,7 @@ static void GatherCameraSpecs(IMFMediaSource *source, CameraFormatAddData *add_d
|
||||
GUID type;
|
||||
ret = IMFMediaType_GetGUID(mediatype, &SDL_MF_MT_MAJOR_TYPE, &type);
|
||||
if (SUCCEEDED(ret) && WIN_IsEqualGUID(&type, &SDL_MFMediaType_Video)) {
|
||||
SDL_PixelFormatEnum sdlfmt = SDL_PIXELFORMAT_UNKNOWN;
|
||||
SDL_PixelFormat sdlfmt = SDL_PIXELFORMAT_UNKNOWN;
|
||||
SDL_Colorspace colorspace = SDL_COLORSPACE_UNKNOWN;
|
||||
MediaTypeToSDLFmt(mediatype, &sdlfmt, &colorspace);
|
||||
if (sdlfmt != SDL_PIXELFORMAT_UNKNOWN) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -391,7 +391,7 @@ static int AllocBufferUserPtr(SDL_CameraDevice *device, size_t buffer_size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void format_v4l2_to_sdl(Uint32 fmt, SDL_PixelFormatEnum *format, SDL_Colorspace *colorspace)
|
||||
static void format_v4l2_to_sdl(Uint32 fmt, SDL_PixelFormat *format, SDL_Colorspace *colorspace)
|
||||
{
|
||||
switch (fmt) {
|
||||
#define CASE(x, y, z) case x: *format = y; *colorspace = z; return
|
||||
@@ -407,7 +407,7 @@ static void format_v4l2_to_sdl(Uint32 fmt, SDL_PixelFormatEnum *format, SDL_Colo
|
||||
*colorspace = SDL_COLORSPACE_UNKNOWN;
|
||||
}
|
||||
|
||||
static Uint32 format_sdl_to_v4l2(SDL_PixelFormatEnum fmt)
|
||||
static Uint32 format_sdl_to_v4l2(SDL_PixelFormat fmt)
|
||||
{
|
||||
switch (fmt) {
|
||||
#define CASE(y, x) case x: return y
|
||||
@@ -645,7 +645,7 @@ static SDL_bool FindV4L2CameraDeviceByBusInfoCallback(SDL_CameraDevice *device,
|
||||
return (SDL_strcmp(handle->bus_info, (const char *) userdata) == 0);
|
||||
}
|
||||
|
||||
static int AddCameraFormat(const int fd, CameraFormatAddData *data, SDL_PixelFormatEnum sdlfmt, SDL_Colorspace colorspace, Uint32 v4l2fmt, int w, int h)
|
||||
static int AddCameraFormat(const int fd, CameraFormatAddData *data, SDL_PixelFormat sdlfmt, SDL_Colorspace colorspace, Uint32 v4l2fmt, int w, int h)
|
||||
{
|
||||
struct v4l2_frmivalenum frmivalenum;
|
||||
SDL_zero(frmivalenum);
|
||||
@@ -729,7 +729,7 @@ static void MaybeAddDevice(const char *path)
|
||||
SDL_zero(fmtdesc);
|
||||
fmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
while (ioctl(fd, VIDIOC_ENUM_FMT, &fmtdesc) == 0) {
|
||||
SDL_PixelFormatEnum sdlfmt = SDL_PIXELFORMAT_UNKNOWN;
|
||||
SDL_PixelFormat sdlfmt = SDL_PIXELFORMAT_UNKNOWN;
|
||||
SDL_Colorspace colorspace = SDL_COLORSPACE_UNKNOWN;
|
||||
format_v4l2_to_sdl(fmtdesc.pixelformat, &sdlfmt, &colorspace);
|
||||
|
||||
|
||||
@@ -58,8 +58,7 @@ SDL3_0.0.0 {
|
||||
SDL_ConvertPixels;
|
||||
SDL_ConvertPixelsAndColorspace;
|
||||
SDL_ConvertSurface;
|
||||
SDL_ConvertSurfaceFormat;
|
||||
SDL_ConvertSurfaceFormatAndColorspace;
|
||||
SDL_ConvertSurfaceAndColorspace;
|
||||
SDL_CopyProperties;
|
||||
SDL_CreateAudioStream;
|
||||
SDL_CreateColorCursor;
|
||||
@@ -330,7 +329,7 @@ SDL3_0.0.0 {
|
||||
SDL_GetKeyboards;
|
||||
SDL_GetLogOutputFunction;
|
||||
SDL_GetLogPriority;
|
||||
SDL_GetMasksForPixelFormatEnum;
|
||||
SDL_GetMasksForPixelFormat;
|
||||
SDL_GetMaxHapticEffects;
|
||||
SDL_GetMaxHapticEffectsPlaying;
|
||||
SDL_GetMemoryFunctions;
|
||||
@@ -364,7 +363,8 @@ SDL3_0.0.0 {
|
||||
SDL_GetPens;
|
||||
SDL_GetPerformanceCounter;
|
||||
SDL_GetPerformanceFrequency;
|
||||
SDL_GetPixelFormatEnumForMasks;
|
||||
SDL_GetPixelFormatDetails;
|
||||
SDL_GetPixelFormatForMasks;
|
||||
SDL_GetPixelFormatName;
|
||||
SDL_GetPlatform;
|
||||
SDL_GetPowerInfo;
|
||||
@@ -436,6 +436,7 @@ SDL3_0.0.0 {
|
||||
SDL_GetSurfaceColorKey;
|
||||
SDL_GetSurfaceColorMod;
|
||||
SDL_GetSurfaceColorspace;
|
||||
SDL_GetSurfacePalette;
|
||||
SDL_GetSurfaceProperties;
|
||||
SDL_GetSystemRAM;
|
||||
SDL_GetSystemTheme;
|
||||
@@ -568,6 +569,8 @@ SDL3_0.0.0 {
|
||||
SDL_LogWarn;
|
||||
SDL_MapRGB;
|
||||
SDL_MapRGBA;
|
||||
SDL_MapSurfaceRGB;
|
||||
SDL_MapSurfaceRGBA;
|
||||
SDL_MaximizeWindow;
|
||||
SDL_MemoryBarrierAcquireFunction;
|
||||
SDL_MemoryBarrierReleaseFunction;
|
||||
@@ -724,7 +727,6 @@ SDL3_0.0.0 {
|
||||
SDL_SetModState;
|
||||
SDL_SetNumberProperty;
|
||||
SDL_SetPaletteColors;
|
||||
SDL_SetPixelFormatPalette;
|
||||
SDL_SetPrimarySelectionText;
|
||||
SDL_SetProperty;
|
||||
SDL_SetPropertyWithCleanup;
|
||||
|
||||
@@ -83,8 +83,7 @@
|
||||
#define SDL_ConvertPixels SDL_ConvertPixels_REAL
|
||||
#define SDL_ConvertPixelsAndColorspace SDL_ConvertPixelsAndColorspace_REAL
|
||||
#define SDL_ConvertSurface SDL_ConvertSurface_REAL
|
||||
#define SDL_ConvertSurfaceFormat SDL_ConvertSurfaceFormat_REAL
|
||||
#define SDL_ConvertSurfaceFormatAndColorspace SDL_ConvertSurfaceFormatAndColorspace_REAL
|
||||
#define SDL_ConvertSurfaceAndColorspace SDL_ConvertSurfaceAndColorspace_REAL
|
||||
#define SDL_CopyProperties SDL_CopyProperties_REAL
|
||||
#define SDL_CreateAudioStream SDL_CreateAudioStream_REAL
|
||||
#define SDL_CreateColorCursor SDL_CreateColorCursor_REAL
|
||||
@@ -94,7 +93,6 @@
|
||||
#define SDL_CreateHapticEffect SDL_CreateHapticEffect_REAL
|
||||
#define SDL_CreateMutex SDL_CreateMutex_REAL
|
||||
#define SDL_CreatePalette SDL_CreatePalette_REAL
|
||||
#define SDL_CreatePixelFormat SDL_CreatePixelFormat_REAL
|
||||
#define SDL_CreatePopupWindow SDL_CreatePopupWindow_REAL
|
||||
#define SDL_CreateProperties SDL_CreateProperties_REAL
|
||||
#define SDL_CreateRWLock SDL_CreateRWLock_REAL
|
||||
@@ -191,8 +189,8 @@
|
||||
#define SDL_GetAndroidSDKVersion SDL_GetAndroidSDKVersion_REAL
|
||||
#define SDL_GetAssertionHandler SDL_GetAssertionHandler_REAL
|
||||
#define SDL_GetAssertionReport SDL_GetAssertionReport_REAL
|
||||
#define SDL_GetAudioDeviceGain SDL_GetAudioDeviceGain_REAL
|
||||
#define SDL_GetAudioDeviceFormat SDL_GetAudioDeviceFormat_REAL
|
||||
#define SDL_GetAudioDeviceGain SDL_GetAudioDeviceGain_REAL
|
||||
#define SDL_GetAudioDeviceName SDL_GetAudioDeviceName_REAL
|
||||
#define SDL_GetAudioDriver SDL_GetAudioDriver_REAL
|
||||
#define SDL_GetAudioPlaybackDevices SDL_GetAudioPlaybackDevices_REAL
|
||||
@@ -355,7 +353,7 @@
|
||||
#define SDL_GetKeyboards SDL_GetKeyboards_REAL
|
||||
#define SDL_GetLogOutputFunction SDL_GetLogOutputFunction_REAL
|
||||
#define SDL_GetLogPriority SDL_GetLogPriority_REAL
|
||||
#define SDL_GetMasksForPixelFormatEnum SDL_GetMasksForPixelFormatEnum_REAL
|
||||
#define SDL_GetMasksForPixelFormat SDL_GetMasksForPixelFormat_REAL
|
||||
#define SDL_GetMaxHapticEffects SDL_GetMaxHapticEffects_REAL
|
||||
#define SDL_GetMaxHapticEffectsPlaying SDL_GetMaxHapticEffectsPlaying_REAL
|
||||
#define SDL_GetMemoryFunctions SDL_GetMemoryFunctions_REAL
|
||||
@@ -389,7 +387,8 @@
|
||||
#define SDL_GetPens SDL_GetPens_REAL
|
||||
#define SDL_GetPerformanceCounter SDL_GetPerformanceCounter_REAL
|
||||
#define SDL_GetPerformanceFrequency SDL_GetPerformanceFrequency_REAL
|
||||
#define SDL_GetPixelFormatEnumForMasks SDL_GetPixelFormatEnumForMasks_REAL
|
||||
#define SDL_GetPixelFormatDetails SDL_GetPixelFormatDetails_REAL
|
||||
#define SDL_GetPixelFormatForMasks SDL_GetPixelFormatForMasks_REAL
|
||||
#define SDL_GetPixelFormatName SDL_GetPixelFormatName_REAL
|
||||
#define SDL_GetPlatform SDL_GetPlatform_REAL
|
||||
#define SDL_GetPowerInfo SDL_GetPowerInfo_REAL
|
||||
@@ -461,6 +460,7 @@
|
||||
#define SDL_GetSurfaceColorKey SDL_GetSurfaceColorKey_REAL
|
||||
#define SDL_GetSurfaceColorMod SDL_GetSurfaceColorMod_REAL
|
||||
#define SDL_GetSurfaceColorspace SDL_GetSurfaceColorspace_REAL
|
||||
#define SDL_GetSurfacePalette SDL_GetSurfacePalette_REAL
|
||||
#define SDL_GetSurfaceProperties SDL_GetSurfaceProperties_REAL
|
||||
#define SDL_GetSystemRAM SDL_GetSystemRAM_REAL
|
||||
#define SDL_GetSystemTheme SDL_GetSystemTheme_REAL
|
||||
@@ -593,6 +593,8 @@
|
||||
#define SDL_LogWarn SDL_LogWarn_REAL
|
||||
#define SDL_MapRGB SDL_MapRGB_REAL
|
||||
#define SDL_MapRGBA SDL_MapRGBA_REAL
|
||||
#define SDL_MapSurfaceRGB SDL_MapSurfaceRGB_REAL
|
||||
#define SDL_MapSurfaceRGBA SDL_MapSurfaceRGBA_REAL
|
||||
#define SDL_MaximizeWindow SDL_MaximizeWindow_REAL
|
||||
#define SDL_MemoryBarrierAcquireFunction SDL_MemoryBarrierAcquireFunction_REAL
|
||||
#define SDL_MemoryBarrierReleaseFunction SDL_MemoryBarrierReleaseFunction_REAL
|
||||
@@ -749,7 +751,6 @@
|
||||
#define SDL_SetModState SDL_SetModState_REAL
|
||||
#define SDL_SetNumberProperty SDL_SetNumberProperty_REAL
|
||||
#define SDL_SetPaletteColors SDL_SetPaletteColors_REAL
|
||||
#define SDL_SetPixelFormatPalette SDL_SetPixelFormatPalette_REAL
|
||||
#define SDL_SetPrimarySelectionText SDL_SetPrimarySelectionText_REAL
|
||||
#define SDL_SetProperty SDL_SetProperty_REAL
|
||||
#define SDL_SetPropertyWithCleanup SDL_SetPropertyWithCleanup_REAL
|
||||
|
||||
@@ -100,11 +100,10 @@ SDL_DYNAPI_PROC(int,SDL_CloseStorage,(SDL_Storage *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_BlendMode,SDL_ComposeCustomBlendMode,(SDL_BlendFactor a, SDL_BlendFactor b, SDL_BlendOperation c, SDL_BlendFactor d, SDL_BlendFactor e, SDL_BlendOperation f),(a,b,c,d,e,f),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_ConvertAudioSamples,(const SDL_AudioSpec *a, const Uint8 *b, int c, const SDL_AudioSpec *d, Uint8 **e, int *f),(a,b,c,d,e,f),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_ConvertEventToRenderCoordinates,(SDL_Renderer *a, SDL_Event *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_ConvertPixels,(int a, int b, SDL_PixelFormatEnum c, const void *d, int e, SDL_PixelFormatEnum f, void *g, int h),(a,b,c,d,e,f,g,h),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_ConvertPixelsAndColorspace,(int a, int b, SDL_PixelFormatEnum c, SDL_Colorspace d, SDL_PropertiesID e, const void *f, int g, SDL_PixelFormatEnum h, SDL_Colorspace i, SDL_PropertiesID j, void *k, int l),(a,b,c,d,e,f,g,h,i,j,k,l),return)
|
||||
SDL_DYNAPI_PROC(SDL_Surface*,SDL_ConvertSurface,(SDL_Surface *a, const SDL_PixelFormat *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_Surface*,SDL_ConvertSurfaceFormat,(SDL_Surface *a, SDL_PixelFormatEnum b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_Surface*,SDL_ConvertSurfaceFormatAndColorspace,(SDL_Surface *a, SDL_PixelFormatEnum b, SDL_Colorspace c, SDL_PropertiesID d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_ConvertPixels,(int a, int b, SDL_PixelFormat c, const void *d, int e, SDL_PixelFormat f, void *g, int h),(a,b,c,d,e,f,g,h),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_ConvertPixelsAndColorspace,(int a, int b, SDL_PixelFormat c, SDL_Colorspace d, SDL_PropertiesID e, const void *f, int g, SDL_PixelFormat h, SDL_Colorspace i, SDL_PropertiesID j, void *k, int l),(a,b,c,d,e,f,g,h,i,j,k,l),return)
|
||||
SDL_DYNAPI_PROC(SDL_Surface*,SDL_ConvertSurface,(SDL_Surface *a, SDL_PixelFormat b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_Surface*,SDL_ConvertSurfaceAndColorspace,(SDL_Surface *a, SDL_PixelFormat b, const SDL_Palette *c, SDL_Colorspace d, SDL_PropertiesID e),(a,b,c,d,e),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_CopyProperties,(SDL_PropertiesID a, SDL_PropertiesID b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_AudioStream*,SDL_CreateAudioStream,(const SDL_AudioSpec *a, const SDL_AudioSpec *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_Cursor*,SDL_CreateColorCursor,(SDL_Surface *a, int b, int c),(a,b,c),return)
|
||||
@@ -114,7 +113,6 @@ SDL_DYNAPI_PROC(int,SDL_CreateDirectory,(const char *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_CreateHapticEffect,(SDL_Haptic *a, const SDL_HapticEffect *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_Mutex*,SDL_CreateMutex,(void),(),return)
|
||||
SDL_DYNAPI_PROC(SDL_Palette*,SDL_CreatePalette,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_PixelFormat*,SDL_CreatePixelFormat,(SDL_PixelFormatEnum a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Window*,SDL_CreatePopupWindow,(SDL_Window *a, int b, int c, int d, int e, SDL_WindowFlags f),(a,b,c,d,e,f),return)
|
||||
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_CreateProperties,(void),(),return)
|
||||
SDL_DYNAPI_PROC(SDL_RWLock*,SDL_CreateRWLock,(void),(),return)
|
||||
@@ -123,11 +121,11 @@ SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateRendererWithProperties,(SDL_PropertiesID
|
||||
SDL_DYNAPI_PROC(SDL_Semaphore*,SDL_CreateSemaphore,(Uint32 a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateSoftwareRenderer,(SDL_Surface *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_CreateStorageDirectory,(SDL_Storage *a, const char *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateSurface,(int a, int b, SDL_PixelFormatEnum c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateSurfaceFrom,(void *a, int b, int c, int d, SDL_PixelFormatEnum e),(a,b,c,d,e),return)
|
||||
SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateSurface,(int a, int b, SDL_PixelFormat c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateSurfaceFrom,(int a, int b, SDL_PixelFormat c, void *d, int e),(a,b,c,d,e),return)
|
||||
SDL_DYNAPI_PROC(SDL_Cursor*,SDL_CreateSystemCursor,(SDL_SystemCursor a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_TLSID,SDL_CreateTLS,(void),(),return)
|
||||
SDL_DYNAPI_PROC(SDL_Texture*,SDL_CreateTexture,(SDL_Renderer *a, SDL_PixelFormatEnum b, int c, int d, int e),(a,b,c,d,e),return)
|
||||
SDL_DYNAPI_PROC(SDL_Texture*,SDL_CreateTexture,(SDL_Renderer *a, SDL_PixelFormat b, int c, int d, int e),(a,b,c,d,e),return)
|
||||
SDL_DYNAPI_PROC(SDL_Texture*,SDL_CreateTextureFromSurface,(SDL_Renderer *a, SDL_Surface *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_Texture*,SDL_CreateTextureWithProperties,(SDL_Renderer *a, SDL_PropertiesID b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThreadRuntime,(SDL_ThreadFunction a, const char *b, void *c, SDL_FunctionPointer d, SDL_FunctionPointer e),(a,b,c,d,e),return)
|
||||
@@ -148,7 +146,6 @@ SDL_DYNAPI_PROC(void,SDL_DestroyCursor,(SDL_Cursor *a),(a),)
|
||||
SDL_DYNAPI_PROC(void,SDL_DestroyHapticEffect,(SDL_Haptic *a, int b),(a,b),)
|
||||
SDL_DYNAPI_PROC(void,SDL_DestroyMutex,(SDL_Mutex *a),(a),)
|
||||
SDL_DYNAPI_PROC(void,SDL_DestroyPalette,(SDL_Palette *a),(a),)
|
||||
SDL_DYNAPI_PROC(void,SDL_DestroyPixelFormat,(SDL_PixelFormat *a),(a),)
|
||||
SDL_DYNAPI_PROC(void,SDL_DestroyProperties,(SDL_PropertiesID a),(a),)
|
||||
SDL_DYNAPI_PROC(void,SDL_DestroyRWLock,(SDL_RWLock *a),(a),)
|
||||
SDL_DYNAPI_PROC(void,SDL_DestroyRenderer,(SDL_Renderer *a),(a),)
|
||||
@@ -375,7 +372,7 @@ SDL_DYNAPI_PROC(const Uint8*,SDL_GetKeyboardState,(int *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_KeyboardID*,SDL_GetKeyboards,(int *a),(a),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_GetLogOutputFunction,(SDL_LogOutputFunction *a, void **b),(a,b),)
|
||||
SDL_DYNAPI_PROC(SDL_LogPriority,SDL_GetLogPriority,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GetMasksForPixelFormatEnum,(SDL_PixelFormatEnum a, int *b, Uint32 *c, Uint32 *d, Uint32 *e, Uint32 *f),(a,b,c,d,e,f),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetMasksForPixelFormat,(SDL_PixelFormat a, int *b, Uint32 *c, Uint32 *d, Uint32 *e, Uint32 *f),(a,b,c,d,e,f),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetMaxHapticEffects,(SDL_Haptic *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetMaxHapticEffectsPlaying,(SDL_Haptic *a),(a),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_GetMemoryFunctions,(SDL_malloc_func *a, SDL_calloc_func *b, SDL_realloc_func *c, SDL_free_func *d),(a,b,c,d),)
|
||||
@@ -409,8 +406,9 @@ SDL_DYNAPI_PROC(SDL_PenSubtype,SDL_GetPenType,(SDL_PenID a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_PenID*,SDL_GetPens,(int *a),(a),return)
|
||||
SDL_DYNAPI_PROC(Uint64,SDL_GetPerformanceCounter,(void),(),return)
|
||||
SDL_DYNAPI_PROC(Uint64,SDL_GetPerformanceFrequency,(void),(),return)
|
||||
SDL_DYNAPI_PROC(SDL_PixelFormatEnum,SDL_GetPixelFormatEnumForMasks,(int a, Uint32 b, Uint32 c, Uint32 d, Uint32 e),(a,b,c,d,e),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetPixelFormatName,(SDL_PixelFormatEnum a),(a),return)
|
||||
SDL_DYNAPI_PROC(const SDL_PixelFormatDetails*,SDL_GetPixelFormatDetails,(SDL_PixelFormat a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_PixelFormat,SDL_GetPixelFormatForMasks,(int a, Uint32 b, Uint32 c, Uint32 d, Uint32 e),(a,b,c,d,e),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetPixelFormatName,(SDL_PixelFormat a),(a),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetPlatform,(void),(),return)
|
||||
SDL_DYNAPI_PROC(SDL_PowerState,SDL_GetPowerInfo,(int *a, int *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(char*,SDL_GetPrefPath,(const char *a, const char *b),(a,b),return)
|
||||
@@ -419,8 +417,8 @@ SDL_DYNAPI_PROC(SDL_DisplayID,SDL_GetPrimaryDisplay,(void),(),return)
|
||||
SDL_DYNAPI_PROC(char*,SDL_GetPrimarySelectionText,(void),(),return)
|
||||
SDL_DYNAPI_PROC(void*,SDL_GetProperty,(SDL_PropertiesID a, const char *b, void *c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(SDL_PropertyType,SDL_GetPropertyType,(SDL_PropertiesID a, const char *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_GetRGB,(Uint32 a, const SDL_PixelFormat *b, Uint8 *c, Uint8 *d, Uint8 *e),(a,b,c,d,e),)
|
||||
SDL_DYNAPI_PROC(void,SDL_GetRGBA,(Uint32 a, const SDL_PixelFormat *b, Uint8 *c, Uint8 *d, Uint8 *e, Uint8 *f),(a,b,c,d,e,f),)
|
||||
SDL_DYNAPI_PROC(void,SDL_GetRGB,(Uint32 a, const SDL_PixelFormatDetails *b, const SDL_Palette *c, Uint8 *d, Uint8 *e, Uint8 *f),(a,b,c,d,e,f),)
|
||||
SDL_DYNAPI_PROC(void,SDL_GetRGBA,(Uint32 a, const SDL_PixelFormatDetails *b, const SDL_Palette *c, Uint8 *d, Uint8 *e, Uint8 *f, Uint8 *g),(a,b,c,d,e,f,g),)
|
||||
SDL_DYNAPI_PROC(SDL_GamepadType,SDL_GetRealGamepadInstanceType,(SDL_JoystickID a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_GamepadType,SDL_GetRealGamepadType,(SDL_Gamepad *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectAndLineIntersection,(const SDL_Rect *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return)
|
||||
@@ -480,7 +478,8 @@ SDL_DYNAPI_PROC(int,SDL_GetSurfaceBlendMode,(SDL_Surface *a, SDL_BlendMode *b),(
|
||||
SDL_DYNAPI_PROC(int,SDL_GetSurfaceClipRect,(SDL_Surface *a, SDL_Rect *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetSurfaceColorKey,(SDL_Surface *a, Uint32 *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetSurfaceColorMod,(SDL_Surface *a, Uint8 *b, Uint8 *c, Uint8 *d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetSurfaceColorspace,(SDL_Surface *a, SDL_Colorspace *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_Colorspace,SDL_GetSurfaceColorspace,(SDL_Surface *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Palette*,SDL_GetSurfacePalette,(SDL_Surface *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetSurfaceProperties,(SDL_Surface *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetSystemRAM,(void),(),return)
|
||||
SDL_DYNAPI_PROC(SDL_SystemTheme,SDL_GetSystemTheme,(void),(),return)
|
||||
@@ -602,8 +601,10 @@ SDL_DYNAPI_PROC(int,SDL_LockSurface,(SDL_Surface *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_LockTexture,(SDL_Texture *a, const SDL_Rect *b, void **c, int *d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_LockTextureToSurface,(SDL_Texture *a, const SDL_Rect *b, SDL_Surface **c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_LogMessageV,(int a, SDL_LogPriority b, SDL_PRINTF_FORMAT_STRING const char *c, va_list d),(a,b,c,d),)
|
||||
SDL_DYNAPI_PROC(Uint32,SDL_MapRGB,(const SDL_PixelFormat *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(Uint32,SDL_MapRGBA,(const SDL_PixelFormat *a, Uint8 b, Uint8 c, Uint8 d, Uint8 e),(a,b,c,d,e),return)
|
||||
SDL_DYNAPI_PROC(Uint32,SDL_MapRGB,(const SDL_PixelFormatDetails *a, const SDL_Palette *b, Uint8 c, Uint8 d, Uint8 e),(a,b,c,d,e),return)
|
||||
SDL_DYNAPI_PROC(Uint32,SDL_MapRGBA,(const SDL_PixelFormatDetails *a, const SDL_Palette *b, Uint8 c, Uint8 d, Uint8 e, Uint8 f),(a,b,c,d,e,f),return)
|
||||
SDL_DYNAPI_PROC(Uint32,SDL_MapSurfaceRGB,(SDL_Surface *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(Uint32,SDL_MapSurfaceRGBA,(SDL_Surface *a, Uint8 b, Uint8 c, Uint8 d, Uint8 e),(a,b,c,d,e),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_MaximizeWindow,(SDL_Window *a),(a),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_MemoryBarrierAcquireFunction,(void),(),)
|
||||
SDL_DYNAPI_PROC(void,SDL_MemoryBarrierReleaseFunction,(void),(),)
|
||||
@@ -643,7 +644,7 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_PenConnected,(SDL_PenID a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_PlayHapticRumble,(SDL_Haptic *a, float b, Uint32 c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_PollEvent,(SDL_Event *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_PostSemaphore,(SDL_Semaphore *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_PremultiplyAlpha,(int a, int b, SDL_PixelFormatEnum c, const void *d, int e, SDL_PixelFormatEnum f, void *g, int h),(a,b,c,d,e,f,g,h),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_PremultiplyAlpha,(int a, int b, SDL_PixelFormat c, const void *d, int e, SDL_PixelFormat f, void *g, int h),(a,b,c,d,e,f,g,h),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_PumpEvents,(void),(),)
|
||||
SDL_DYNAPI_PROC(int,SDL_PushEvent,(SDL_Event *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_PutAudioStreamData,(SDL_AudioStream *a, const void *b, int c),(a,b,c),return)
|
||||
@@ -759,7 +760,6 @@ SDL_DYNAPI_PROC(int,SDL_SetMemoryFunctions,(SDL_malloc_func a, SDL_calloc_func b
|
||||
SDL_DYNAPI_PROC(void,SDL_SetModState,(SDL_Keymod a),(a),)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetNumberProperty,(SDL_PropertiesID a, const char *b, Sint64 c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetPaletteColors,(SDL_Palette *a, const SDL_Color *b, int c, int d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetPixelFormatPalette,(SDL_PixelFormat *a, SDL_Palette *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetPrimarySelectionText,(const char *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetProperty,(SDL_PropertiesID a, const char *b, void *c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetPropertyWithCleanup,(SDL_PropertiesID a, const char *b, void *c, SDL_CleanupPropertyCallback d, void *e),(a,b,c,d,e),return)
|
||||
@@ -783,7 +783,7 @@ SDL_DYNAPI_PROC(int,SDL_SetSurfaceColorKey,(SDL_Surface *a, int b, Uint32 c),(a,
|
||||
SDL_DYNAPI_PROC(int,SDL_SetSurfaceColorMod,(SDL_Surface *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetSurfaceColorspace,(SDL_Surface *a, SDL_Colorspace b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetSurfacePalette,(SDL_Surface *a, SDL_Palette *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetSurfaceRLE,(SDL_Surface *a, int b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetSurfaceRLE,(SDL_Surface *a, SDL_bool b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetTLS,(SDL_TLSID a, const void *b, SDL_TLSDestructorCallback c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetTextInputArea,(SDL_Window *a, const SDL_Rect *b, int c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetTextureAlphaMod,(SDL_Texture *a, Uint8 b),(a,b),return)
|
||||
|
||||
@@ -1493,8 +1493,8 @@ SDL_Cursor *SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (surface->format->format != SDL_PIXELFORMAT_ARGB8888) {
|
||||
temp = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ARGB8888);
|
||||
if (surface->format != SDL_PIXELFORMAT_ARGB8888) {
|
||||
temp = SDL_ConvertSurface(surface, SDL_PIXELFORMAT_ARGB8888);
|
||||
if (!temp) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+26
-35
@@ -142,9 +142,9 @@ void SDL_QuitRender(void)
|
||||
}
|
||||
}
|
||||
|
||||
int SDL_AddSupportedTextureFormat(SDL_Renderer *renderer, SDL_PixelFormatEnum format)
|
||||
int SDL_AddSupportedTextureFormat(SDL_Renderer *renderer, SDL_PixelFormat format)
|
||||
{
|
||||
SDL_PixelFormatEnum *texture_formats = (SDL_PixelFormatEnum *)SDL_realloc((void *)renderer->texture_formats, (renderer->num_texture_formats + 2) * sizeof(SDL_PixelFormatEnum));
|
||||
SDL_PixelFormat *texture_formats = (SDL_PixelFormat *)SDL_realloc((void *)renderer->texture_formats, (renderer->num_texture_formats + 2) * sizeof(SDL_PixelFormat));
|
||||
if (!texture_formats) {
|
||||
return -1;
|
||||
}
|
||||
@@ -1244,7 +1244,7 @@ static SDL_bool IsSupportedBlendMode(SDL_Renderer *renderer, SDL_BlendMode blend
|
||||
}
|
||||
}
|
||||
|
||||
static SDL_bool IsSupportedFormat(SDL_Renderer *renderer, SDL_PixelFormatEnum format)
|
||||
static SDL_bool IsSupportedFormat(SDL_Renderer *renderer, SDL_PixelFormat format)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1256,7 +1256,7 @@ static SDL_bool IsSupportedFormat(SDL_Renderer *renderer, SDL_PixelFormatEnum fo
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
static Uint32 GetClosestSupportedFormat(SDL_Renderer *renderer, SDL_PixelFormatEnum format)
|
||||
static Uint32 GetClosestSupportedFormat(SDL_Renderer *renderer, SDL_PixelFormat format)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1297,7 +1297,7 @@ static Uint32 GetClosestSupportedFormat(SDL_Renderer *renderer, SDL_PixelFormatE
|
||||
SDL_Texture *SDL_CreateTextureWithProperties(SDL_Renderer *renderer, SDL_PropertiesID props)
|
||||
{
|
||||
SDL_Texture *texture;
|
||||
SDL_PixelFormatEnum format = (SDL_PixelFormatEnum)SDL_GetNumberProperty(props, SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER, SDL_PIXELFORMAT_UNKNOWN);
|
||||
SDL_PixelFormat format = (SDL_PixelFormat)SDL_GetNumberProperty(props, SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER, SDL_PIXELFORMAT_UNKNOWN);
|
||||
int access = (int)SDL_GetNumberProperty(props, SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER, SDL_TEXTUREACCESS_STATIC);
|
||||
int w = (int)SDL_GetNumberProperty(props, SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER, 0);
|
||||
int h = (int)SDL_GetNumberProperty(props, SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER, 0);
|
||||
@@ -1451,7 +1451,7 @@ SDL_Texture *SDL_CreateTextureWithProperties(SDL_Renderer *renderer, SDL_Propert
|
||||
return texture;
|
||||
}
|
||||
|
||||
SDL_Texture *SDL_CreateTexture(SDL_Renderer *renderer, SDL_PixelFormatEnum format, int access, int w, int h)
|
||||
SDL_Texture *SDL_CreateTexture(SDL_Renderer *renderer, SDL_PixelFormat format, int access, int w, int h)
|
||||
{
|
||||
SDL_Texture *texture;
|
||||
SDL_PropertiesID props = SDL_CreateProperties();
|
||||
@@ -1466,56 +1466,53 @@ SDL_Texture *SDL_CreateTexture(SDL_Renderer *renderer, SDL_PixelFormatEnum forma
|
||||
|
||||
SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *surface)
|
||||
{
|
||||
const SDL_PixelFormat *fmt;
|
||||
SDL_bool needAlpha;
|
||||
SDL_bool direct_update;
|
||||
int i;
|
||||
SDL_PixelFormatEnum format = SDL_PIXELFORMAT_UNKNOWN;
|
||||
SDL_PixelFormat format = SDL_PIXELFORMAT_UNKNOWN;
|
||||
SDL_Palette *palette;
|
||||
SDL_Texture *texture;
|
||||
SDL_PropertiesID surface_props, props;
|
||||
SDL_PropertiesID props;
|
||||
SDL_Colorspace surface_colorspace = SDL_COLORSPACE_UNKNOWN;
|
||||
SDL_Colorspace texture_colorspace = SDL_COLORSPACE_UNKNOWN;
|
||||
|
||||
CHECK_RENDERER_MAGIC(renderer, NULL);
|
||||
|
||||
if (!surface) {
|
||||
if (!SDL_SurfaceValid(surface)) {
|
||||
SDL_InvalidParamError("SDL_CreateTextureFromSurface(): surface");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* See what the best texture format is */
|
||||
fmt = surface->format;
|
||||
if (fmt->Amask || SDL_SurfaceHasColorKey(surface)) {
|
||||
if (SDL_ISPIXELFORMAT_ALPHA(surface->format) || SDL_SurfaceHasColorKey(surface)) {
|
||||
needAlpha = SDL_TRUE;
|
||||
} else {
|
||||
needAlpha = SDL_FALSE;
|
||||
}
|
||||
|
||||
/* If Palette contains alpha values, promotes to alpha format */
|
||||
if (fmt->palette) {
|
||||
palette = SDL_GetSurfacePalette(surface);
|
||||
if (palette) {
|
||||
SDL_bool is_opaque, has_alpha_channel;
|
||||
SDL_DetectPalette(fmt->palette, &is_opaque, &has_alpha_channel);
|
||||
SDL_DetectPalette(palette, &is_opaque, &has_alpha_channel);
|
||||
if (!is_opaque) {
|
||||
needAlpha = SDL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (SDL_GetSurfaceColorspace(surface, &surface_colorspace) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
texture_colorspace = surface_colorspace;
|
||||
texture_colorspace = SDL_GetSurfaceColorspace(surface);
|
||||
|
||||
/* Try to have the best pixel format for the texture */
|
||||
/* No alpha, but a colorkey => promote to alpha */
|
||||
if (!fmt->Amask && SDL_SurfaceHasColorKey(surface)) {
|
||||
if (fmt->format == SDL_PIXELFORMAT_XRGB8888) {
|
||||
if (!SDL_ISPIXELFORMAT_ALPHA(surface->format) && SDL_SurfaceHasColorKey(surface)) {
|
||||
if (surface->format == SDL_PIXELFORMAT_XRGB8888) {
|
||||
for (i = 0; i < renderer->num_texture_formats; ++i) {
|
||||
if (renderer->texture_formats[i] == SDL_PIXELFORMAT_ARGB8888) {
|
||||
format = SDL_PIXELFORMAT_ARGB8888;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (fmt->format == SDL_PIXELFORMAT_XBGR8888) {
|
||||
} else if (surface->format == SDL_PIXELFORMAT_XBGR8888) {
|
||||
for (i = 0; i < renderer->num_texture_formats; ++i) {
|
||||
if (renderer->texture_formats[i] == SDL_PIXELFORMAT_ABGR8888) {
|
||||
format = SDL_PIXELFORMAT_ABGR8888;
|
||||
@@ -1526,15 +1523,15 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s
|
||||
} else {
|
||||
/* Exact match would be fine */
|
||||
for (i = 0; i < renderer->num_texture_formats; ++i) {
|
||||
if (renderer->texture_formats[i] == fmt->format) {
|
||||
format = fmt->format;
|
||||
if (renderer->texture_formats[i] == surface->format) {
|
||||
format = surface->format;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Look for 10-bit pixel formats if needed */
|
||||
if (format == SDL_PIXELFORMAT_UNKNOWN && SDL_ISPIXELFORMAT_10BIT(fmt->format)) {
|
||||
if (format == SDL_PIXELFORMAT_UNKNOWN && SDL_ISPIXELFORMAT_10BIT(surface->format)) {
|
||||
for (i = 0; i < renderer->num_texture_formats; ++i) {
|
||||
if (SDL_ISPIXELFORMAT_10BIT(renderer->texture_formats[i])) {
|
||||
format = renderer->texture_formats[i];
|
||||
@@ -1545,7 +1542,7 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s
|
||||
|
||||
/* Look for floating point pixel formats if needed */
|
||||
if (format == SDL_PIXELFORMAT_UNKNOWN &&
|
||||
(SDL_ISPIXELFORMAT_10BIT(fmt->format) || SDL_ISPIXELFORMAT_FLOAT(fmt->format))) {
|
||||
(SDL_ISPIXELFORMAT_10BIT(surface->format) || SDL_ISPIXELFORMAT_FLOAT(surface->format))) {
|
||||
for (i = 0; i < renderer->num_texture_formats; ++i) {
|
||||
if (SDL_ISPIXELFORMAT_FLOAT(renderer->texture_formats[i])) {
|
||||
format = renderer->texture_formats[i];
|
||||
@@ -1577,8 +1574,8 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s
|
||||
}
|
||||
}
|
||||
|
||||
if (format == surface->format->format && texture_colorspace == surface_colorspace) {
|
||||
if (surface->format->Amask && SDL_SurfaceHasColorKey(surface)) {
|
||||
if (format == surface->format && texture_colorspace == surface_colorspace) {
|
||||
if (SDL_ISPIXELFORMAT_ALPHA(surface->format) && SDL_SurfaceHasColorKey(surface)) {
|
||||
/* Surface and Renderer formats are identical.
|
||||
* Intermediate conversion is needed to convert color key to alpha (SDL_ConvertColorkeyToAlpha()). */
|
||||
direct_update = SDL_FALSE;
|
||||
@@ -1591,12 +1588,6 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s
|
||||
direct_update = SDL_FALSE;
|
||||
}
|
||||
|
||||
if (surface->flags & SDL_SURFACE_USES_PROPERTIES) {
|
||||
surface_props = SDL_GetSurfaceProperties(surface);
|
||||
} else {
|
||||
surface_props = 0;
|
||||
}
|
||||
|
||||
props = SDL_CreateProperties();
|
||||
SDL_SetNumberProperty(props, SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER, texture_colorspace);
|
||||
if (surface_colorspace == texture_colorspace) {
|
||||
@@ -1627,7 +1618,7 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s
|
||||
SDL_Surface *temp = NULL;
|
||||
|
||||
/* Set up a destination surface for the texture update */
|
||||
temp = SDL_ConvertSurfaceFormatAndColorspace(surface, format, texture_colorspace, surface_props);
|
||||
temp = SDL_ConvertSurfaceAndColorspace(surface, format, NULL, texture_colorspace, surface->internal->props);
|
||||
if (temp) {
|
||||
SDL_UpdateTexture(texture, NULL, temp->pixels, temp->pitch);
|
||||
SDL_DestroySurface(temp);
|
||||
@@ -2283,7 +2274,7 @@ int SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect, SDL_Sur
|
||||
return ret;
|
||||
}
|
||||
|
||||
texture->locked_surface = SDL_CreateSurfaceFrom(pixels, real_rect.w, real_rect.h, pitch, texture->format);
|
||||
texture->locked_surface = SDL_CreateSurfaceFrom(real_rect.w, real_rect.h, texture->format, pixels, pitch);
|
||||
if (!texture->locked_surface) {
|
||||
SDL_UnlockTexture(texture);
|
||||
return -1;
|
||||
|
||||
@@ -65,7 +65,7 @@ struct SDL_Texture
|
||||
SDL_Colorspace colorspace; /**< The colorspace of the texture */
|
||||
float SDR_white_point; /**< The SDR white point for this content */
|
||||
float HDR_headroom; /**< The HDR headroom needed by this content */
|
||||
SDL_PixelFormatEnum format; /**< The pixel format of the texture */
|
||||
SDL_PixelFormat format; /**< The pixel format of the texture */
|
||||
int access; /**< SDL_TextureAccess */
|
||||
int w; /**< The width of the texture */
|
||||
int h; /**< The height of the texture */
|
||||
@@ -217,7 +217,7 @@ struct SDL_Renderer
|
||||
|
||||
/* The current renderer info */
|
||||
const char *name;
|
||||
SDL_PixelFormatEnum *texture_formats;
|
||||
SDL_PixelFormat *texture_formats;
|
||||
int num_texture_formats;
|
||||
SDL_bool software;
|
||||
|
||||
@@ -320,7 +320,7 @@ extern SDL_RenderDriver VITA_GXM_RenderDriver;
|
||||
extern void SDL_QuitRender(void);
|
||||
|
||||
/* Add a supported texture format to a renderer */
|
||||
extern int SDL_AddSupportedTextureFormat(SDL_Renderer *renderer, SDL_PixelFormatEnum format);
|
||||
extern int SDL_AddSupportedTextureFormat(SDL_Renderer *renderer, SDL_PixelFormat format);
|
||||
|
||||
/* Setup colorspace conversion */
|
||||
extern void SDL_SetupRendererColorspace(SDL_Renderer *renderer, SDL_PropertiesID props);
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "SDL_yuv_sw_c.h"
|
||||
#include "../video/SDL_yuv_c.h"
|
||||
|
||||
SDL_SW_YUVTexture *SDL_SW_CreateYUVTexture(SDL_PixelFormatEnum format, int w, int h)
|
||||
SDL_SW_YUVTexture *SDL_SW_CreateYUVTexture(SDL_PixelFormat format, int w, int h)
|
||||
{
|
||||
SDL_SW_YUVTexture *swdata;
|
||||
|
||||
@@ -336,7 +336,7 @@ void SDL_SW_UnlockYUVTexture(SDL_SW_YUVTexture *swdata)
|
||||
}
|
||||
|
||||
int SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture *swdata, const SDL_Rect *srcrect,
|
||||
SDL_PixelFormatEnum target_format, int w, int h, void *pixels,
|
||||
SDL_PixelFormat target_format, int w, int h, void *pixels,
|
||||
int pitch)
|
||||
{
|
||||
int stretch;
|
||||
@@ -365,7 +365,7 @@ int SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture *swdata, const SDL_Rect *srcrect,
|
||||
swdata->display->pixels = pixels;
|
||||
swdata->display->pitch = pitch;
|
||||
} else {
|
||||
swdata->display = SDL_CreateSurfaceFrom(pixels, w, h, pitch, target_format);
|
||||
swdata->display = SDL_CreateSurfaceFrom(w, h, target_format, pixels, pitch);
|
||||
if (!swdata->display) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
|
||||
struct SDL_SW_YUVTexture
|
||||
{
|
||||
SDL_PixelFormatEnum format;
|
||||
SDL_PixelFormatEnum target_format;
|
||||
SDL_PixelFormat format;
|
||||
SDL_PixelFormat target_format;
|
||||
int w, h;
|
||||
Uint8 *pixels;
|
||||
|
||||
@@ -44,7 +44,7 @@ struct SDL_SW_YUVTexture
|
||||
|
||||
typedef struct SDL_SW_YUVTexture SDL_SW_YUVTexture;
|
||||
|
||||
SDL_SW_YUVTexture *SDL_SW_CreateYUVTexture(SDL_PixelFormatEnum format, int w, int h);
|
||||
SDL_SW_YUVTexture *SDL_SW_CreateYUVTexture(SDL_PixelFormat format, int w, int h);
|
||||
int SDL_SW_QueryYUVTexturePixels(SDL_SW_YUVTexture *swdata, void **pixels,
|
||||
int *pitch);
|
||||
int SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture *swdata, const SDL_Rect *rect,
|
||||
@@ -60,7 +60,7 @@ int SDL_SW_LockYUVTexture(SDL_SW_YUVTexture *swdata, const SDL_Rect *rect,
|
||||
void **pixels, int *pitch);
|
||||
void SDL_SW_UnlockYUVTexture(SDL_SW_YUVTexture *swdata);
|
||||
int SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture *swdata, const SDL_Rect *srcrect,
|
||||
SDL_PixelFormatEnum target_format, int w, int h, void *pixels,
|
||||
SDL_PixelFormat target_format, int w, int h, void *pixels,
|
||||
int pitch);
|
||||
void SDL_SW_DestroyYUVTexture(SDL_SW_YUVTexture *swdata);
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ static D3DFORMAT PixelFormatToD3DFMT(Uint32 format)
|
||||
}
|
||||
}
|
||||
|
||||
static SDL_PixelFormatEnum D3DFMTToPixelFormat(D3DFORMAT format)
|
||||
static SDL_PixelFormat D3DFMTToPixelFormat(D3DFORMAT format)
|
||||
{
|
||||
switch (format) {
|
||||
case D3DFMT_R5G6B5:
|
||||
|
||||
@@ -244,7 +244,7 @@ static const GUID SDL_DXGI_DEBUG_ALL = { 0xe48ae283, 0xda80, 0x490b, { 0x87, 0xe
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
SDL_PixelFormatEnum D3D11_DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat)
|
||||
SDL_PixelFormat D3D11_DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat)
|
||||
{
|
||||
switch (dxgiFormat) {
|
||||
case DXGI_FORMAT_B8G8R8A8_UNORM:
|
||||
|
||||
@@ -361,7 +361,7 @@ static UINT D3D12_Align(UINT location, UINT alignment)
|
||||
return (location + (alignment - 1)) & ~(alignment - 1);
|
||||
}
|
||||
|
||||
static SDL_PixelFormatEnum D3D12_DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat)
|
||||
static SDL_PixelFormat D3D12_DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat)
|
||||
{
|
||||
switch (dxgiFormat) {
|
||||
case DXGI_FORMAT_B8G8R8A8_UNORM:
|
||||
|
||||
@@ -1450,7 +1450,7 @@ static int GL_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
|
||||
static SDL_Surface *GL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
|
||||
{
|
||||
GL_RenderData *data = (GL_RenderData *)renderer->driverdata;
|
||||
SDL_PixelFormatEnum format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ARGB8888;
|
||||
SDL_PixelFormat format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ARGB8888;
|
||||
GLint internalFormat;
|
||||
GLenum targetFormat, type;
|
||||
int w, h;
|
||||
|
||||
@@ -1966,7 +1966,7 @@ static void GLES2_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
static SDL_Surface *GLES2_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
|
||||
{
|
||||
GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
|
||||
SDL_PixelFormatEnum format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_RGBA32;
|
||||
SDL_PixelFormat format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_RGBA32;
|
||||
int w, h;
|
||||
SDL_Surface *surface;
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ static int SDL_BlendFillRect_ARGB8888(SDL_Surface *dst, const SDL_Rect *rect,
|
||||
static int SDL_BlendFillRect_RGB(SDL_Surface *dst, const SDL_Rect *rect,
|
||||
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
|
||||
{
|
||||
SDL_PixelFormat *fmt = dst->format;
|
||||
const SDL_PixelFormatDetails *fmt = dst->internal->format;
|
||||
unsigned inva = 0xff - a;
|
||||
|
||||
switch (fmt->bytes_per_pixel) {
|
||||
@@ -178,7 +178,7 @@ static int SDL_BlendFillRect_RGB(SDL_Surface *dst, const SDL_Rect *rect,
|
||||
static int SDL_BlendFillRect_RGBA(SDL_Surface *dst, const SDL_Rect *rect,
|
||||
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
|
||||
{
|
||||
SDL_PixelFormat *fmt = dst->format;
|
||||
const SDL_PixelFormatDetails *fmt = dst->internal->format;
|
||||
unsigned inva = 0xff - a;
|
||||
|
||||
switch (fmt->bytes_per_pixel) {
|
||||
@@ -211,24 +211,24 @@ int SDL_BlendFillRect(SDL_Surface *dst, const SDL_Rect *rect,
|
||||
{
|
||||
SDL_Rect clipped;
|
||||
|
||||
if (!dst) {
|
||||
if (!SDL_SurfaceValid(dst)) {
|
||||
return SDL_InvalidParamError("SDL_BlendFillRect(): dst");
|
||||
}
|
||||
|
||||
/* This function doesn't work on surfaces < 8 bpp */
|
||||
if (dst->format->bits_per_pixel < 8) {
|
||||
if (SDL_BITSPERPIXEL(dst->format) < 8) {
|
||||
return SDL_SetError("SDL_BlendFillRect(): Unsupported surface format");
|
||||
}
|
||||
|
||||
/* If 'rect' == NULL, then fill the whole surface */
|
||||
if (rect) {
|
||||
/* Perform clipping */
|
||||
if (!SDL_GetRectIntersection(rect, &dst->clip_rect, &clipped)) {
|
||||
if (!SDL_GetRectIntersection(rect, &dst->internal->clip_rect, &clipped)) {
|
||||
return 0;
|
||||
}
|
||||
rect = &clipped;
|
||||
} else {
|
||||
rect = &dst->clip_rect;
|
||||
rect = &dst->internal->clip_rect;
|
||||
}
|
||||
|
||||
if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
|
||||
@@ -237,23 +237,23 @@ int SDL_BlendFillRect(SDL_Surface *dst, const SDL_Rect *rect,
|
||||
b = DRAW_MUL(b, a);
|
||||
}
|
||||
|
||||
switch (dst->format->bits_per_pixel) {
|
||||
switch (dst->internal->format->bits_per_pixel) {
|
||||
case 15:
|
||||
switch (dst->format->Rmask) {
|
||||
switch (dst->internal->format->Rmask) {
|
||||
case 0x7C00:
|
||||
return SDL_BlendFillRect_RGB555(dst, rect, blendMode, r, g, b, a);
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
switch (dst->format->Rmask) {
|
||||
switch (dst->internal->format->Rmask) {
|
||||
case 0xF800:
|
||||
return SDL_BlendFillRect_RGB565(dst, rect, blendMode, r, g, b, a);
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
switch (dst->format->Rmask) {
|
||||
switch (dst->internal->format->Rmask) {
|
||||
case 0x00FF0000:
|
||||
if (!dst->format->Amask) {
|
||||
if (!dst->internal->format->Amask) {
|
||||
return SDL_BlendFillRect_XRGB8888(dst, rect, blendMode, r, g, b, a);
|
||||
} else {
|
||||
return SDL_BlendFillRect_ARGB8888(dst, rect, blendMode, r, g, b, a);
|
||||
@@ -265,7 +265,7 @@ int SDL_BlendFillRect(SDL_Surface *dst, const SDL_Rect *rect,
|
||||
break;
|
||||
}
|
||||
|
||||
if (!dst->format->Amask) {
|
||||
if (!dst->internal->format->Amask) {
|
||||
return SDL_BlendFillRect_RGB(dst, rect, blendMode, r, g, b, a);
|
||||
} else {
|
||||
return SDL_BlendFillRect_RGBA(dst, rect, blendMode, r, g, b, a);
|
||||
@@ -281,12 +281,12 @@ int SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
|
||||
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) = NULL;
|
||||
int status = 0;
|
||||
|
||||
if (!dst) {
|
||||
if (!SDL_SurfaceValid(dst)) {
|
||||
return SDL_InvalidParamError("SDL_BlendFillRects(): dst");
|
||||
}
|
||||
|
||||
/* This function doesn't work on surfaces < 8 bpp */
|
||||
if (dst->format->bits_per_pixel < 8) {
|
||||
if (dst->internal->format->bits_per_pixel < 8) {
|
||||
return SDL_SetError("SDL_BlendFillRects(): Unsupported surface format");
|
||||
}
|
||||
|
||||
@@ -297,23 +297,23 @@ int SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
|
||||
}
|
||||
|
||||
/* FIXME: Does this function pointer slow things down significantly? */
|
||||
switch (dst->format->bits_per_pixel) {
|
||||
switch (dst->internal->format->bits_per_pixel) {
|
||||
case 15:
|
||||
switch (dst->format->Rmask) {
|
||||
switch (dst->internal->format->Rmask) {
|
||||
case 0x7C00:
|
||||
func = SDL_BlendFillRect_RGB555;
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
switch (dst->format->Rmask) {
|
||||
switch (dst->internal->format->Rmask) {
|
||||
case 0xF800:
|
||||
func = SDL_BlendFillRect_RGB565;
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
switch (dst->format->Rmask) {
|
||||
switch (dst->internal->format->Rmask) {
|
||||
case 0x00FF0000:
|
||||
if (!dst->format->Amask) {
|
||||
if (!dst->internal->format->Amask) {
|
||||
func = SDL_BlendFillRect_XRGB8888;
|
||||
} else {
|
||||
func = SDL_BlendFillRect_ARGB8888;
|
||||
@@ -326,7 +326,7 @@ int SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
|
||||
}
|
||||
|
||||
if (!func) {
|
||||
if (!dst->format->Amask) {
|
||||
if (!dst->internal->format->Amask) {
|
||||
func = SDL_BlendFillRect_RGB;
|
||||
} else {
|
||||
func = SDL_BlendFillRect_RGBA;
|
||||
@@ -335,7 +335,7 @@ int SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
|
||||
|
||||
for (i = 0; i < count; ++i) {
|
||||
/* Perform clipping */
|
||||
if (!SDL_GetRectIntersection(&rects[i], &dst->clip_rect, &rect)) {
|
||||
if (!SDL_GetRectIntersection(&rects[i], &dst->internal->clip_rect, &rect)) {
|
||||
continue;
|
||||
}
|
||||
status = func(dst, &rect, blendMode, r, g, b, a);
|
||||
|
||||
@@ -30,7 +30,7 @@ static void SDL_BlendLine_RGB2(SDL_Surface *dst, int x1, int y1, int x2, int y2,
|
||||
SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
|
||||
SDL_bool draw_end)
|
||||
{
|
||||
const SDL_PixelFormat *fmt = dst->format;
|
||||
const SDL_PixelFormatDetails *fmt = dst->internal->format;
|
||||
unsigned r, g, b, a, inva;
|
||||
|
||||
if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
|
||||
@@ -343,7 +343,7 @@ static void SDL_BlendLine_RGB4(SDL_Surface *dst, int x1, int y1, int x2, int y2,
|
||||
SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
|
||||
SDL_bool draw_end)
|
||||
{
|
||||
const SDL_PixelFormat *fmt = dst->format;
|
||||
const SDL_PixelFormatDetails *fmt = dst->internal->format;
|
||||
unsigned r, g, b, a, inva;
|
||||
|
||||
if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
|
||||
@@ -448,7 +448,7 @@ static void SDL_BlendLine_RGBA4(SDL_Surface *dst, int x1, int y1, int x2, int y2
|
||||
SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
|
||||
SDL_bool draw_end)
|
||||
{
|
||||
const SDL_PixelFormat *fmt = dst->format;
|
||||
const SDL_PixelFormatDetails *fmt = dst->internal->format;
|
||||
unsigned r, g, b, a, inva;
|
||||
|
||||
if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
|
||||
@@ -763,7 +763,7 @@ typedef void (*BlendLineFunc)(SDL_Surface *dst,
|
||||
Uint8 r, Uint8 g, Uint8 b, Uint8 a,
|
||||
SDL_bool draw_end);
|
||||
|
||||
static BlendLineFunc SDL_CalculateBlendLineFunc(const SDL_PixelFormat *fmt)
|
||||
static BlendLineFunc SDL_CalculateBlendLineFunc(const SDL_PixelFormatDetails *fmt)
|
||||
{
|
||||
switch (fmt->bytes_per_pixel) {
|
||||
case 2:
|
||||
@@ -798,18 +798,18 @@ int SDL_BlendLine(SDL_Surface *dst, int x1, int y1, int x2, int y2,
|
||||
{
|
||||
BlendLineFunc func;
|
||||
|
||||
if (!dst) {
|
||||
if (!SDL_SurfaceValid(dst)) {
|
||||
return SDL_InvalidParamError("SDL_BlendLine(): dst");
|
||||
}
|
||||
|
||||
func = SDL_CalculateBlendLineFunc(dst->format);
|
||||
func = SDL_CalculateBlendLineFunc(dst->internal->format);
|
||||
if (!func) {
|
||||
return SDL_SetError("SDL_BlendLine(): Unsupported surface format");
|
||||
}
|
||||
|
||||
/* Perform clipping */
|
||||
/* FIXME: We don't actually want to clip, as it may change line slope */
|
||||
if (!SDL_GetRectAndLineIntersection(&dst->clip_rect, &x1, &y1, &x2, &y2)) {
|
||||
if (!SDL_GetRectAndLineIntersection(&dst->internal->clip_rect, &x1, &y1, &x2, &y2)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -826,11 +826,11 @@ int SDL_BlendLines(SDL_Surface *dst, const SDL_Point *points, int count,
|
||||
SDL_bool draw_end;
|
||||
BlendLineFunc func;
|
||||
|
||||
if (!dst) {
|
||||
if (!SDL_SurfaceValid(dst)) {
|
||||
return SDL_SetError("SDL_BlendLines(): Passed NULL destination surface");
|
||||
}
|
||||
|
||||
func = SDL_CalculateBlendLineFunc(dst->format);
|
||||
func = SDL_CalculateBlendLineFunc(dst->internal->format);
|
||||
if (!func) {
|
||||
return SDL_SetError("SDL_BlendLines(): Unsupported surface format");
|
||||
}
|
||||
@@ -843,7 +843,7 @@ int SDL_BlendLines(SDL_Surface *dst, const SDL_Point *points, int count,
|
||||
|
||||
/* Perform clipping */
|
||||
/* FIXME: We don't actually want to clip, as it may change line slope */
|
||||
if (!SDL_GetRectAndLineIntersection(&dst->clip_rect, &x1, &y1, &x2, &y2)) {
|
||||
if (!SDL_GetRectAndLineIntersection(&dst->internal->clip_rect, &x1, &y1, &x2, &y2)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ static int SDL_BlendPoint_ARGB8888(SDL_Surface *dst, int x, int y, SDL_BlendMode
|
||||
static int SDL_BlendPoint_RGB(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r,
|
||||
Uint8 g, Uint8 b, Uint8 a)
|
||||
{
|
||||
SDL_PixelFormat *fmt = dst->format;
|
||||
const SDL_PixelFormatDetails *fmt = dst->internal->format;
|
||||
unsigned inva = 0xff - a;
|
||||
|
||||
switch (fmt->bytes_per_pixel) {
|
||||
@@ -178,7 +178,7 @@ static int SDL_BlendPoint_RGB(SDL_Surface *dst, int x, int y, SDL_BlendMode blen
|
||||
static int SDL_BlendPoint_RGBA(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r,
|
||||
Uint8 g, Uint8 b, Uint8 a)
|
||||
{
|
||||
SDL_PixelFormat *fmt = dst->format;
|
||||
const SDL_PixelFormatDetails *fmt = dst->internal->format;
|
||||
unsigned inva = 0xff - a;
|
||||
|
||||
switch (fmt->bytes_per_pixel) {
|
||||
@@ -209,19 +209,19 @@ static int SDL_BlendPoint_RGBA(SDL_Surface *dst, int x, int y, SDL_BlendMode ble
|
||||
int SDL_BlendPoint(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r,
|
||||
Uint8 g, Uint8 b, Uint8 a)
|
||||
{
|
||||
if (!dst) {
|
||||
if (!SDL_SurfaceValid(dst)) {
|
||||
return SDL_InvalidParamError("SDL_BlendPoint(): dst");
|
||||
}
|
||||
|
||||
/* This function doesn't work on surfaces < 8 bpp */
|
||||
if (dst->format->bits_per_pixel < 8) {
|
||||
if (SDL_BITSPERPIXEL(dst->format) < 8) {
|
||||
return SDL_SetError("SDL_BlendPoint(): Unsupported surface format");
|
||||
}
|
||||
|
||||
/* Perform clipping */
|
||||
if (x < dst->clip_rect.x || y < dst->clip_rect.y ||
|
||||
x >= (dst->clip_rect.x + dst->clip_rect.w) ||
|
||||
y >= (dst->clip_rect.y + dst->clip_rect.h)) {
|
||||
if (x < dst->internal->clip_rect.x || y < dst->internal->clip_rect.y ||
|
||||
x >= (dst->internal->clip_rect.x + dst->internal->clip_rect.w) ||
|
||||
y >= (dst->internal->clip_rect.y + dst->internal->clip_rect.h)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -231,23 +231,23 @@ int SDL_BlendPoint(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint
|
||||
b = DRAW_MUL(b, a);
|
||||
}
|
||||
|
||||
switch (dst->format->bits_per_pixel) {
|
||||
switch (dst->internal->format->bits_per_pixel) {
|
||||
case 15:
|
||||
switch (dst->format->Rmask) {
|
||||
switch (dst->internal->format->Rmask) {
|
||||
case 0x7C00:
|
||||
return SDL_BlendPoint_RGB555(dst, x, y, blendMode, r, g, b, a);
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
switch (dst->format->Rmask) {
|
||||
switch (dst->internal->format->Rmask) {
|
||||
case 0xF800:
|
||||
return SDL_BlendPoint_RGB565(dst, x, y, blendMode, r, g, b, a);
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
switch (dst->format->Rmask) {
|
||||
switch (dst->internal->format->Rmask) {
|
||||
case 0x00FF0000:
|
||||
if (!dst->format->Amask) {
|
||||
if (!dst->internal->format->Amask) {
|
||||
return SDL_BlendPoint_XRGB8888(dst, x, y, blendMode, r, g, b, a);
|
||||
} else {
|
||||
return SDL_BlendPoint_ARGB8888(dst, x, y, blendMode, r, g, b, a);
|
||||
@@ -259,7 +259,7 @@ int SDL_BlendPoint(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint
|
||||
break;
|
||||
}
|
||||
|
||||
if (!dst->format->Amask) {
|
||||
if (!dst->internal->format->Amask) {
|
||||
return SDL_BlendPoint_RGB(dst, x, y, blendMode, r, g, b, a);
|
||||
} else {
|
||||
return SDL_BlendPoint_RGBA(dst, x, y, blendMode, r, g, b, a);
|
||||
@@ -277,12 +277,12 @@ int SDL_BlendPoints(SDL_Surface *dst, const SDL_Point *points, int count,
|
||||
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) = NULL;
|
||||
int status = 0;
|
||||
|
||||
if (!dst) {
|
||||
if (!SDL_SurfaceValid(dst)) {
|
||||
return SDL_InvalidParamError("SDL_BlendPoints(): dst");
|
||||
}
|
||||
|
||||
/* This function doesn't work on surfaces < 8 bpp */
|
||||
if (dst->format->bits_per_pixel < 8) {
|
||||
if (dst->internal->format->bits_per_pixel < 8) {
|
||||
return SDL_SetError("SDL_BlendPoints(): Unsupported surface format");
|
||||
}
|
||||
|
||||
@@ -293,25 +293,25 @@ int SDL_BlendPoints(SDL_Surface *dst, const SDL_Point *points, int count,
|
||||
}
|
||||
|
||||
/* FIXME: Does this function pointer slow things down significantly? */
|
||||
switch (dst->format->bits_per_pixel) {
|
||||
switch (dst->internal->format->bits_per_pixel) {
|
||||
case 15:
|
||||
switch (dst->format->Rmask) {
|
||||
switch (dst->internal->format->Rmask) {
|
||||
case 0x7C00:
|
||||
func = SDL_BlendPoint_RGB555;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
switch (dst->format->Rmask) {
|
||||
switch (dst->internal->format->Rmask) {
|
||||
case 0xF800:
|
||||
func = SDL_BlendPoint_RGB565;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
switch (dst->format->Rmask) {
|
||||
switch (dst->internal->format->Rmask) {
|
||||
case 0x00FF0000:
|
||||
if (!dst->format->Amask) {
|
||||
if (!dst->internal->format->Amask) {
|
||||
func = SDL_BlendPoint_XRGB8888;
|
||||
} else {
|
||||
func = SDL_BlendPoint_ARGB8888;
|
||||
@@ -324,17 +324,17 @@ int SDL_BlendPoints(SDL_Surface *dst, const SDL_Point *points, int count,
|
||||
}
|
||||
|
||||
if (!func) {
|
||||
if (!dst->format->Amask) {
|
||||
if (!dst->internal->format->Amask) {
|
||||
func = SDL_BlendPoint_RGB;
|
||||
} else {
|
||||
func = SDL_BlendPoint_RGBA;
|
||||
}
|
||||
}
|
||||
|
||||
minx = dst->clip_rect.x;
|
||||
maxx = dst->clip_rect.x + dst->clip_rect.w - 1;
|
||||
miny = dst->clip_rect.y;
|
||||
maxy = dst->clip_rect.y + dst->clip_rect.h - 1;
|
||||
minx = dst->internal->clip_rect.x;
|
||||
maxx = dst->internal->clip_rect.x + dst->internal->clip_rect.w - 1;
|
||||
miny = dst->internal->clip_rect.y;
|
||||
maxy = dst->internal->clip_rect.y + dst->internal->clip_rect.h - 1;
|
||||
|
||||
for (i = 0; i < count; ++i) {
|
||||
x = points[i].x;
|
||||
|
||||
@@ -364,7 +364,7 @@
|
||||
#define HLINE(type, op, draw_end) \
|
||||
{ \
|
||||
int length; \
|
||||
int pitch = (dst->pitch / dst->format->bytes_per_pixel); \
|
||||
int pitch = (dst->pitch / dst->internal->format->bytes_per_pixel); \
|
||||
type *pixel; \
|
||||
if (x1 <= x2) { \
|
||||
pixel = (type *)dst->pixels + y1 * pitch + x1; \
|
||||
@@ -386,7 +386,7 @@
|
||||
#define VLINE(type, op, draw_end) \
|
||||
{ \
|
||||
int length; \
|
||||
int pitch = (dst->pitch / dst->format->bytes_per_pixel); \
|
||||
int pitch = (dst->pitch / dst->internal->format->bytes_per_pixel); \
|
||||
type *pixel; \
|
||||
if (y1 <= y2) { \
|
||||
pixel = (type *)dst->pixels + y1 * pitch + x1; \
|
||||
@@ -408,7 +408,7 @@
|
||||
#define DLINE(type, op, draw_end) \
|
||||
{ \
|
||||
int length; \
|
||||
int pitch = (dst->pitch / dst->format->bytes_per_pixel); \
|
||||
int pitch = (dst->pitch / dst->internal->format->bytes_per_pixel); \
|
||||
type *pixel; \
|
||||
if (y1 <= y2) { \
|
||||
pixel = (type *)dst->pixels + y1 * pitch + x1; \
|
||||
@@ -628,7 +628,7 @@
|
||||
do { \
|
||||
int width = rect->w; \
|
||||
int height = rect->h; \
|
||||
int pitch = (dst->pitch / dst->format->bytes_per_pixel); \
|
||||
int pitch = (dst->pitch / dst->internal->format->bytes_per_pixel); \
|
||||
int skip = pitch - width; \
|
||||
type *pixel = (type *)dst->pixels + rect->y * pitch + rect->x; \
|
||||
while (height--) { \
|
||||
|
||||
@@ -31,7 +31,7 @@ static void SDL_DrawLine1(SDL_Surface *dst, int x1, int y1, int x2, int y2, Uint
|
||||
{
|
||||
if (y1 == y2) {
|
||||
int length;
|
||||
int pitch = (dst->pitch / dst->format->bytes_per_pixel);
|
||||
int pitch = (dst->pitch / dst->internal->format->bytes_per_pixel);
|
||||
Uint8 *pixel;
|
||||
if (x1 <= x2) {
|
||||
pixel = (Uint8 *)dst->pixels + y1 * pitch + x1;
|
||||
@@ -64,8 +64,8 @@ static void SDL_DrawLine2(SDL_Surface *dst, int x1, int y1, int x2, int y2, Uint
|
||||
DLINE(Uint16, DRAW_FASTSETPIXEL2, draw_end);
|
||||
} else {
|
||||
Uint8 _r, _g, _b, _a;
|
||||
const SDL_PixelFormat *fmt = dst->format;
|
||||
SDL_GetRGBA(color, fmt, &_r, &_g, &_b, &_a);
|
||||
const SDL_PixelFormatDetails *fmt = dst->internal->format;
|
||||
SDL_GetRGBA(color, fmt, dst->internal->palette, &_r, &_g, &_b, &_a);
|
||||
if (fmt->Rmask == 0x7C00) {
|
||||
AALINE(x1, y1, x2, y2,
|
||||
DRAW_FASTSETPIXELXY2, DRAW_SETPIXELXY_BLEND_RGB555,
|
||||
@@ -93,8 +93,8 @@ static void SDL_DrawLine4(SDL_Surface *dst, int x1, int y1, int x2, int y2, Uint
|
||||
DLINE(Uint32, DRAW_FASTSETPIXEL4, draw_end);
|
||||
} else {
|
||||
Uint8 _r, _g, _b, _a;
|
||||
const SDL_PixelFormat *fmt = dst->format;
|
||||
SDL_GetRGBA(color, fmt, &_r, &_g, &_b, &_a);
|
||||
const SDL_PixelFormatDetails *fmt = dst->internal->format;
|
||||
SDL_GetRGBA(color, fmt, dst->internal->palette, &_r, &_g, &_b, &_a);
|
||||
if (fmt->Rmask == 0x00FF0000) {
|
||||
if (!fmt->Amask) {
|
||||
AALINE(x1, y1, x2, y2,
|
||||
@@ -117,7 +117,7 @@ typedef void (*DrawLineFunc)(SDL_Surface *dst,
|
||||
int x1, int y1, int x2, int y2,
|
||||
Uint32 color, SDL_bool draw_end);
|
||||
|
||||
static DrawLineFunc SDL_CalculateDrawLineFunc(const SDL_PixelFormat *fmt)
|
||||
static DrawLineFunc SDL_CalculateDrawLineFunc(const SDL_PixelFormatDetails *fmt)
|
||||
{
|
||||
switch (fmt->bytes_per_pixel) {
|
||||
case 1:
|
||||
@@ -137,18 +137,18 @@ int SDL_DrawLine(SDL_Surface *dst, int x1, int y1, int x2, int y2, Uint32 color)
|
||||
{
|
||||
DrawLineFunc func;
|
||||
|
||||
if (!dst) {
|
||||
if (!SDL_SurfaceValid(dst)) {
|
||||
return SDL_InvalidParamError("SDL_DrawLine(): dst");
|
||||
}
|
||||
|
||||
func = SDL_CalculateDrawLineFunc(dst->format);
|
||||
func = SDL_CalculateDrawLineFunc(dst->internal->format);
|
||||
if (!func) {
|
||||
return SDL_SetError("SDL_DrawLine(): Unsupported surface format");
|
||||
}
|
||||
|
||||
/* Perform clipping */
|
||||
/* FIXME: We don't actually want to clip, as it may change line slope */
|
||||
if (!SDL_GetRectAndLineIntersection(&dst->clip_rect, &x1, &y1, &x2, &y2)) {
|
||||
if (!SDL_GetRectAndLineIntersection(&dst->internal->clip_rect, &x1, &y1, &x2, &y2)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -165,11 +165,11 @@ int SDL_DrawLines(SDL_Surface *dst, const SDL_Point *points, int count,
|
||||
SDL_bool draw_end;
|
||||
DrawLineFunc func;
|
||||
|
||||
if (!dst) {
|
||||
if (!SDL_SurfaceValid(dst)) {
|
||||
return SDL_InvalidParamError("SDL_DrawLines(): dst");
|
||||
}
|
||||
|
||||
func = SDL_CalculateDrawLineFunc(dst->format);
|
||||
func = SDL_CalculateDrawLineFunc(dst->internal->format);
|
||||
if (!func) {
|
||||
return SDL_SetError("SDL_DrawLines(): Unsupported surface format");
|
||||
}
|
||||
@@ -182,7 +182,7 @@ int SDL_DrawLines(SDL_Surface *dst, const SDL_Point *points, int count,
|
||||
|
||||
/* Perform clipping */
|
||||
/* FIXME: We don't actually want to clip, as it may change line slope */
|
||||
if (!SDL_GetRectAndLineIntersection(&dst->clip_rect, &x1, &y1, &x2, &y2)) {
|
||||
if (!SDL_GetRectAndLineIntersection(&dst->internal->clip_rect, &x1, &y1, &x2, &y2)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,23 +27,23 @@
|
||||
|
||||
int SDL_DrawPoint(SDL_Surface *dst, int x, int y, Uint32 color)
|
||||
{
|
||||
if (!dst) {
|
||||
if (!SDL_SurfaceValid(dst)) {
|
||||
return SDL_InvalidParamError("SDL_DrawPoint(): dst");
|
||||
}
|
||||
|
||||
/* This function doesn't work on surfaces < 8 bpp */
|
||||
if (dst->format->bits_per_pixel < 8) {
|
||||
if (dst->internal->format->bits_per_pixel < 8) {
|
||||
return SDL_SetError("SDL_DrawPoint(): Unsupported surface format");
|
||||
}
|
||||
|
||||
/* Perform clipping */
|
||||
if (x < dst->clip_rect.x || y < dst->clip_rect.y ||
|
||||
x >= (dst->clip_rect.x + dst->clip_rect.w) ||
|
||||
y >= (dst->clip_rect.y + dst->clip_rect.h)) {
|
||||
if (x < dst->internal->clip_rect.x || y < dst->internal->clip_rect.y ||
|
||||
x >= (dst->internal->clip_rect.x + dst->internal->clip_rect.w) ||
|
||||
y >= (dst->internal->clip_rect.y + dst->internal->clip_rect.h)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (dst->format->bytes_per_pixel) {
|
||||
switch (dst->internal->format->bytes_per_pixel) {
|
||||
case 1:
|
||||
DRAW_FASTSETPIXELXY1(x, y);
|
||||
break;
|
||||
@@ -67,19 +67,19 @@ int SDL_DrawPoints(SDL_Surface *dst, const SDL_Point *points, int count,
|
||||
int i;
|
||||
int x, y;
|
||||
|
||||
if (!dst) {
|
||||
if (!SDL_SurfaceValid(dst)) {
|
||||
return SDL_InvalidParamError("SDL_DrawPoints(): dst");
|
||||
}
|
||||
|
||||
/* This function doesn't work on surfaces < 8 bpp */
|
||||
if (dst->format->bits_per_pixel < 8) {
|
||||
if (dst->internal->format->bits_per_pixel < 8) {
|
||||
return SDL_SetError("SDL_DrawPoints(): Unsupported surface format");
|
||||
}
|
||||
|
||||
minx = dst->clip_rect.x;
|
||||
maxx = dst->clip_rect.x + dst->clip_rect.w - 1;
|
||||
miny = dst->clip_rect.y;
|
||||
maxy = dst->clip_rect.y + dst->clip_rect.h - 1;
|
||||
minx = dst->internal->clip_rect.x;
|
||||
maxx = dst->internal->clip_rect.x + dst->internal->clip_rect.w - 1;
|
||||
miny = dst->internal->clip_rect.y;
|
||||
maxy = dst->internal->clip_rect.y + dst->internal->clip_rect.h - 1;
|
||||
|
||||
for (i = 0; i < count; ++i) {
|
||||
x = points[i].x;
|
||||
@@ -89,7 +89,7 @@ int SDL_DrawPoints(SDL_Surface *dst, const SDL_Point *points, int count,
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (dst->format->bytes_per_pixel) {
|
||||
switch (dst->internal->format->bytes_per_pixel) {
|
||||
case 1:
|
||||
DRAW_FASTSETPIXELXY1(x, y);
|
||||
break;
|
||||
|
||||
@@ -104,7 +104,7 @@ static int SW_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Pr
|
||||
SDL_Surface *surface = SDL_CreateSurface(texture->w, texture->h, texture->format);
|
||||
Uint8 r, g, b, a;
|
||||
|
||||
if (!surface) {
|
||||
if (!SDL_SurfaceValid(surface)) {
|
||||
return SDL_SetError("Cannot create surface");
|
||||
}
|
||||
texture->driverdata = surface;
|
||||
@@ -119,7 +119,7 @@ static int SW_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Pr
|
||||
/* Only RLE encode textures without an alpha channel since the RLE coder
|
||||
* discards the color values of pixels with an alpha value of zero.
|
||||
*/
|
||||
if (texture->access == SDL_TEXTUREACCESS_STATIC && !surface->format->Amask) {
|
||||
if (texture->access == SDL_TEXTUREACCESS_STATIC && !SDL_ISPIXELFORMAT_ALPHA(surface->format)) {
|
||||
SDL_SetSurfaceRLE(surface, 1);
|
||||
}
|
||||
|
||||
@@ -140,8 +140,8 @@ static int SW_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||
src = (Uint8 *)pixels;
|
||||
dst = (Uint8 *)surface->pixels +
|
||||
rect->y * surface->pitch +
|
||||
rect->x * surface->format->bytes_per_pixel;
|
||||
length = (size_t)rect->w * surface->format->bytes_per_pixel;
|
||||
rect->x * surface->internal->format->bytes_per_pixel;
|
||||
length = (size_t)rect->w * surface->internal->format->bytes_per_pixel;
|
||||
for (row = 0; row < rect->h; ++row) {
|
||||
SDL_memcpy(dst, src, length);
|
||||
src += pitch;
|
||||
@@ -160,7 +160,7 @@ static int SW_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||
|
||||
*pixels =
|
||||
(void *)((Uint8 *)surface->pixels + rect->y * surface->pitch +
|
||||
rect->x * surface->format->bytes_per_pixel);
|
||||
rect->x * surface->internal->format->bytes_per_pixel);
|
||||
*pitch = surface->pitch;
|
||||
return 0;
|
||||
}
|
||||
@@ -328,7 +328,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex
|
||||
int blitRequired = SDL_FALSE;
|
||||
int isOpaque = SDL_FALSE;
|
||||
|
||||
if (!surface) {
|
||||
if (!SDL_SurfaceValid(surface)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -347,7 +347,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex
|
||||
/* Clone the source surface but use its pixel buffer directly.
|
||||
* The original source surface must be treated as read-only.
|
||||
*/
|
||||
src_clone = SDL_CreateSurfaceFrom(src->pixels, src->w, src->h, src->pitch, src->format->format);
|
||||
src_clone = SDL_CreateSurfaceFrom(src->w, src->h, src->format, src->pixels, src->pitch);
|
||||
if (!src_clone) {
|
||||
if (SDL_MUSTLOCK(src)) {
|
||||
SDL_UnlockSurface(src);
|
||||
@@ -360,7 +360,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex
|
||||
SDL_GetSurfaceColorMod(src, &rMod, &gMod, &bMod);
|
||||
|
||||
/* SDLgfx_rotateSurface only accepts 32-bit surfaces with a 8888 layout. Everything else has to be converted. */
|
||||
if (src->format->bits_per_pixel != 32 || SDL_PIXELLAYOUT(src->format->format) != SDL_PACKEDLAYOUT_8888 || !src->format->Amask) {
|
||||
if (src->internal->format->bits_per_pixel != 32 || SDL_PIXELLAYOUT(src->format) != SDL_PACKEDLAYOUT_8888 || !SDL_ISPIXELFORMAT_ALPHA(src->format)) {
|
||||
blitRequired = SDL_TRUE;
|
||||
}
|
||||
|
||||
@@ -382,7 +382,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex
|
||||
}
|
||||
|
||||
/* Opaque surfaces are much easier to handle with the NONE blend mode. */
|
||||
if (blendmode == SDL_BLENDMODE_NONE && !src->format->Amask && alphaMod == 255) {
|
||||
if (blendmode == SDL_BLENDMODE_NONE && !SDL_ISPIXELFORMAT_ALPHA(src->format) && alphaMod == 255) {
|
||||
isOpaque = SDL_TRUE;
|
||||
}
|
||||
|
||||
@@ -482,15 +482,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex
|
||||
* mode modulates the colors with the alpha channel, a surface without an alpha mask needs
|
||||
* to be created. This makes all source pixels opaque and the colors get copied correctly.
|
||||
*/
|
||||
SDL_Surface *src_rotated_rgb;
|
||||
SDL_PixelFormatEnum f = SDL_GetPixelFormatEnumForMasks(src_rotated->format->bits_per_pixel,
|
||||
src_rotated->format->Rmask,
|
||||
src_rotated->format->Gmask,
|
||||
src_rotated->format->Bmask,
|
||||
0);
|
||||
|
||||
src_rotated_rgb = SDL_CreateSurfaceFrom(src_rotated->pixels, src_rotated->w, src_rotated->h,
|
||||
src_rotated->pitch, f);
|
||||
SDL_Surface *src_rotated_rgb = SDL_CreateSurfaceFrom(src_rotated->w, src_rotated->h, src_rotated->format, src_rotated->pixels, src_rotated->pitch);
|
||||
if (!src_rotated_rgb) {
|
||||
retval = -1;
|
||||
} else {
|
||||
@@ -680,7 +672,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
|
||||
SDL_Surface *surface = SW_ActivateRenderer(renderer);
|
||||
SW_DrawStateCache drawstate;
|
||||
|
||||
if (!surface) {
|
||||
if (!SDL_SurfaceValid(surface)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -725,7 +717,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
|
||||
const Uint8 a = (Uint8)SDL_roundf(SDL_clamp(cmd->data.color.color.a, 0.0f, 1.0f) * 255.0f);
|
||||
/* By definition the clear ignores the clip rect */
|
||||
SDL_SetSurfaceClipRect(surface, NULL);
|
||||
SDL_FillSurfaceRect(surface, NULL, SDL_MapRGBA(surface->format, r, g, b, a));
|
||||
SDL_FillSurfaceRect(surface, NULL, SDL_MapSurfaceRGBA(surface, r, g, b, a));
|
||||
drawstate.surface_cliprect_dirty = SDL_TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -751,7 +743,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
|
||||
}
|
||||
|
||||
if (blend == SDL_BLENDMODE_NONE) {
|
||||
SDL_DrawPoints(surface, verts, count, SDL_MapRGBA(surface->format, r, g, b, a));
|
||||
SDL_DrawPoints(surface, verts, count, SDL_MapSurfaceRGBA(surface, r, g, b, a));
|
||||
} else {
|
||||
SDL_BlendPoints(surface, verts, count, blend, r, g, b, a);
|
||||
}
|
||||
@@ -779,7 +771,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
|
||||
}
|
||||
|
||||
if (blend == SDL_BLENDMODE_NONE) {
|
||||
SDL_DrawLines(surface, verts, count, SDL_MapRGBA(surface->format, r, g, b, a));
|
||||
SDL_DrawLines(surface, verts, count, SDL_MapSurfaceRGBA(surface, r, g, b, a));
|
||||
} else {
|
||||
SDL_BlendLines(surface, verts, count, blend, r, g, b, a);
|
||||
}
|
||||
@@ -807,7 +799,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
|
||||
}
|
||||
|
||||
if (blend == SDL_BLENDMODE_NONE) {
|
||||
SDL_FillSurfaceRects(surface, verts, count, SDL_MapRGBA(surface->format, r, g, b, a));
|
||||
SDL_FillSurfaceRects(surface, verts, count, SDL_MapSurfaceRGBA(surface, r, g, b, a));
|
||||
} else {
|
||||
SDL_BlendFillRects(surface, verts, count, blend, r, g, b, a);
|
||||
}
|
||||
@@ -842,7 +834,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
|
||||
|
||||
/* Prevent to do scaling + clipping on viewport boundaries as it may lose proportion */
|
||||
if (dstrect->x < 0 || dstrect->y < 0 || dstrect->x + dstrect->w > surface->w || dstrect->y + dstrect->h > surface->h) {
|
||||
SDL_Surface *tmp = SDL_CreateSurface(dstrect->w, dstrect->h, src->format->format);
|
||||
SDL_Surface *tmp = SDL_CreateSurface(dstrect->w, dstrect->h, src->format);
|
||||
/* Scale to an intermediate surface, then blit */
|
||||
if (tmp) {
|
||||
SDL_Rect r;
|
||||
@@ -971,7 +963,7 @@ static SDL_Surface *SW_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *
|
||||
SDL_Surface *surface = SW_ActivateRenderer(renderer);
|
||||
void *pixels;
|
||||
|
||||
if (!surface) {
|
||||
if (!SDL_SurfaceValid(surface)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -987,9 +979,9 @@ static SDL_Surface *SW_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *
|
||||
|
||||
pixels = (void *)((Uint8 *)surface->pixels +
|
||||
rect->y * surface->pitch +
|
||||
rect->x * surface->format->bytes_per_pixel);
|
||||
rect->x * surface->internal->format->bytes_per_pixel);
|
||||
|
||||
return SDL_DuplicatePixels(rect->w, rect->h, surface->format->format, SDL_COLORSPACE_SRGB, pixels, surface->pitch);
|
||||
return SDL_DuplicatePixels(rect->w, rect->h, surface->format, SDL_COLORSPACE_SRGB, pixels, surface->pitch);
|
||||
}
|
||||
|
||||
static int SW_RenderPresent(SDL_Renderer *renderer)
|
||||
@@ -1020,7 +1012,7 @@ static void SW_DestroyRenderer(SDL_Renderer *renderer)
|
||||
SDL_free(data);
|
||||
}
|
||||
|
||||
static void SW_SelectBestFormats(SDL_Renderer *renderer, SDL_PixelFormatEnum format)
|
||||
static void SW_SelectBestFormats(SDL_Renderer *renderer, SDL_PixelFormat format)
|
||||
{
|
||||
/* Prefer the format used by the framebuffer by default. */
|
||||
SDL_AddSupportedTextureFormat(renderer, format);
|
||||
@@ -1119,7 +1111,7 @@ int SW_CreateRendererForSurface(SDL_Renderer *renderer, SDL_Surface *surface, SD
|
||||
{
|
||||
SW_RenderData *data;
|
||||
|
||||
if (!surface) {
|
||||
if (!SDL_SurfaceValid(surface)) {
|
||||
return SDL_InvalidParamError("surface");
|
||||
}
|
||||
|
||||
@@ -1160,7 +1152,7 @@ int SW_CreateRendererForSurface(SDL_Renderer *renderer, SDL_Surface *surface, SD
|
||||
|
||||
renderer->name = SW_RenderDriver.name;
|
||||
|
||||
SW_SelectBestFormats(renderer, surface->format->format);
|
||||
SW_SelectBestFormats(renderer, surface->format);
|
||||
|
||||
SDL_SetupRendererColorspace(renderer, create_props);
|
||||
|
||||
@@ -1193,7 +1185,7 @@ static int SW_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_Pro
|
||||
SDL_SetHint(SDL_HINT_RENDER_VSYNC, "");
|
||||
}
|
||||
|
||||
if (!surface) {
|
||||
if (!SDL_SurfaceValid(surface)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,11 +36,10 @@ Andreas Schiffler -- aschiffler at ferzkopp dot net
|
||||
#include "../../core/windows/SDL_windows.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "SDL_rotate.h"
|
||||
|
||||
#include "../../video/SDL_blit.h"
|
||||
|
||||
/* ---- Internally used structures */
|
||||
|
||||
/**
|
||||
@@ -491,14 +490,13 @@ SDL_Surface *SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, in
|
||||
{
|
||||
SDL_Surface *rz_dst;
|
||||
int is8bit, angle90;
|
||||
int i;
|
||||
SDL_BlendMode blendmode;
|
||||
Uint32 colorkey = 0;
|
||||
int colorKeyAvailable = SDL_FALSE;
|
||||
double sangleinv, cangleinv;
|
||||
|
||||
/* Sanity check */
|
||||
if (!src) {
|
||||
if (!SDL_SurfaceValid(src)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -508,8 +506,8 @@ SDL_Surface *SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, in
|
||||
}
|
||||
}
|
||||
/* This function requires a 32-bit surface or 8-bit surface with a colorkey */
|
||||
is8bit = src->format->bits_per_pixel == 8 && colorKeyAvailable;
|
||||
if (!(is8bit || (src->format->bits_per_pixel == 32 && src->format->Amask))) {
|
||||
is8bit = src->internal->format->bits_per_pixel == 8 && colorKeyAvailable;
|
||||
if (!(is8bit || (src->internal->format->bits_per_pixel == 32 && SDL_ISPIXELFORMAT_ALPHA(src->format)))) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -521,18 +519,13 @@ SDL_Surface *SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, in
|
||||
rz_dst = NULL;
|
||||
if (is8bit) {
|
||||
/* Target surface is 8 bit */
|
||||
rz_dst = SDL_CreateSurface(rect_dest->w, rect_dest->h + GUARD_ROWS, src->format->format);
|
||||
rz_dst = SDL_CreateSurface(rect_dest->w, rect_dest->h + GUARD_ROWS, src->format);
|
||||
if (rz_dst) {
|
||||
if (src->format->palette) {
|
||||
for (i = 0; i < src->format->palette->ncolors; i++) {
|
||||
rz_dst->format->palette->colors[i] = src->format->palette->colors[i];
|
||||
}
|
||||
rz_dst->format->palette->ncolors = src->format->palette->ncolors;
|
||||
}
|
||||
SDL_SetSurfacePalette(rz_dst, src->internal->palette);
|
||||
}
|
||||
} else {
|
||||
/* Target surface is 32 bit with source RGBA ordering */
|
||||
rz_dst = SDL_CreateSurface(rect_dest->w, rect_dest->h + GUARD_ROWS, src->format->format);
|
||||
rz_dst = SDL_CreateSurface(rect_dest->w, rect_dest->h + GUARD_ROWS, src->format);
|
||||
}
|
||||
|
||||
/* Check target */
|
||||
@@ -555,7 +548,7 @@ SDL_Surface *SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, in
|
||||
/* Without a colorkey, the target texture has to be white for the MOD and MUL blend mode so
|
||||
* that the pixels outside the rotated area don't affect the destination surface.
|
||||
*/
|
||||
colorkey = SDL_MapRGBA(rz_dst->format, 255, 255, 255, 0);
|
||||
colorkey = SDL_MapSurfaceRGBA(rz_dst, 255, 255, 255, 0);
|
||||
SDL_FillSurfaceRect(rz_dst, NULL, colorkey);
|
||||
/* Setting a white colorkey for the destination surface makes the final blit discard
|
||||
* all pixels outside of the rotated area. This doesn't interfere with anything because
|
||||
|
||||
@@ -190,7 +190,7 @@ static void bounding_rect(const SDL_Point *a, const SDL_Point *b, const SDL_Poin
|
||||
Uint8 g = (Uint8)(((Sint64)w0 * c0.g + (Sint64)w1 * c1.g + (Sint64)w2 * c2.g) / area); \
|
||||
Uint8 b = (Uint8)(((Sint64)w0 * c0.b + (Sint64)w1 * c1.b + (Sint64)w2 * c2.b) / area); \
|
||||
Uint8 a = (Uint8)(((Sint64)w0 * c0.a + (Sint64)w1 * c1.a + (Sint64)w2 * c2.a) / area); \
|
||||
Uint32 color = SDL_MapRGBA(format, r, g, b, a);
|
||||
Uint32 color = SDL_MapRGBA(format, palette, r, g, b, a);
|
||||
|
||||
#define TRIANGLE_GET_COLOR \
|
||||
int r = (int)(((Sint64)w0 * c0.r + (Sint64)w1 * c1.r + (Sint64)w2 * c2.r) / area); \
|
||||
@@ -235,7 +235,7 @@ int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poin
|
||||
|
||||
SDL_Surface *tmp = NULL;
|
||||
|
||||
if (!dst) {
|
||||
if (!SDL_SurfaceValid(dst)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -278,10 +278,10 @@ int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poin
|
||||
}
|
||||
|
||||
if (blend != SDL_BLENDMODE_NONE) {
|
||||
SDL_PixelFormatEnum format = dst->format->format;
|
||||
SDL_PixelFormat format = dst->format;
|
||||
|
||||
/* need an alpha format */
|
||||
if (!dst->format->Amask) {
|
||||
if (!SDL_ISPIXELFORMAT_ALPHA(format)) {
|
||||
format = SDL_PIXELFORMAT_ARGB8888;
|
||||
}
|
||||
|
||||
@@ -293,19 +293,19 @@ int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poin
|
||||
}
|
||||
|
||||
if (blend == SDL_BLENDMODE_MOD) {
|
||||
Uint32 c = SDL_MapRGBA(tmp->format, 255, 255, 255, 255);
|
||||
Uint32 c = SDL_MapSurfaceRGBA(tmp, 255, 255, 255, 255);
|
||||
SDL_FillSurfaceRect(tmp, NULL, c);
|
||||
}
|
||||
|
||||
SDL_SetSurfaceBlendMode(tmp, blend);
|
||||
|
||||
dstbpp = tmp->format->bytes_per_pixel;
|
||||
dstbpp = tmp->internal->format->bytes_per_pixel;
|
||||
dst_ptr = (Uint8 *)tmp->pixels;
|
||||
dst_pitch = tmp->pitch;
|
||||
|
||||
} else {
|
||||
/* Write directly to destination surface */
|
||||
dstbpp = dst->format->bytes_per_pixel;
|
||||
dstbpp = dst->internal->format->bytes_per_pixel;
|
||||
dst_ptr = (Uint8 *)dst->pixels + dstrect.x * dstbpp + dstrect.y * dst->pitch;
|
||||
dst_pitch = dst->pitch;
|
||||
}
|
||||
@@ -359,9 +359,9 @@ int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poin
|
||||
if (is_uniform) {
|
||||
Uint32 color;
|
||||
if (tmp) {
|
||||
color = SDL_MapRGBA(tmp->format, c0.r, c0.g, c0.b, c0.a);
|
||||
color = SDL_MapSurfaceRGBA(tmp, c0.r, c0.g, c0.b, c0.a);
|
||||
} else {
|
||||
color = SDL_MapRGBA(dst->format, c0.r, c0.g, c0.b, c0.a);
|
||||
color = SDL_MapSurfaceRGBA(dst, c0.r, c0.g, c0.b, c0.a);
|
||||
}
|
||||
|
||||
if (dstbpp == 4) {
|
||||
@@ -393,9 +393,14 @@ int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poin
|
||||
TRIANGLE_END_LOOP
|
||||
}
|
||||
} else {
|
||||
SDL_PixelFormat *format = dst->format;
|
||||
const SDL_PixelFormatDetails *format;
|
||||
SDL_Palette *palette;
|
||||
if (tmp) {
|
||||
format = tmp->format;
|
||||
format = tmp->internal->format;
|
||||
palette = tmp->internal->palette;
|
||||
} else {
|
||||
format = dst->internal->format;
|
||||
palette = dst->internal->palette;
|
||||
}
|
||||
if (dstbpp == 4) {
|
||||
TRIANGLE_BEGIN_LOOP
|
||||
@@ -481,10 +486,10 @@ int SDL_SW_BlitTriangle(
|
||||
|
||||
int has_modulation;
|
||||
|
||||
if (!src) {
|
||||
if (!SDL_SurfaceValid(src)) {
|
||||
return SDL_InvalidParamError("src");
|
||||
}
|
||||
if (!src) {
|
||||
if (!SDL_SurfaceValid(dst)) {
|
||||
return SDL_InvalidParamError("dst");
|
||||
}
|
||||
|
||||
@@ -578,7 +583,7 @@ int SDL_SW_BlitTriangle(
|
||||
}
|
||||
|
||||
/* Set destination pointer */
|
||||
dstbpp = dst->format->bytes_per_pixel;
|
||||
dstbpp = dst->internal->format->bytes_per_pixel;
|
||||
dst_ptr = (Uint8 *)dst->pixels + dstrect.x * dstbpp + dstrect.y * dst->pitch;
|
||||
dst_pitch = dst->pitch;
|
||||
|
||||
@@ -653,16 +658,16 @@ int SDL_SW_BlitTriangle(
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (blend != SDL_BLENDMODE_NONE || src->format->format != dst->format->format || has_modulation || !is_uniform) {
|
||||
if (blend != SDL_BLENDMODE_NONE || src->format != dst->format || has_modulation || !is_uniform) {
|
||||
/* Use SDL_BlitTriangle_Slow */
|
||||
|
||||
SDL_BlitInfo *info = &src->map->info;
|
||||
SDL_BlitInfo *info = &src->internal->map.info;
|
||||
SDL_BlitInfo tmp_info;
|
||||
|
||||
SDL_zero(tmp_info);
|
||||
|
||||
tmp_info.src_fmt = src->format;
|
||||
tmp_info.dst_fmt = dst->format;
|
||||
tmp_info.src_fmt = src->internal->format;
|
||||
tmp_info.dst_fmt = dst->internal->format;
|
||||
tmp_info.flags = info->flags;
|
||||
/*
|
||||
tmp_info.r = info->r;
|
||||
@@ -766,7 +771,7 @@ end:
|
||||
#define FORMAT_2101010 1
|
||||
#define FORMAT_HAS_ALPHA(format) format == 0
|
||||
#define FORMAT_HAS_NO_ALPHA(format) format < 0
|
||||
static int detect_format(SDL_PixelFormat *pf)
|
||||
static int detect_format(const SDL_PixelFormatDetails *pf)
|
||||
{
|
||||
if (pf->format == SDL_PIXELFORMAT_ARGB2101010) {
|
||||
return FORMAT_2101010;
|
||||
@@ -792,8 +797,8 @@ static void SDL_BlitTriangle_Slow(SDL_BlitInfo *info,
|
||||
Uint32 srcR, srcG, srcB, srcA;
|
||||
Uint32 dstpixel;
|
||||
Uint32 dstR, dstG, dstB, dstA;
|
||||
SDL_PixelFormat *src_fmt = info->src_fmt;
|
||||
SDL_PixelFormat *dst_fmt = info->dst_fmt;
|
||||
const SDL_PixelFormatDetails *src_fmt = info->src_fmt;
|
||||
const SDL_PixelFormatDetails *dst_fmt = info->dst_fmt;
|
||||
int srcbpp = src_fmt->bytes_per_pixel;
|
||||
int dstbpp = dst_fmt->bytes_per_pixel;
|
||||
int srcfmt_val;
|
||||
|
||||
@@ -367,7 +367,7 @@ typedef struct
|
||||
SDL_bool issueBatch;
|
||||
} VULKAN_RenderData;
|
||||
|
||||
static SDL_PixelFormatEnum VULKAN_VkFormatToSDLPixelFormat(VkFormat vkFormat)
|
||||
static SDL_PixelFormat VULKAN_VkFormatToSDLPixelFormat(VkFormat vkFormat)
|
||||
{
|
||||
switch (vkFormat) {
|
||||
case VK_FORMAT_B8G8R8A8_UNORM:
|
||||
|
||||
@@ -1038,14 +1038,14 @@ static void SDLTest_PrintRenderer(SDL_Renderer *renderer)
|
||||
int i;
|
||||
char text[1024];
|
||||
int max_texture_size;
|
||||
const SDL_PixelFormatEnum *texture_formats;
|
||||
const SDL_PixelFormat *texture_formats;
|
||||
|
||||
name = SDL_GetRendererName(renderer);
|
||||
|
||||
SDL_Log(" Renderer %s:\n", name);
|
||||
SDL_Log(" VSync: %d\n", (int)SDL_GetNumberProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_VSYNC_NUMBER, 0));
|
||||
|
||||
texture_formats = (const SDL_PixelFormatEnum *)SDL_GetProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER, NULL);
|
||||
texture_formats = (const SDL_PixelFormat *)SDL_GetProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER, NULL);
|
||||
if (texture_formats) {
|
||||
(void)SDL_snprintf(text, sizeof(text), " Texture formats: ");
|
||||
for (i = 0; texture_formats[i]; ++i) {
|
||||
@@ -1074,7 +1074,7 @@ static SDL_Surface *SDLTest_LoadIcon(const char *file)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (icon->format->palette) {
|
||||
if (icon->format == SDL_PIXELFORMAT_INDEX8) {
|
||||
/* Set the colorkey */
|
||||
SDL_SetSurfaceColorKey(icon, 1, *((Uint8 *)icon->pixels));
|
||||
}
|
||||
@@ -1218,7 +1218,7 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
|
||||
SDL_Log("Usable bounds: %dx%d at %d,%d\n", usablebounds.w, usablebounds.h, usablebounds.x, usablebounds.y);
|
||||
|
||||
mode = SDL_GetDesktopDisplayMode(displayID);
|
||||
SDL_GetMasksForPixelFormatEnum(mode->format, &bpp, &Rmask, &Gmask,
|
||||
SDL_GetMasksForPixelFormat(mode->format, &bpp, &Rmask, &Gmask,
|
||||
&Bmask, &Amask);
|
||||
SDL_Log(" Desktop mode: %dx%d@%gx %gHz, %d bits-per-pixel (%s)\n",
|
||||
mode->w, mode->h, mode->pixel_density, mode->refresh_rate, bpp,
|
||||
@@ -1240,7 +1240,7 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
|
||||
SDL_Log(" Fullscreen video modes:\n");
|
||||
for (j = 0; j < m; ++j) {
|
||||
mode = modes[j];
|
||||
SDL_GetMasksForPixelFormatEnum(mode->format, &bpp, &Rmask,
|
||||
SDL_GetMasksForPixelFormat(mode->format, &bpp, &Rmask,
|
||||
&Gmask, &Bmask, &Amask);
|
||||
SDL_Log(" Mode %d: %dx%d@%gx %gHz, %d bits-per-pixel (%s)\n",
|
||||
j, mode->w, mode->h, mode->pixel_density, mode->refresh_rate, bpp,
|
||||
|
||||
@@ -33,17 +33,6 @@
|
||||
/* Counter for _CompareSurface calls; used for filename creation when comparisons fail */
|
||||
static int _CompareSurfaceCount = 0;
|
||||
|
||||
static void
|
||||
LogErrorFormat(const char *name, const SDL_PixelFormat *format)
|
||||
{
|
||||
SDLTest_LogError("%s: %08d %s, %u bits/%u bytes per pixel", name, format->format, SDL_GetPixelFormatName(format->format),
|
||||
format->bits_per_pixel, format->bytes_per_pixel);
|
||||
SDLTest_LogError("%s: R mask %08" SDL_PRIx32 ", loss %u, shift %u", name, format->Rmask, format->Rloss, format->Rshift);
|
||||
SDLTest_LogError("%s: G mask %08" SDL_PRIx32 ", loss %u, shift %u", name, format->Gmask, format->Gloss, format->Gshift);
|
||||
SDLTest_LogError("%s: B mask %08" SDL_PRIx32 ", loss %u, shift %u", name, format->Bmask, format->Bloss, format->Bshift);
|
||||
SDLTest_LogError("%s: A mask %08" SDL_PRIx32 ", loss %u, shift %u", name, format->Amask, format->Aloss, format->Ashift);
|
||||
}
|
||||
|
||||
/* Compare surfaces */
|
||||
int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error)
|
||||
{
|
||||
@@ -135,8 +124,8 @@ int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface,
|
||||
_CompareSurfaceCount++;
|
||||
if (ret != 0) {
|
||||
SDLTest_LogError("Comparison of pixels with allowable error of %i failed %i times.", allowable_error, ret);
|
||||
LogErrorFormat("Reference surface format", referenceSurface->format);
|
||||
LogErrorFormat("Actual surface format ", surface->format);
|
||||
SDLTest_LogError("Reference surface format: %s", SDL_GetPixelFormatName(referenceSurface->format));
|
||||
SDLTest_LogError("Actual surface format: %s", SDL_GetPixelFormatName(surface->format));
|
||||
SDLTest_LogError("First detected occurrence at position %i,%i with a squared RGB-difference of %i.", sampleErrorX, sampleErrorY, sampleDist);
|
||||
SDLTest_LogError("Reference pixel: R=%u G=%u B=%u A=%u", sampleReference.r, sampleReference.g, sampleReference.b, sampleReference.a);
|
||||
SDLTest_LogError("Actual pixel : R=%u G=%u B=%u A=%u", sampleActual.r, sampleActual.g, sampleActual.b, sampleActual.a);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user