From e535cdbe09d9c13d79cd6722aafca5798b7d1e35 Mon Sep 17 00:00:00 2001 From: lordjaxom Date: Tue, 1 Jun 2004 21:02:41 +0000 Subject: - fixed possible segfault when showing language logo (happened when channel was not available) - fixed some memory leaks - fixed "too many colors used in palette" warning for non-imlib-users --- bitmap.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'bitmap.c') diff --git a/bitmap.c b/bitmap.c index a4eebd7..00ffe0d 100644 --- a/bitmap.c +++ b/bitmap.c @@ -1,5 +1,5 @@ /* - * $Id: bitmap.c,v 1.5 2004/06/01 17:10:13 lordjaxom Exp $ + * $Id: bitmap.c,v 1.6 2004/06/01 21:02:38 lordjaxom Exp $ */ #define __STL_CONFIG_H @@ -24,11 +24,10 @@ cText2SkinBitmap::~cText2SkinBitmap() { bool cText2SkinBitmap::Load(const char *Filename) { int len = strlen(Filename); if (len > 4) { -#ifndef HAVE_IMLIB2 if (strcmp(Filename + len - 4, ".xpm") == 0) return LoadXpm(Filename); -#else - if (strcmp(Filename + len - 4, ".xpm") == 0 || strcmp(Filename + len - 4, ".png") == 0) +#ifdef HAVE_IMLIB2 + else if (strcmp(Filename + len - 4, ".png") == 0) return LoadImlib(Filename); #endif else @@ -44,6 +43,8 @@ bool cText2SkinBitmap::LoadImlib(const char *Filename) { image = imlib_load_image(Filename); if (!image) return false; + Imlib_Context ctx = imlib_context_new(); + imlib_context_push(ctx); imlib_context_set_image(image); SetSize(imlib_image_get_width(), imlib_image_get_height()); SetBpp(8); @@ -62,6 +63,14 @@ bool cText2SkinBitmap::LoadImlib(const char *Filename) { } } imlib_free_image(); + imlib_context_free(ctx); return true; } #endif + +#ifdef HAVE_IMAGEMAGICK +bool cText2SkinBitmap::LoadMagick(const char *Filename) { + Image image; + image.read(Filename); +} +#endif -- cgit v1.2.3