From 1a4169cf6a620ce61252d8455009acead6a80b02 Mon Sep 17 00:00:00 2001
From: "p.kosyh"
Date: Wed, 17 Feb 2010 11:16:26 +0000
Subject: [PATCH] hack for 32 bit bmp files
---
src/sdl-instead/graphics.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/sdl-instead/graphics.c b/src/sdl-instead/graphics.c
index 3e69a5b..6d02dfc 100644
--- a/src/sdl-instead/graphics.c
+++ b/src/sdl-instead/graphics.c
@@ -573,9 +573,17 @@ static img_t _gfx_load_image(char *filename)
}
img = IMG_Load(filename);
if (!img) {
-
return NULL;
}
+ if (img->format->BitsPerPixel == 32) { /* hack for 32 bit BMP :( */
+ SDL_RWops *rwop;
+ rwop = SDL_RWFromFile(filename, "rb");
+ if (rwop) {
+ if (IMG_isBMP(rwop))
+ SDL_SetAlpha(img, SDL_RLEACCEL, SDL_ALPHA_OPAQUE);
+ SDL_FreeRW(rwop);
+ }
+ }
return img;
}