cleanup on shutdown better

SVN revision: 40242
This commit is contained in:
Carsten Haitzler 2009-04-19 20:40:41 +00:00
parent 99db224656
commit 38811d99c5
3 changed files with 47 additions and 0 deletions

View File

@ -48,6 +48,9 @@ static int evas_object_text_font_string_parse(char *buffer, char dest[14][256]);
void
evas_font_dir_cache_free(void)
{
#ifdef HAVE_FONTCONFIG
FcFini();
#endif
if (!font_dirs) return;
eina_hash_foreach(font_dirs, font_cache_dir_free, NULL);
@ -157,6 +160,18 @@ evas_font_free(Evas *evas, void *font)
}
}
static void
evas_font_init(void)
{
static int done = 0;
if (done) return;
done = 1;
#ifdef HAVE_FONTCONFIG
FcInit();
FcConfigEnableHome(1);
#endif
}
void *
evas_font_load(Evas *evas, const char *name, const char *source, int size)
{
@ -167,6 +182,8 @@ evas_font_load(Evas *evas, const char *name, const char *source, int size)
if (!name) return NULL;
if (name[0] == 0) return NULL;
evas_font_init();
EINA_LIST_FOREACH(fonts_cache, l, fd)
{
@ -409,6 +426,8 @@ evas_font_dir_available_list(const Evas *evas)
FcObjectSet *os;
int i;
evas_font_init();
p = FcPatternCreate();
os = FcObjectSetBuild(FC_FAMILY, FC_STYLE, NULL);

View File

@ -42,6 +42,8 @@ evas_shutdown(void)
evas_font_dir_cache_free();
evas_common_shutdown();
evas_module_shutdown();
eina_mempool_delete(_evas_rectangle_mp);
_evas_rectangle_mp = NULL;
eina_shutdown();
}
return initcount;

View File

@ -472,6 +472,8 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
// pops++;
if (!ct)
{
// FIXME: static ct - nver can free on shutdown? not a leak
// or real harm - just annoying valgrind bitch
ct = evas_common_draw_context_new();
evas_common_draw_context_set_render_op(ct, _EVAS_RENDER_COPY);
}
@ -495,6 +497,30 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
0, 0,
dst_region_w, dst_region_h);
sci->populate_me = 0;
#if 0 // visual debug of cached images
{
int xx, yy;
DATA32 *pp;
pp = sci->im->image.data;
for (yy = 0; yy < dst_region_h; yy++)
{
for (xx = 0; xx < dst_region_w; xx++)
{
if (yy & 0x1)
{
if (xx & 0x1) *pp = 0;
}
else
{
if (!(xx & 0x1)) *pp = 0;
}
pp++;
}
}
}
#endif
}
cache_size += sci->dst_w * sci->dst_h * 4;
// printf(" + %i @ flop: %i (%ix%i)\n",