summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cedb313)
raw | patch | inline | side by side (parent: cedb313)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Wed, 1 Apr 2020 10:26:37 +0000 (14:26 +0400) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Wed, 1 Apr 2020 10:26:37 +0000 (14:26 +0400) |
src/sdl2/main.c | patch | blob | history |
diff --git a/src/sdl2/main.c b/src/sdl2/main.c
index 66b6680aefec37471739a81acd7bf3cd2ef250ae..81ecaa173cb0574bae6f6808724a8f2e322db8d2 100644 (file)
--- a/src/sdl2/main.c
+++ b/src/sdl2/main.c
assert(h > 0);
assert(window != NULL);
if (surf != NULL) {
- SDL_Surface *s = SDL_CreateRGBSurface(0, w, h, 8, 0, 0, 0, 0);
- if (s != NULL) {
- SDL_SetPaletteColors(s->format->palette, surf->format->palette->colors, 0, surf->format->palette->ncolors);
- SDL_FreeSurface(surf);
- surf = s;
+ if (surf->w != w || surf->h != h) {
+ SDL_Surface *s = SDL_CreateRGBSurface(0, w, h, 8, 0, 0, 0, 0);
+ if (s != NULL) {
+ SDL_SetPaletteColors(s->format->palette, surf->format->palette->colors, 0, surf->format->palette->ncolors);
+ SDL_FreeSurface(surf);
+ surf = s;
+ }
}
}
SDL_SetWindowSize(window, w, h);