mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
Fix issue with colorkey, palette and format conversion
Set the colorkey information on the converted surface. Test-case in bug 3826/2979, conflicting with bug 4798
This commit is contained in:
parent
39690a0478
commit
f6197aec85
@ -1106,6 +1106,7 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format,
|
|||||||
|
|
||||||
if (copy_flags & SDL_COPY_COLORKEY) {
|
if (copy_flags & SDL_COPY_COLORKEY) {
|
||||||
SDL_bool set_colorkey_by_color = SDL_FALSE;
|
SDL_bool set_colorkey_by_color = SDL_FALSE;
|
||||||
|
SDL_bool convert_colorkey = SDL_TRUE;
|
||||||
|
|
||||||
if (surface->format->palette) {
|
if (surface->format->palette) {
|
||||||
if (format->palette &&
|
if (format->palette &&
|
||||||
@ -1115,7 +1116,9 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format,
|
|||||||
/* The palette is identical, just set the same colorkey */
|
/* The palette is identical, just set the same colorkey */
|
||||||
SDL_SetColorKey(convert, 1, surface->map->info.colorkey);
|
SDL_SetColorKey(convert, 1, surface->map->info.colorkey);
|
||||||
} else if (!format->palette) {
|
} else if (!format->palette) {
|
||||||
|
set_colorkey_by_color = SDL_TRUE;
|
||||||
/* Was done by 'palette_ck_transform' */
|
/* Was done by 'palette_ck_transform' */
|
||||||
|
convert_colorkey = SDL_FALSE;
|
||||||
} else {
|
} else {
|
||||||
set_colorkey_by_color = SDL_TRUE;
|
set_colorkey_by_color = SDL_TRUE;
|
||||||
}
|
}
|
||||||
@ -1156,7 +1159,9 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format,
|
|||||||
SDL_SetColorKey(convert, 1, converted_colorkey);
|
SDL_SetColorKey(convert, 1, converted_colorkey);
|
||||||
|
|
||||||
/* This is needed when converting for 3D texture upload */
|
/* This is needed when converting for 3D texture upload */
|
||||||
SDL_ConvertColorkeyToAlpha(convert, SDL_TRUE);
|
if (convert_colorkey) {
|
||||||
|
SDL_ConvertColorkeyToAlpha(convert, SDL_TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SDL_SetClipRect(convert, &surface->clip_rect);
|
SDL_SetClipRect(convert, &surface->clip_rect);
|
||||||
|
Loading…
Reference in New Issue
Block a user