SDL/src
Sam Lantinga 41c718db85 Fixed bug 4469 - make SDL_CreateTextureFromSurface pick a more appropriate format
Sylvain

Currently SDL_CreateTextureFromSurface picks first valid format, and do a conversion.

    format = renderer->info.texture_formats[0];
    for (i = 0; i < renderer->info.num_texture_formats; ++i) {
        if (!SDL_ISPIXELFORMAT_FOURCC(renderer->info.texture_formats[i]) &&
            SDL_ISPIXELFORMAT_ALPHA(renderer->info.texture_formats[i]) == needAlpha) {
            format = renderer->info.texture_formats[i];
            break;

It could try to find a better format, for instance :

 if SDL_Surface has no Amask, but a colorkey :
   if surface fmt is RGB888, try to pick ARGB8888 renderer fmt
   if surface fmt is BGR888, try to pick ABGR8888 renderer fmt
 else
   try to pick the same renderer format as surface fmt

if no format has been picked, use the fallback.


I think it goes with bug 4290 fastpath BlitNtoN
when you expand a surface with pixel format of size 24 to 32, there is a fast path possible.


So with this issue:

- if you have a surface with colorkey (RGB or BGR, not palette), it takes a renderer format where the conversion is faster.
  (it avoids, if possible, RGB -> ABGR which means switching RGB to BGR)

- if you have a surface ABGR format, it try to take the ABGR from the renderer.
  (it avoids, if possible, ABGR -> ARGB, which means switch RGB to BGR)
2019-05-19 12:04:06 -07:00
..
atomic Updated copyright for 2019 2019-01-04 22:01:14 -08:00
audio [SDL] iOS fix bug with audio interrupted by a phone call not restoring. 2019-05-14 14:20:54 -07:00
core Fixed bug 4580 - Android 8: immersive fullscreen notification causes flickering between fullscreen and non-fullscreen and app is unresponsive 2019-04-22 16:19:52 -07:00
cpuinfo Fixed Windows RT build 2019-03-19 16:52:09 -07:00
dynapi Added support for building SDL as a dynamic library on iOS 2019-03-19 07:53:33 -07:00
events Windows are not in a minimized state when they are shown 2019-05-15 14:01:15 -07:00
file Updated copyright for 2019 2019-01-04 22:01:14 -08:00
filesystem Updated copyright for 2019 2019-01-04 22:01:14 -08:00
haptic Updated copyright for 2019 2019-01-04 22:01:14 -08:00
hidapi HIDAPI: fix bug that caused non-HID class parts of composite devices to have windows HID functions called on them. 2019-03-12 14:44:12 -07:00
joystick Fixed bug 4436 - [OpenBSD] fix D-pad 2019-05-19 11:56:26 -07:00
libm Updated copyright for 2019 2019-01-04 22:01:14 -08:00
loadso Updated copyright for 2019 2019-01-04 22:01:14 -08:00
main Added support for building SDL as a dynamic library on iOS 2019-03-19 07:53:33 -07:00
power Updated copyright for 2019 2019-01-04 22:01:14 -08:00
render Fixed bug 4469 - make SDL_CreateTextureFromSurface pick a more appropriate format 2019-05-19 12:04:06 -07:00
sensor Updated copyright for 2019 2019-01-04 22:01:14 -08:00
stdlib Updated copyright for 2019 2019-01-04 22:01:14 -08:00
test test: added SDLTest_CommonDefaultArgs() 2019-05-19 01:45:15 -04:00
thread Hopefully fixed the mingw32 build 2019-03-19 17:20:54 -07:00
timer Updated copyright for 2019 2019-01-04 22:01:14 -08:00
video Fixed bug 4401 - SDL_GetWindowPosition() wrong after SDL_SetWindowPosition() until window is moved on macOS 2019-05-19 11:52:25 -07:00
SDL.c events: Make debug logging of the event queue a hint instead of an #ifdef. 2019-03-15 14:08:30 -04:00
SDL_assert.c Use _Exit() when available 2019-04-23 07:59:31 -07:00
SDL_assert_c.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_dataqueue.c Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_dataqueue.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_error.c Fix DirectInput error codes being lost 2019-03-16 18:11:09 -07:00
SDL_error_c.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_hints.c Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_internal.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_log.c Updated copyright for 2019 2019-01-04 22:01:14 -08:00