From 8f23261134a8d3b6661c2a443e5fc9d691478f55 Mon Sep 17 00:00:00 2001 From: Misa Date: Thu, 30 Mar 2023 19:54:46 -0700 Subject: [PATCH] Whiten texture only after loading surface This fixes a regression where the red channel 0 glitch didn't work, because the surface was always whitened, because LoadSprites would whiten the image before converting it to surface. This regression happened because of #923. Fixes #962. --- desktop_version/src/GraphicsResources.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/desktop_version/src/GraphicsResources.cpp b/desktop_version/src/GraphicsResources.cpp index 99b03cd8..2fb1be0a 100644 --- a/desktop_version/src/GraphicsResources.cpp +++ b/desktop_version/src/GraphicsResources.cpp @@ -237,15 +237,15 @@ static void LoadSprites(const char* filename, SDL_Texture** texture, SDL_Surface unsigned char* data; SDL_Surface* loadedImage = LoadImageRaw(filename, &data); - *texture = LoadTextureFromRaw(filename, loadedImage, TEX_WHITE); - if (*texture == NULL) + *surface = LoadSurfaceFromRaw(loadedImage); + if (*surface == NULL) { vlog_error("Image not found: %s", filename); SDL_assert(0 && "Image not found! See stderr."); } - *surface = LoadSurfaceFromRaw(loadedImage); - if (*surface == NULL) + *texture = LoadTextureFromRaw(filename, loadedImage, TEX_WHITE); + if (*texture == NULL) { vlog_error("Image not found: %s", filename); SDL_assert(0 && "Image not found! See stderr.");