Fixed texture colorspace when creating a texture from a surface
Fixes https://github.com/libsdl-org/SDL/issues/12691
(cherry picked from commit 36fc1c2c9c)
This commit is contained in:
1 parent
9109e05f3f
commit
02036ee643
1 file changed
+3
-2
@@ -1658,8 +1658,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)) {
|
||||||
@@ -1721,6 +1719,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)) {
|
||||||
|
|||||||
Reference in new issue
Block a user