From e0a270561ff2ccc9edc20f027bd55cc5a61b3ca5 Mon Sep 17 00:00:00 2001 From: Jay Petacat Date: Sun, 22 Mar 2020 20:09:14 -0400 Subject: [PATCH] Do not overwrite window surface created by driver If a driver's implementation of CreateWindowFramebuffer sets the window surface, use that rather than overwriting it. A driver may set the window surface if data cannot be passed via the CreateWindowFramebuffer output parameters (e.g. surface palette colors). --- src/video/SDL_video.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index de0bc1cbc7fc0..76097a8e4981b 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -2319,6 +2319,10 @@ SDL_CreateWindowFramebuffer(SDL_Window * window) return NULL; } + if (window->surface) { + return window->surface; + } + if (!SDL_PixelFormatEnumToMasks(format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) { return NULL; }