Fixed texture colorspace when creating a texture from a surface
Fixes https://github.com/libsdl-org/SDL/issues/12691
This commit is contained in:
parent
512485869c
commit
36fc1c2c9c
1 changed files with 3 additions and 2 deletions
|
@ -1677,8 +1677,6 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
surface_colorspace = SDL_GetSurfaceColorspace(surface);
|
|
||||||
|
|
||||||
// Try to have the best pixel format for the texture
|
// Try to have the best pixel format for the texture
|
||||||
// No alpha, but a colorkey => promote to alpha
|
// No alpha, but a colorkey => promote to alpha
|
||||||
if (!SDL_ISPIXELFORMAT_ALPHA(surface->format) && SDL_SurfaceHasColorKey(surface)) {
|
if (!SDL_ISPIXELFORMAT_ALPHA(surface->format) && SDL_SurfaceHasColorKey(surface)) {
|
||||||
|
@ -1740,6 +1738,9 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
surface_colorspace = SDL_GetSurfaceColorspace(surface);
|
||||||
|
texture_colorspace = surface_colorspace;
|
||||||
|
|
||||||
if (surface_colorspace == SDL_COLORSPACE_SRGB_LINEAR ||
|
if (surface_colorspace == SDL_COLORSPACE_SRGB_LINEAR ||
|
||||||
SDL_COLORSPACETRANSFER(surface_colorspace) == SDL_TRANSFER_CHARACTERISTICS_PQ) {
|
SDL_COLORSPACETRANSFER(surface_colorspace) == SDL_TRANSFER_CHARACTERISTICS_PQ) {
|
||||||
if (SDL_ISPIXELFORMAT_FLOAT(format)) {
|
if (SDL_ISPIXELFORMAT_FLOAT(format)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue