From 72a1507e7db945fd7fbc56970b5129dfde43d8ee Mon Sep 17 00:00:00 2001 From: sam Date: Tue, 4 Jan 2005 18:42:23 +0000 Subject: [PATCH] * if image is 8bpp, convert SDL surface to 32. git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/pwntcha/trunk@416 92316355-f0b4-4df1-b90c-862c8a59935f --- src/image.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/image.c b/src/image.c index 6725ecb..1fc69f6 100644 --- a/src/image.c +++ b/src/image.c @@ -40,6 +40,16 @@ struct image *image_load(const char *name) if(!priv) return NULL; +#if defined(HAVE_SDL_IMAGE_H) + if(priv->format->BytesPerPixel == 1) + { + img = image_new(priv->w, priv->h); + SDL_BlitSurface(priv, NULL, img->priv, NULL); + SDL_FreeSurface(priv); + return img; + } +#endif + img = malloc(sizeof(struct image)); #if defined(HAVE_SDL_IMAGE_H) img->width = priv->w;