* Evas: Add another delay before reducing number of unused font in the
authorcedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 15 Jun 2009 14:37:14 +0000 (14:37 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 15 Jun 2009 14:37:14 +0000 (14:37 +0000)
cache.

Note: This is usefull when you are scaling up and down a font during an
animation.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@41049 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/canvas/evas_font_dir.c
src/lib/canvas/evas_render.c
src/lib/include/evas_private.h

index 1a2dad9..cf977f2 100644 (file)
@@ -120,16 +120,34 @@ evas_fonts_zero_free(Evas *evas)
 {
    Fndat *fd;
 
-   while (fonts_zero)
+   EINA_LIST_FREE(fonts_zero, fd)
+     {
+       if (fd->name) eina_stringshare_del(fd->name);
+       if (fd->source) eina_stringshare_del(fd->source);
+       evas->engine.func->font_free(evas->engine.data.output, fd->font);
+       free(fd);
+     }
+}
+
+void
+evas_fonts_zero_presure(Evas *evas)
+{
+   Fndat *fd;
+
+   while (fonts_zero
+         && eina_list_count(fonts_zero) > 4) /* 4 is arbitrary */
      {
        fd = eina_list_data_get(fonts_zero);
 
+       if (fd->ref != 0) break;
+       fonts_zero = eina_list_remove_list(fonts_zero, fonts_zero);
+
        if (fd->name) eina_stringshare_del(fd->name);
        if (fd->source) eina_stringshare_del(fd->source);
        evas->engine.func->font_free(evas->engine.data.output, fd->font);
        free(fd);
 
-       fonts_zero = eina_list_remove_list(fonts_zero, fonts_zero);
+       if (eina_list_count(fonts_zero) < 5) break;
      }
 }
 
@@ -152,16 +170,20 @@ evas_font_free(Evas *evas, void *font)
             break;
          }
      }
-   while ((fonts_zero) &&
-         (eina_list_count(fonts_zero) > 4)) /* 4 is arbitrary */
+   while (fonts_zero
+         && eina_list_count(fonts_zero) > 42) /* 42 is arbitrary */
      {
        fd = eina_list_data_get(fonts_zero);
+
        if (fd->ref != 0) break;
        fonts_zero = eina_list_remove_list(fonts_zero, fonts_zero);
+
        if (fd->name) eina_stringshare_del(fd->name);
        if (fd->source) eina_stringshare_del(fd->source);
        evas->engine.func->font_free(evas->engine.data.output, fd->font);
        free(fd);
+
+       if (eina_list_count(fonts_zero) < 43) break;
      }
 }
 
index 2e4e7ad..f3695f6 100644 (file)
@@ -667,6 +667,8 @@ evas_render_idle_flush(Evas *e)
    return;
    MAGIC_CHECK_END();
 
+   evas_fonts_zero_presure(e);
+
    if ((e->engine.func) && (e->engine.func->output_idle_flush) &&
        (e->engine.data.output))
      e->engine.func->output_idle_flush(e->engine.data.output);
index 87e9134..5cb35ee 100644 (file)
@@ -780,6 +780,7 @@ Eina_List *evas_font_dir_available_list(const Evas* evas);
 void evas_font_dir_available_list_free(Eina_List *available);
 void evas_font_free(Evas *evas, void *font);
 void evas_fonts_zero_free(Evas *evas);
+void evas_fonts_zero_presure(Evas *evas);
 void *evas_font_load(Evas *evas, const char *name, const char *source, int size);
 void evas_font_load_hinting_set(Evas *evas, void *font, int hinting);
 void evas_object_smart_member_cache_invalidate(Evas_Object *obj);