cleanup on shutdown better
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 19 Apr 2009 20:40:41 +0000 (20:40 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 19 Apr 2009 20:40:41 +0000 (20:40 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@40242 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/canvas/evas_font_dir.c
src/lib/canvas/evas_main.c
src/lib/engines/common/evas_image_scalecache.c

index 35b6b04..dc086d5 100644 (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);
 
index 873403d..a07a0bd 100644 (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;
index 0a033de..473d698 100644 (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",