Evas textblock: Speed up rendering. Find the start paragraph for all.
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 15 May 2011 12:00:01 +0000 (12:00 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 15 May 2011 12:00:01 +0000 (12:00 +0000)
Until now all the format/text drawing loops went through all the
paragraphs skipping all the ones that are outside the clipping/object
zone. This changeset find the first paragraph to be renedred first so we
don't walk all the paragraphs for nothing. This speeds up rendering of
the ends of very big textblocks in a very noticable manner.

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

src/lib/canvas/evas_object_textblock.c

index 85b066c..b1b8d90 100644 (file)
@@ -8073,7 +8073,7 @@ evas_object_textblock_free(Evas_Object *obj)
 static void
 evas_object_textblock_render(Evas_Object *obj, void *output, void *context, void *surface, int x, int y)
 {
-   Evas_Object_Textblock_Paragraph *par;
+   Evas_Object_Textblock_Paragraph *par, *start;
    Evas_Object_Textblock_Line *ln;
    Evas_Object_Textblock *o;
    int i, j;
@@ -8106,7 +8106,7 @@ evas_object_textblock_render(Evas_Object *obj, void *output, void *context, void
    if (!o->paragraphs) return;
 
 #define ITEM_WALK() \
-   EINA_INLIST_FOREACH(o->paragraphs, par) \
+   EINA_INLIST_FOREACH(start, par) \
      { \
         if (!par->visible) continue; \
         if (clip) \
@@ -8212,6 +8212,21 @@ evas_object_textblock_render(Evas_Object *obj, void *output, void *context, void
      } \
    while (0)
 
+   /* Find the first paragraph and start working on that */
+   EINA_INLIST_FOREACH(o->paragraphs, par)
+     {
+        if (!par->visible) continue;
+
+        if ((par->y + par->h) <= 0) continue;
+        if (clip)
+          {
+             if ((obj->cur.geometry.y + y + par->y + par->h) < (cy - 20))
+                continue;
+          }
+        break;
+     }
+
+   start = par;
 
    ITEM_WALK()
      {