evas: detect properly when we wippe out font information.
authorcedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 11 May 2012 01:50:40 +0000 (01:50 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 11 May 2012 01:50:40 +0000 (01:50 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@70923 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/engines/common/evas_font.h
src/lib/engines/common/evas_font_draw.c
src/lib/engines/common/evas_font_load.c
src/lib/engines/common/evas_pipe.c
src/lib/engines/common/evas_text_utils.h
src/lib/include/evas_common.h

index 4a597e0..1b821d6 100644 (file)
@@ -22,7 +22,7 @@ EAPI int               evas_common_font_glyph_search         (RGBA_Font *fn, RGB
 EAPI RGBA_Font_Glyph  *evas_common_font_int_cache_glyph_get  (RGBA_Font_Int *fi, FT_UInt index);
 EAPI FT_UInt           evas_common_get_char_index            (RGBA_Font_Int* fi, Eina_Unicode gl);
 EAPI void              evas_common_font_draw_init            (void);
-EAPI void             evas_common_font_draw_prepare         (const Evas_Text_Props *text_props);
+EAPI void             evas_common_font_draw_prepare         (Evas_Text_Props *text_props);
 
 /* load */
 EAPI void              evas_common_font_dpi_set              (int dpi);
index 5ff465f..4bd9325 100644 (file)
@@ -263,7 +263,7 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, in
 }
 
 EAPI void
-evas_common_font_draw_prepare(const Evas_Text_Props *text_props)
+evas_common_font_draw_prepare(Evas_Text_Props *text_props)
 {
    RGBA_Font_Int *fi;
    EVAS_FONT_WALK_TEXT_INIT();
@@ -293,6 +293,8 @@ evas_common_font_draw_prepare(const Evas_Text_Props *text_props)
         fg = evas_common_font_int_cache_glyph_get(fi, idx);
      }
    EVAS_FONT_WALK_TEXT_END();
+
+   text_props->generation = fi->generation;
 }
 
 EAPI void
index f5988bb..9dc3d48 100644 (file)
@@ -702,7 +702,7 @@ static void
 _evas_common_font_int_clear(RGBA_Font_Int *fi)
 {
    int i, j, k;
-   
+
    LKL(fi->ft_mutex);
    if (!fi->fash)
      {
@@ -743,6 +743,7 @@ _evas_common_font_int_clear(RGBA_Font_Int *fi)
      }
    if (fi->inuse) fonts_use_usage -= fi->usage;
    fi->usage = 0;
+   fi->generation++;
    LKU(fi->ft_mutex);
 }
 
index 8208515..74bcf3d 100644 (file)
@@ -805,7 +805,11 @@ evas_common_pipe_text_prepare(const Evas_Text_Props *text_props)
    const Evas_Text_Props *tmp_props;
    const Eina_List *l;
 
-   if (!text_props->changed) return ;
+   fi = text_props->font_instance;
+   if (!fi) return ;
+
+   if (!text_props->changed && text_props->generation == fi->generation)
+     return ;
 
    fi = text_props->font_instance;
    if (!fi) return ;
index 9f3134d..d1b0857 100644 (file)
@@ -25,6 +25,7 @@ struct _Evas_Text_Props
    Evas_Text_Props_Info *info;
    void *font_instance;
 
+   int generation;
    Eina_Bool changed : 1;
 };
 
index 7989ba9..65b9ba8 100644 (file)
@@ -941,6 +941,9 @@ struct _RGBA_Font_Int
                                      in order to comply with the wanted_rend. */
 
    Eina_List       *task;
+
+   int              generation;
+
    unsigned char    sizeok : 1;
    unsigned char    inuse : 1;
 };