forked from enlightenment/efl
parent
e0b17ee4ee
commit
a9daf7dd89
|
@ -63,6 +63,32 @@ _edje_file_coll_open(Edje_File *edf, Eet_File *ef, const char *coll)
|
||||||
return edc;
|
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 *
|
static Edje_File *
|
||||||
_edje_file_open(const char *file, const char *coll, int *error_ret, Edje_Part_Collection **edc_ret)
|
_edje_file_open(const char *file, const char *coll, int *error_ret, Edje_Part_Collection **edc_ret)
|
||||||
{
|
{
|
||||||
|
@ -112,18 +138,19 @@ _edje_file_open(const char *file, const char *coll, int *error_ret, Edje_Part_Co
|
||||||
}
|
}
|
||||||
edf->data = NULL;
|
edf->data = NULL;
|
||||||
|
|
||||||
if (!coll)
|
if (coll)
|
||||||
{
|
{
|
||||||
eet_close(ef);
|
edc = _edje_file_coll_open(edf, ef, coll);
|
||||||
return edf;
|
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);
|
_edje_font_hash (edf);
|
||||||
if (!edc)
|
|
||||||
{
|
|
||||||
*error_ret = EDJE_LOAD_ERROR_UNKNOWN_COLLECTION;
|
|
||||||
}
|
|
||||||
if (edc_ret) *edc_ret = edc;
|
|
||||||
|
|
||||||
eet_close(ef);
|
eet_close(ef);
|
||||||
|
|
||||||
|
|
|
@ -602,7 +602,6 @@ _edje_part_recalc_single(Edje *ed,
|
||||||
const char *font;
|
const char *font;
|
||||||
int size;
|
int size;
|
||||||
Evas_Coord tw, th;
|
Evas_Coord tw, th;
|
||||||
char buf[4096];
|
|
||||||
int inlined_font = 0;
|
int inlined_font = 0;
|
||||||
|
|
||||||
/* Update a object_text part */
|
/* Update a object_text part */
|
||||||
|
@ -683,24 +682,14 @@ _edje_part_recalc_single(Edje *ed,
|
||||||
if (!text) text = "";
|
if (!text) text = "";
|
||||||
|
|
||||||
/* check if the font is embedded in the .eet */
|
/* check if the font is embedded in the .eet */
|
||||||
/* FIXME: we should cache this result */
|
if (ed->file->font_hash)
|
||||||
if (ed->file->font_dir)
|
|
||||||
{
|
{
|
||||||
Evas_List *l;
|
Edje_Font_Directory_Entry *fnt = evas_hash_find (ed->file->font_hash, font);
|
||||||
|
|
||||||
for (l = ed->file->font_dir->entries; l; l = l->next)
|
|
||||||
{
|
|
||||||
Edje_Font_Directory_Entry *fnt = l->data;
|
|
||||||
|
|
||||||
if ((fnt->entry) && (!strcmp(fnt->entry, font)))
|
if (fnt)
|
||||||
{
|
{
|
||||||
strcpy(buf, "fonts/");
|
font = fnt->path;
|
||||||
strncpy(buf + 6, font, sizeof(buf) - 7);
|
inlined_font = 1;
|
||||||
buf[sizeof(buf) - 1] = 0;
|
|
||||||
font = buf;
|
|
||||||
inlined_font = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
|
if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
|
||||||
|
|
|
@ -600,9 +600,10 @@ _edje_file_free(Edje_File *edf)
|
||||||
Edje_Font_Directory_Entry *fe;
|
Edje_Font_Directory_Entry *fe;
|
||||||
|
|
||||||
fe = edf->font_dir->entries->data;
|
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);
|
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(fe);
|
||||||
}
|
}
|
||||||
free(edf->font_dir);
|
free(edf->font_dir);
|
||||||
|
|
|
@ -221,13 +221,14 @@ struct _Edje_File
|
||||||
Evas_List *data;
|
Evas_List *data;
|
||||||
Evas_List *styles;
|
Evas_List *styles;
|
||||||
Evas_List *color_classes;
|
Evas_List *color_classes;
|
||||||
|
|
||||||
int references;
|
int references;
|
||||||
char *compiler;
|
char *compiler;
|
||||||
int version;
|
int version;
|
||||||
int feature_ver;
|
int feature_ver;
|
||||||
|
|
||||||
Evas_Hash *collection_hash;
|
Evas_Hash *collection_hash;
|
||||||
|
Evas_Hash *font_hash;
|
||||||
Evas_List *collection_cache;
|
Evas_List *collection_cache;
|
||||||
Evas_Hash *data_cache;
|
Evas_Hash *data_cache;
|
||||||
};
|
};
|
||||||
|
@ -265,7 +266,8 @@ struct _Edje_Font_Directory
|
||||||
|
|
||||||
struct _Edje_Font_Directory_Entry
|
struct _Edje_Font_Directory_Entry
|
||||||
{
|
{
|
||||||
char *entry; /* the name of the font */
|
const char *entry; /* the name of the font */
|
||||||
|
char *path;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -281,7 +281,6 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
|
||||||
int size;
|
int size;
|
||||||
Evas_Coord tw, th;
|
Evas_Coord tw, th;
|
||||||
Evas_Coord sw, sh;
|
Evas_Coord sw, sh;
|
||||||
char font_buf[4096];
|
|
||||||
int inlined_font = 0, free_text = 0;
|
int inlined_font = 0, free_text = 0;
|
||||||
|
|
||||||
|
|
||||||
|
@ -309,24 +308,14 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
|
||||||
if (!font) font = "";
|
if (!font) font = "";
|
||||||
|
|
||||||
/* check if the font is embedded in the .eet */
|
/* check if the font is embedded in the .eet */
|
||||||
/* FIXME: we should cache this result */
|
if (ed->file->font_hash)
|
||||||
if (ed->file->font_dir)
|
|
||||||
{
|
{
|
||||||
Evas_List *l;
|
Edje_Font_Directory_Entry *fnt = evas_hash_find (ed->file->font_hash, font);
|
||||||
|
|
||||||
for (l = ed->file->font_dir->entries; l; l = l->next)
|
if (fnt)
|
||||||
{
|
{
|
||||||
Edje_Font_Directory_Entry *fnt = l->data;
|
font = fnt->path;
|
||||||
|
inlined_font = 1;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,17 +8,14 @@
|
||||||
static int
|
static int
|
||||||
_edje_font_is_embedded(Edje_File *edf, char *font)
|
_edje_font_is_embedded(Edje_File *edf, char *font)
|
||||||
{
|
{
|
||||||
Evas_List *l;
|
Edje_Font_Directory_Entry *fnt = NULL;
|
||||||
|
|
||||||
if (!edf->font_dir) return 0;
|
if (!edf->font_dir) return 0;
|
||||||
for (l = edf->font_dir->entries; l; l = l->next)
|
/* fnt = evas_hash_find (edf->font_hash, font); */
|
||||||
{
|
/* if (fnt) */
|
||||||
Edje_Font_Directory_Entry *fnt = l->data;
|
/* if (fnt->entry && (!strcmp(fnt->entry, font))) */
|
||||||
|
/* return 1; */
|
||||||
if ((fnt->entry) && (!strcmp(fnt->entry, font)))
|
return 1;
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -81,16 +81,24 @@ evas_common_tilebuf_add_redraw(Tilebuf *tb, int x, int y, int w, int h)
|
||||||
if (tilebuf_x_intersect(tb, x, w, &tx1, &tx2, &tfx1, &tfx2) &&
|
if (tilebuf_x_intersect(tb, x, w, &tx1, &tx2, &tfx1, &tfx2) &&
|
||||||
tilebuf_y_intersect(tb, y, h, &ty1, &ty2, &tfy1, &tfy2))
|
tilebuf_y_intersect(tb, y, h, &ty1, &ty2, &tfy1, &tfy2))
|
||||||
{
|
{
|
||||||
for (yy = ty1; yy <= ty2; yy++)
|
Tilebuf_Tile *tbt;
|
||||||
{
|
int delta_x;
|
||||||
Tilebuf_Tile *tbt;
|
int delta_y;
|
||||||
|
|
||||||
tbt = &(TILE(tb, tx1, yy));
|
tbt = &(TILE(tb, tx1, ty1));
|
||||||
for (xx = tx1; xx <= tx2; xx++)
|
delta_x = tx2 - tx1 + 1;
|
||||||
|
delta_y = ty2 - ty1 + 1;
|
||||||
|
for (yy = delta_y; yy > 0; yy--)
|
||||||
|
{
|
||||||
|
Tilebuf_Tile *tbti;
|
||||||
|
|
||||||
|
tbti = tbt;
|
||||||
|
for (xx = delta_x; xx > 0; xx--)
|
||||||
{
|
{
|
||||||
tbt->redraw = 1;
|
tbti->redraw = 1;
|
||||||
tbt++;
|
tbti++;
|
||||||
}
|
}
|
||||||
|
tbt += tb->tiles.w;
|
||||||
}
|
}
|
||||||
num = (tx2 - tx1 + 1) * (ty2 - ty1 + 1);
|
num = (tx2 - tx1 + 1) * (ty2 - ty1 + 1);
|
||||||
}
|
}
|
||||||
|
@ -115,20 +123,29 @@ evas_common_tilebuf_del_redraw(Tilebuf *tb, int x, int y, int w, int h)
|
||||||
if (tilebuf_x_intersect(tb, x, w, &tx1, &tx2, &tfx1, &tfx2) &&
|
if (tilebuf_x_intersect(tb, x, w, &tx1, &tx2, &tfx1, &tfx2) &&
|
||||||
tilebuf_y_intersect(tb, y, h, &ty1, &ty2, &tfy1, &tfy2))
|
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 (!tfx2) tx2--;
|
||||||
if (!tfy1) ty1++;
|
if (!tfy1) ty1++;
|
||||||
if (!tfy2) ty2--;
|
if (!tfy2) ty2--;
|
||||||
for (yy = ty1; yy <= ty2; yy++)
|
|
||||||
{
|
|
||||||
Tilebuf_Tile *tbt;
|
|
||||||
|
|
||||||
tbt = &(TILE(tb, tx1, yy));
|
tbt = &(TILE(tb, tx1, ty1));
|
||||||
for (xx = tx1; xx <= tx2; xx++)
|
delta_x = tx2 - tx1 + 1;
|
||||||
|
delta_y = ty2 - ty1 + 1;
|
||||||
|
for (yy = delta_y; yy > 0; yy--)
|
||||||
|
{
|
||||||
|
Tilebuf_Tile *tbti;
|
||||||
|
|
||||||
|
tbti = tbt;
|
||||||
|
for (xx = delta_x; xx > 0; xx--)
|
||||||
{
|
{
|
||||||
tbt->redraw = 0;
|
tbti->redraw = 0;
|
||||||
tbt++;
|
tbti++;
|
||||||
}
|
}
|
||||||
|
tbt += tb->tiles.w;
|
||||||
}
|
}
|
||||||
num = (tx2 - tx1 + 1) * (ty2 - ty1 + 1);
|
num = (tx2 - tx1 + 1) * (ty2 - ty1 + 1);
|
||||||
}
|
}
|
||||||
|
@ -166,42 +183,56 @@ evas_common_tilebuf_get_render_rects(Tilebuf *tb)
|
||||||
return evas_common_regionbuf_rects_get(tb->rb);
|
return evas_common_regionbuf_rects_get(tb->rb);
|
||||||
#else
|
#else
|
||||||
Tilebuf_Rect *rects = NULL;
|
Tilebuf_Rect *rects = NULL;
|
||||||
|
Tilebuf_Tile *tbt;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
|
tbt = &(TILE(tb, 0, 0));
|
||||||
for (y = 0; y < tb->tiles.h; y++)
|
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;
|
int can_expand_x = 1, can_expand_y = 1;
|
||||||
Tilebuf_Rect *r = NULL;
|
Tilebuf_Rect *r = NULL;
|
||||||
int xx = 0, yy = 0;
|
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 */
|
/* amalgamate tiles */
|
||||||
#if 1
|
#if 1
|
||||||
|
tbti = tbt;
|
||||||
while (can_expand_x)
|
while (can_expand_x)
|
||||||
{
|
{
|
||||||
|
tbti++;
|
||||||
xx++;
|
xx++;
|
||||||
if ((x + xx) >= tb->tiles.w)
|
if ((x + xx) >= tb->tiles.w)
|
||||||
can_expand_x = 0;
|
can_expand_x = 0;
|
||||||
else if (!(TILE(tb, x + xx, y).redraw))
|
else if (!(tbti->redraw))
|
||||||
can_expand_x = 0;
|
can_expand_x = 0;
|
||||||
if (can_expand_x)
|
if (can_expand_x)
|
||||||
TILE(tb, x + xx, y).redraw = 0;
|
tbti->redraw = 0;
|
||||||
}
|
}
|
||||||
|
tbti = tbt;
|
||||||
while (can_expand_y)
|
while (can_expand_y)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
tbti += tb->tiles.w;
|
||||||
yy++;
|
yy++;
|
||||||
if ((y + yy) >= tb->tiles.h)
|
if ((y + yy) >= tb->tiles.h)
|
||||||
can_expand_y = 0;
|
can_expand_y = 0;
|
||||||
if (can_expand_y)
|
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;
|
can_expand_y = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -210,11 +241,14 @@ evas_common_tilebuf_get_render_rects(Tilebuf *tb)
|
||||||
}
|
}
|
||||||
if (can_expand_y)
|
if (can_expand_y)
|
||||||
{
|
{
|
||||||
for (i = x; i < x + xx; i++)
|
Tilebuf_Tile *tbtj;
|
||||||
TILE(tb, i, y + yy).redraw = 0;
|
|
||||||
|
tbtj = tbti;
|
||||||
|
for (i = x; i < x + xx; i++, tbtj++)
|
||||||
|
tbtj->redraw = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TILE(tb, x, y).redraw = 0;
|
tbt->redraw = 0;
|
||||||
#else
|
#else
|
||||||
xx = 1;
|
xx = 1;
|
||||||
yy = 1;
|
yy = 1;
|
||||||
|
@ -225,6 +259,7 @@ evas_common_tilebuf_get_render_rects(Tilebuf *tb)
|
||||||
r->h = (yy) * tb->tile_size.h;
|
r->h = (yy) * tb->tile_size.h;
|
||||||
rects = evas_object_list_append(rects, r);
|
rects = evas_object_list_append(rects, r);
|
||||||
x = x + (xx - 1);
|
x = x + (xx - 1);
|
||||||
|
tbt += xx - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue