I have also some patch that are still waiting their way to the CVS.
- edje_font_hash.diff: Use Evas_Hash for font lookup.
After upgrading my ubuntu, I experienced the same bug raster
experienced on
his machine (all dialog box where empty). I was able to find it in
_edje_font_is_embedded from edje_textblock_styles.c.
static int
_edje_font_is_embedded(Edje_File *edf, char *font)
{
Evas_List *l;
if (!edf->font_dir) return 0;
for (l = edf->font_dir->entries; l; l = l->next)
{
Edje_Font_Directory_Entry *fnt = l->data;
if ((fnt->entry) && (!strcmp(fnt->entry, font)))
return 1;
}
return 1;
}
I read this function too quickly, and didn't see that it really only
check
edf->font_dir. The rest was only here to slow every thing :) So now the patch
must work correctly.
- evas_list_sort_inplace.diff: Replace the merge sort algorithm with an in
place merge sort.
I don't remember why it didn't get inside but I am using it in my own
code
without problem and it's fast. If I have time, I should port this to
ecore_list_sort.
- evas_tiler_speedup.diff: Walk progressively over the Tilebuf_Tile.
In some of my test I did notice that this function could take some time
(It
was with moving evas rectangle if I remember correctly). I basically took the
costly operation out of the loop.
Cedric
diff -Nrua -X /home/cedric/.diff.rc e17-main/libs/edje/src/lib/edje_cache.c e17-base/libs/edje/src/lib/edje_cache.c
--- e17-main/libs/edje/src/lib/edje_cache.c 2007-03-19 23:46:46.000000000 +0100
+++ e17-base/libs/edje/src/lib/edje_cache.c 2007-03-20 17:55:55.000000000 +0100
@@ -63,6 +63,32 @@
return edc;
}
+static int
+_edje_font_hash (Edje_File *edf)
+{
+ int count = 0;
+
+ if (edf->font_dir)
+ {
+ Evas_List *l;
+ for (l = edf->font_dir->entries; l; l = evas_list_next (l))
+ {
+ Edje_Font_Directory_Entry *fnt = l->data;
+ int length = strlen (fnt->entry) + 7;
+ char *tmp = alloca (length);
+
+ snprintf (tmp, length, "fonts/%s", fnt->entry);
+ fnt->path = evas_stringshare_add (tmp);
+ evas_stringshare_del (fnt->entry);
+ fnt->entry = fnt->path + 6;
+ edf->font_hash = evas_hash_direct_add (edf->font_hash, fnt->entry, fnt);
+
+ count++;
+ }
+ }
+ return count;
+}
+
static Edje_File *
_edje_file_open(const char *file, const char *coll, int *error_ret, Edje_Part_Collection **edc_ret)
{
@@ -112,18 +138,19 @@
}
edf->data = NULL;
- if (!coll)
+ if (coll)
{
- eet_close(ef);
- return edf;
+ edc = _edje_file_coll_open(edf, ef, coll);
+ if (!edc)
+ {
+ *error_ret = EDJE_LOAD_ERROR_UNKNOWN_COLLECTION;
+ }
+ if (edc_ret) *edc_ret = edc;
}
+
+ edf->font_hash = NULL;
- edc = _edje_file_coll_open(edf, ef, coll);
- if (!edc)
- {
- *error_ret = EDJE_LOAD_ERROR_UNKNOWN_COLLECTION;
- }
- if (edc_ret) *edc_ret = edc;
+ _edje_font_hash (edf);
eet_close(ef);
diff -Nrua -X /home/cedric/.diff.rc e17-main/libs/edje/src/lib/edje_calc.c e17-base/libs/edje/src/lib/edje_calc.c
--- e17-main/libs/edje/src/lib/edje_calc.c 2007-03-20 13:47:23.000000000 +0100
+++ e17-base/libs/edje/src/lib/edje_calc.c 2007-03-20 17:42:40.000000000 +0100
@@ -602,7 +602,6 @@
const char *font;
int size;
Evas_Coord tw, th;
- char buf[4096];
int inlined_font = 0;
/* Update a object_text part */
@@ -683,24 +682,14 @@
if (!text) text = "";
/* check if the font is embedded in the .eet */
- /* FIXME: we should cache this result */
- if (ed->file->font_dir)
+ if (ed->file->font_hash)
{
- Evas_List *l;
-
- for (l = ed->file->font_dir->entries; l; l = l->next)
- {
- Edje_Font_Directory_Entry *fnt = l->data;
+ Edje_Font_Directory_Entry *fnt = evas_hash_find (ed->file->font_hash, font);
- if ((fnt->entry) && (!strcmp(fnt->entry, font)))
- {
- strcpy(buf, "fonts/");
- strncpy(buf + 6, font, sizeof(buf) - 7);
- buf[sizeof(buf) - 1] = 0;
- font = buf;
- inlined_font = 1;
- break;
- }
+ if (fnt)
+ {
+ font = fnt->path;
+ inlined_font = 1;
}
}
if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
diff -Nrua -X /home/cedric/.diff.rc e17-main/libs/edje/src/lib/edje_load.c e17-base/libs/edje/src/lib/edje_load.c
--- e17-main/libs/edje/src/lib/edje_load.c 2007-03-19 23:46:46.000000000 +0100
+++ e17-base/libs/edje/src/lib/edje_load.c 2007-03-20 17:42:40.000000000 +0100
@@ -640,9 +640,10 @@
Edje_Font_Directory_Entry *fe;
fe = edf->font_dir->entries->data;
- edf->font_dir->entries =
+ edf->font_dir->entries =
evas_list_remove_list(edf->font_dir->entries, edf->font_dir->entries);
- if (fe->entry) evas_stringshare_del(fe->entry);
+ edf->font_hash = evas_hash_del(edf->font_hash, fe->entry, NULL);
+ if (fe->path) evas_stringshare_del(fe->path);
free(fe);
}
free(edf->font_dir);
diff -Nrua -X /home/cedric/.diff.rc e17-main/libs/edje/src/lib/edje_private.h e17-base/libs/edje/src/lib/edje_private.h
--- e17-main/libs/edje/src/lib/edje_private.h 2007-03-19 23:46:46.000000000 +0100
+++ e17-base/libs/edje/src/lib/edje_private.h 2007-03-20 17:59:32.000000000 +0100
@@ -221,13 +221,14 @@
Evas_List *data;
Evas_List *styles;
Evas_List *color_classes;
-
+
int references;
char *compiler;
int version;
int feature_ver;
Evas_Hash *collection_hash;
+ Evas_Hash *font_hash;
Evas_List *collection_cache;
Evas_Hash *data_cache;
};
@@ -265,7 +266,8 @@
struct _Edje_Font_Directory_Entry
{
- char *entry; /* the name of the font */
+ const char *entry; /* the name of the font */
+ char *path;
};
diff -Nrua -X /home/cedric/.diff.rc e17-main/libs/edje/src/lib/edje_textblock_styles.c e17-base/libs/edje/src/lib/edje_textblock_styles.c
--- e17-main/libs/edje/src/lib/edje_textblock_styles.c 2007-03-20 13:59:51.000000000 +0100
+++ e17-base/libs/edje/src/lib/edje_textblock_styles.c 2007-03-20 17:42:40.000000000 +0100
@@ -8,16 +8,13 @@
static int
_edje_font_is_embedded(Edje_File *edf, char *font)
{
- Evas_List *l;
+ Edje_Font_Directory_Entry *fnt = NULL;
if (!edf->font_dir) return 0;
- for (l = edf->font_dir->entries; l; l = l->next)
- {
- Edje_Font_Directory_Entry *fnt = l->data;
-
- if ((fnt->entry) && (!strcmp(fnt->entry, font)))
- return 1;
- }
+/* fnt = evas_hash_find (edf->font_hash, font); */
+/* if (fnt) */
+/* if (fnt->entry && (!strcmp(fnt->entry, font))) */
+/* return 1; */
return 1;
}
diff -Nrua -X /home/cedric/.diff.rc e17-main/libs/edje/src/lib/edje_text.c e17-base/libs/edje/src/lib/edje_text.c
--- e17-main/libs/edje/src/lib/edje_text.c 2007-03-20 13:47:06.000000000 +0100
+++ e17-base/libs/edje/src/lib/edje_text.c 2007-03-20 17:42:40.000000000 +0100
@@ -256,7 +256,6 @@
int size;
Evas_Coord tw, th;
Evas_Coord sw, sh;
- char font_buf[4096];
int inlined_font = 0, free_text = 0;
@@ -284,24 +283,14 @@
if (!font) font = "";
/* check if the font is embedded in the .eet */
- /* FIXME: we should cache this result */
- if (ed->file->font_dir)
+ if (ed->file->font_hash)
{
- Evas_List *l;
-
- for (l = ed->file->font_dir->entries; l; l = l->next)
+ Edje_Font_Directory_Entry *fnt = evas_hash_find (ed->file->font_hash, font);
+
+ if (fnt)
{
- Edje_Font_Directory_Entry *fnt = l->data;
-
- if ((fnt->entry) && (!strcmp(fnt->entry, font)))
- {
- strcpy(font_buf, "fonts/");
- strncpy(font_buf + 6, font, sizeof(font_buf) - 7);
- font_buf[sizeof(font_buf) - 1] = 0;
- font = font_buf;
- inlined_font = 1;
- break;
- }
+ font = fnt->path;
+ inlined_font = 1;
}
}
diff -Nrau -x '*.lo' -x '*.la' -x doc -x Makefile -x Makefile.in -x CVS -x autom4te.cache -x '*.o' -x 'config.*' -x configure -x .deps -x .libs e17-main/libs/evas/src/lib/data/evas_list.c e17-dev/libs/evas/src/lib/data/evas_list.c
--- e17-main/libs/evas/src/lib/data/evas_list.c 2006-08-04 23:52:45.000000000 +0200
+++ e17-dev/libs/evas/src/lib/data/evas_list.c 2007-03-19 18:57:50.000000000 +0100
@@ -850,57 +850,8 @@
if (l1 == l2) break;
l2 = l2->prev;
}
- return list;
-}
-
-static Evas_List *
-evas_list_combine(Evas_List *l, Evas_List *ll, int (*func)(void *, void*))
-{
- Evas_List *result = NULL;
- Evas_List *l_head = NULL, *ll_head = NULL;
-
- l_head = l;
- ll_head = ll;
- while (l && ll)
- {
- int cmp;
- cmp = func(l->data, ll->data);
- if (cmp < 0)
- {
- result = evas_list_append(result, l->data);
- l = evas_list_next(l);
- }
- else if (cmp == 0)
- {
- result = evas_list_append(result, l->data);
- l = evas_list_next(l);
- result = evas_list_append(result, ll->data);
- ll = evas_list_next(ll);
- }
- else if (cmp > 0)
- {
- result = evas_list_append(result, ll->data);
- ll = evas_list_next(ll);
- }
- else
- {
- l = ll = NULL;
- }
- }
- while (l)
- {
- result = evas_list_append(result, l->data);
- l = evas_list_next(l);
- }
- evas_list_free(l_head);
- while (ll)
- {
- result = evas_list_append(result, ll->data);
- ll = evas_list_next(ll);
- }
- evas_list_free(ll_head);
- return (result);
+ return list;
}
/**
@@ -915,8 +866,6 @@
* you just have to be smart enough to know what kind of data is in your
* lists
*
- * In the event of a memory allocation failure, It might segv.
- *
* Example:
* @code
* int
@@ -944,41 +893,98 @@
EAPI Evas_List *
evas_list_sort(Evas_List *list, int size, int (*func)(void *, void *))
{
- Evas_List *l = NULL, *ll = NULL, *llast;
- int mid;
+ Evas_List *cpl = list;
+ unsigned int list_number;
+ unsigned int middle;
+ int list_size;
if (!list || !func)
return NULL;
- /* FIXME: this is really inefficient - calling evas_list_nth is not
- * fast as it has to walk the list */
-
/* if the caller specified an invalid size, sort the whole list */
if ((size <= 0) ||
(size > ((Evas_List_Accounting *)(list->accounting))->count))
size = ((Evas_List_Accounting *)(list->accounting))->count;
- mid = size / 2;
- if (mid < 1) return list;
+ middle = size - size / 2;
- /* bleh evas list splicing */
- llast = ((Evas_List_Accounting *)(list->accounting))->last;
- ll = evas_list_nth_list(list, mid);
- if (ll->prev)
+ for (list_number = middle, list_size = 1;
+ list_size < middle * 2;
+ list_number >>= 1, list_size <<= 1)
{
- ((Evas_List_Accounting *)(list->accounting))->last = ll->prev;
- ((Evas_List_Accounting *)(list->accounting))->count = mid;
- ll->prev->next = NULL;
- ll->prev = NULL;
+ Evas_List *head1 = list;
+ unsigned int limit = size;
+ unsigned int process_list;
+ unsigned int pass_number;
+ unsigned int split_size = list_size;
+
+ for (process_list = 0; process_list < list_number + 1; ++process_list)
+ {
+ Evas_List *head2;
+ unsigned int size_sum;
+ int size1, size2;
+ int i;
+
+ size1 = limit < split_size ? limit : split_size;
+ limit -= size1;
+
+ size2 = limit < split_size ? limit : split_size;
+ limit -= size2;
+
+ size_sum = size1 + size2;
+
+ for (head2 = head1, i = 0; i < size1; ++i)
+ head2 = evas_list_next (head2);
+
+ for (pass_number = 0; pass_number < size_sum; ++pass_number)
+ {
+ Evas_List *next;
+ Evas_List *prev1;
+ Evas_List *prev2;
+
+ if (size1 == 0 || head1 == NULL) /* List1 is empty, head1 is already at the end of the list. So only need to update head2 */
+ {
+ for (; pass_number < size_sum; ++pass_number)
+ head2 = evas_list_next (head2);
+ break;
+ }
+ else
+ if (size2 == 0 || head2 == NULL) /* List2 is empty, just leave */
+ break;
+ else
+ if (func (head1->data, head2->data) < 0)
+ {
+ head1 = evas_list_next (head1);
+ --size1;
+ }
+ else
+ {
+ next = evas_list_next (head2);
+ prev1 = evas_list_prev (head1);
+ prev2 = evas_list_prev (head2);
+
+ if (next)
+ next->prev = prev2;
+ if (prev1)
+ prev1->next = head2;
+ if (prev2)
+ prev2->next = next;
+
+ head2->prev = prev1;
+ head2->next = head1;
+ head1->prev = head2;
+
+ --size2;
+
+ if (head1 == list)
+ list = head2;
+
+ head2 = next;
+ }
+ }
+ head1 = head2;
+ }
}
- ll->accounting = evas_mempool_malloc(&_evas_list_accounting_mempool, sizeof(Evas_List_Accounting));
- ((Evas_List_Accounting *)(ll->accounting))->last = llast;
- ((Evas_List_Accounting *)(ll->accounting))->count = size - mid;
-
- /* merge sort */
- l = evas_list_sort(list, mid, func);
- ll = evas_list_sort(ll, size - mid, func);
- list = evas_list_combine(l, ll, func);
return(list);
}
diff -Nrau -x '*.lo' -x '*.la' -x doc -x Makefile -x Makefile.in -x CVS -x autom4te.cache -x '*.o' -x 'config.*' -x configure -x .deps -x .libs e17-main/libs/evas/src/lib/engines/common/evas_tiler.c e17-dev/libs/evas/src/lib/engines/common/evas_tiler.c
--- e17-main/libs/evas/src/lib/engines/common/evas_tiler.c 2006-12-26 11:57:38.000000000 +0100
+++ e17-dev/libs/evas/src/lib/engines/common/evas_tiler.c 2006-12-26 14:29:50.000000000 +0100
@@ -81,16 +81,24 @@
if (tilebuf_x_intersect(tb, x, w, &tx1, &tx2, &tfx1, &tfx2) &&
tilebuf_y_intersect(tb, y, h, &ty1, &ty2, &tfy1, &tfy2))
{
- for (yy = ty1; yy <= ty2; yy++)
+ Tilebuf_Tile *tbt;
+ int delta_x;
+ int delta_y;
+
+ tbt = &(TILE(tb, tx1, ty1));
+ delta_x = tx2 - tx1 + 1;
+ delta_y = ty2 - ty1 + 1;
+ for (yy = delta_y; yy > 0; yy--)
{
- Tilebuf_Tile *tbt;
+ Tilebuf_Tile *tbti;
- tbt = &(TILE(tb, tx1, yy));
- for (xx = tx1; xx <= tx2; xx++)
+ tbti = tbt;
+ for (xx = delta_x; xx > 0; xx--)
{
- tbt->redraw = 1;
- tbt++;
+ tbti->redraw = 1;
+ tbti++;
}
+ tbt += tb->tiles.w;
}
num = (tx2 - tx1 + 1) * (ty2 - ty1 + 1);
}
@@ -115,20 +123,29 @@
if (tilebuf_x_intersect(tb, x, w, &tx1, &tx2, &tfx1, &tfx2) &&
tilebuf_y_intersect(tb, y, h, &ty1, &ty2, &tfy1, &tfy2))
{
- if (!tfx1) tx1++;
+ Tilebuf_Tile *tbt;
+ int delta_y;
+ int delta_x;
+
+ if (!tfx1) tx1++;
if (!tfx2) tx2--;
if (!tfy1) ty1++;
if (!tfy2) ty2--;
- for (yy = ty1; yy <= ty2; yy++)
+
+ tbt = &(TILE(tb, tx1, ty1));
+ delta_x = tx2 - tx1 + 1;
+ delta_y = ty2 - ty1 + 1;
+ for (yy = delta_y; yy > 0; yy--)
{
- Tilebuf_Tile *tbt;
+ Tilebuf_Tile *tbti;
- tbt = &(TILE(tb, tx1, yy));
- for (xx = tx1; xx <= tx2; xx++)
+ tbti = tbt;
+ for (xx = delta_x; xx > 0; xx--)
{
- tbt->redraw = 0;
- tbt++;
+ tbti->redraw = 0;
+ tbti++;
}
+ tbt += tb->tiles.w;
}
num = (tx2 - tx1 + 1) * (ty2 - ty1 + 1);
}
@@ -166,42 +183,56 @@
return evas_common_regionbuf_rects_get(tb->rb);
#else
Tilebuf_Rect *rects = NULL;
+ Tilebuf_Tile *tbt;
int x, y;
+ tbt = &(TILE(tb, 0, 0));
for (y = 0; y < tb->tiles.h; y++)
{
- for (x = 0; x < tb->tiles.w; x++)
+ for (x = 0; x < tb->tiles.w; x++, tbt++)
{
- if (TILE(tb, x, y).redraw)
+ if (tbt->redraw)
{
+ Tilebuf_Tile *tbti;
int can_expand_x = 1, can_expand_y = 1;
Tilebuf_Rect *r = NULL;
int xx = 0, yy = 0;
- r = calloc(1, sizeof(Tilebuf_Rect));
+ r = malloc(sizeof(Tilebuf_Rect));
+ r->_list_data.next = NULL;
+ r->_list_data.prev = NULL;
+ r->_list_data.last = NULL;
+
/* amalgamate tiles */
#if 1
+ tbti = tbt;
while (can_expand_x)
{
+ tbti++;
xx++;
if ((x + xx) >= tb->tiles.w)
can_expand_x = 0;
- else if (!(TILE(tb, x + xx, y).redraw))
+ else if (!(tbti->redraw))
can_expand_x = 0;
if (can_expand_x)
- TILE(tb, x + xx, y).redraw = 0;
+ tbti->redraw = 0;
}
+ tbti = tbt;
while (can_expand_y)
{
int i;
+ tbti += tb->tiles.w;
yy++;
if ((y + yy) >= tb->tiles.h)
can_expand_y = 0;
if (can_expand_y)
{
- for (i = x; i < x + xx; i++)
+ Tilebuf_Tile *tbtj;
+
+ tbtj = tbti;
+ for (i = x; i < x + xx; i++, tbtj++)
{
- if (!(TILE(tb, i, y + yy).redraw))
+ if (!(tbtj->redraw))
{
can_expand_y = 0;
break;
@@ -210,11 +241,14 @@
}
if (can_expand_y)
{
- for (i = x; i < x + xx; i++)
- TILE(tb, i, y + yy).redraw = 0;
+ Tilebuf_Tile *tbtj;
+
+ tbtj = tbti;
+ for (i = x; i < x + xx; i++, tbtj++)
+ tbtj->redraw = 0;
}
}
- TILE(tb, x, y).redraw = 0;
+ tbt->redraw = 0;
#else
xx = 1;
yy = 1;
@@ -225,6 +259,7 @@
r->h = (yy) * tb->tile_size.h;
rects = evas_object_list_append(rects, r);
x = x + (xx - 1);
+ tbt += xx - 1;
}
}
}
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel