SDL-mirror/src/render
Sam Lantinga 4ad10528f2 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
..
direct3d Fixed Windows RT build 2019-03-19 16:52:09 -07:00
direct3d11 Fixed bug 4582 - Maximize/Resize not working on Windows 10 2019-04-08 13:43:48 +02:00
metal Updated copyright for 2019 2019-01-04 22:01:14 -08:00
opengl Fixed bug 4025 - SDL_Renderer OpenGL : add support for textures ABGR, RGB, BGR 2019-05-19 11:01:36 -07:00
opengles Fixed Windows RT build 2019-03-19 16:52:09 -07:00
opengles2 opengles2: Fix static analysis warning. 2019-03-21 10:39:49 -04:00
psp Fixed Windows RT build 2019-03-19 16:52:09 -07:00
software Fixed Windows RT build 2019-03-19 16:52:09 -07:00
SDL_d3dmath.c Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_d3dmath.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_render.c Fixed bug 4469 - make SDL_CreateTextureFromSurface pick a more appropriate format 2019-05-19 12:04:06 -07:00
SDL_sysrender.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_yuv_sw.c Updated copyright for 2019 2019-01-04 22:01:14 -08:00
SDL_yuv_sw_c.h Updated copyright for 2019 2019-01-04 22:01:14 -08:00