mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-30 15:08:31 +00:00
Fixed texture colorspace when creating a texture from a surface
Fixes https://github.com/libsdl-org/SDL/issues/12691
This commit is contained in:
@@ -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
|
||||
// No alpha, but a colorkey => promote to alpha
|
||||
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 ||
|
||||
SDL_COLORSPACETRANSFER(surface_colorspace) == SDL_TRANSFER_CHARACTERISTICS_PQ) {
|
||||
if (SDL_ISPIXELFORMAT_FLOAT(format)) {
|
||||
|
Reference in New Issue
Block a user