Create "canvas" as 24-bit all the time

Previously was having it match the display's ("screen"'s) depth
and masks, but this apparently causes artifacts under SDL2.
Closes https://sourceforge.net/p/tuxpaint/bugs/259/
This commit is contained in:
Bill Kendrick 2022-09-04 01:33:36 -07:00
parent 39264d3545
commit 53c1c5e995
2 changed files with 15 additions and 7 deletions

View file

@ -28079,13 +28079,15 @@ static void setup(void)
printf("Canvas size is %d x %d\n", canvas_width, canvas_height);
#endif
canvas = SDL_CreateRGBSurface(screen->flags, canvas_width, canvas_height,
screen->format->BitsPerPixel,
screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, 0);
/* Per https://wiki.libsdl.org/SDL_CreateRGBSurface,
* the flags are unused and should be set to 0
* Using zeros for the RGB masks sets a default value, based on the depth.
*/
canvas = SDL_CreateRGBSurface(0, canvas_width, canvas_height,
24, 0, 0, 0, 0);
save_canvas = SDL_CreateRGBSurface(screen->flags, canvas_width, canvas_height,
screen->format->BitsPerPixel,
screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, 0);
save_canvas = SDL_CreateRGBSurface(0, canvas_width, canvas_height,
24, 0, 0, 0, 0);
img_starter = NULL;