evas: let's have an O(1) check instead of O(N).
authorcedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 17 Jun 2012 04:32:54 +0000 (04:32 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 17 Jun 2012 04:32:54 +0000 (04:32 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@72266 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/engines/common/evas_pipe.c
src/lib/engines/common/evas_pipe.h
src/lib/engines/common/evas_text_utils.h

index 37bc12e..0249595 100644 (file)
@@ -619,6 +619,7 @@ evas_common_pipe_load(void *data)
                  {
                      evas_common_font_draw_prepare(text_props);
                      text_props->changed = EINA_FALSE;
+                    text_props->prepare = EINA_FALSE;
                  }
                 LKU(fi->ft_mutex);
              }
@@ -738,11 +739,9 @@ evas_common_pipe_image_load(RGBA_Image *im)
 }
 
 EAPI void
-evas_common_pipe_text_prepare(const Evas_Text_Props *text_props)
+evas_common_pipe_text_prepare(Evas_Text_Props *text_props)
 {
    RGBA_Font_Int *fi;
-   const Evas_Text_Props *tmp_props;
-   const Eina_List *l;
 
    fi = text_props->font_instance;
    if (!fi) return ;
@@ -750,22 +749,17 @@ evas_common_pipe_text_prepare(const Evas_Text_Props *text_props)
    if (!text_props->changed && text_props->generation == fi->generation && text_props->bin)
      return ;
 
-   fi = text_props->font_instance;
-   if (!fi) return ;
-
    LKL(fi->ft_mutex);
 
-   if (!fi->task) 
+   if (!fi->task)
      {
        LKL(text_task_mutex);
        text_task = eina_list_append(text_task, fi);
        LKU(text_task_mutex);
      }
 
-   EINA_LIST_FOREACH(fi->task, l, tmp_props)
-     if (tmp_props == text_props)
-       goto end;
-
+   if (text_props->prepare) goto end;
+   text_props->prepare = EINA_TRUE;
    fi->task = eina_list_append(fi->task, text_props);
 
  end:
index 42531e1..b461424 100644 (file)
@@ -23,7 +23,7 @@ EAPI void evas_common_pipe_rectangle_draw(RGBA_Image *dst, RGBA_Draw_Context *dc
 EAPI void evas_common_pipe_line_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1, int y1);
 EAPI void evas_common_pipe_poly_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Polygon_Point *points, int x, int y);
 EAPI void evas_common_pipe_text_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, Evas_Text_Props *intl_props);
-EAPI void evas_common_pipe_text_prepare(const Evas_Text_Props *text_props);
+EAPI void evas_common_pipe_text_prepare(Evas_Text_Props *text_props);
 EAPI void evas_common_pipe_image_load(RGBA_Image *im);
 EAPI void evas_common_pipe_image_draw(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int smooth, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h);
 EAPI void evas_common_pipe_map_begin(RGBA_Image *root);
index 69489d0..e30827d 100644 (file)
@@ -35,6 +35,7 @@ struct _Evas_Text_Props
 
    int generation;
    Eina_Bool changed : 1;
+   Eina_Bool prepare : 1;
 };
 
 struct _Evas_Text_Props_Info