diff options
author | lordjaxom <lordjaxom> | 2004-06-01 21:02:41 +0000 |
---|---|---|
committer | lordjaxom <lordjaxom> | 2004-06-01 21:02:41 +0000 |
commit | e535cdbe09d9c13d79cd6722aafca5798b7d1e35 (patch) | |
tree | 640a6597a28e3f548a469b3c19e681d48a0622dc /bitmap.c | |
parent | 37b57e7872214cc59119faf29bd058362504b3f6 (diff) | |
download | vdr-plugin-text2skin-e535cdbe09d9c13d79cd6722aafca5798b7d1e35.tar.gz vdr-plugin-text2skin-e535cdbe09d9c13d79cd6722aafca5798b7d1e35.tar.bz2 |
- fixed possible segfault when showing language logo (happened when channelv0.0.1-rc3
was not available)
- fixed some memory leaks
- fixed "too many colors used in palette" warning for non-imlib-users
Diffstat (limited to 'bitmap.c')
-rw-r--r-- | bitmap.c | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -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 |