forked from enlightenment/efl
edje: edje_cc will now only store and encore needed image.
SVN revision: 67524
This commit is contained in:
parent
14a94f1a8f
commit
7191b9a3f6
|
@ -303,3 +303,7 @@
|
||||||
2012-01-24 Cedric Bail
|
2012-01-24 Cedric Bail
|
||||||
|
|
||||||
* Filter should only be valid once all program affecting there part are done.
|
* Filter should only be valid once all program affecting there part are done.
|
||||||
|
|
||||||
|
2012-01-25 Cedric Bail
|
||||||
|
|
||||||
|
* Only store the image used by active group.
|
||||||
|
|
|
@ -16,6 +16,7 @@ Improvements:
|
||||||
* reduce number of call to stat during edje_object_file_set.
|
* reduce number of call to stat during edje_object_file_set.
|
||||||
* unswallow object about to be swallowed if necessary.
|
* unswallow object about to be swallowed if necessary.
|
||||||
* Lua scripts now more resilient against API changes.
|
* Lua scripts now more resilient against API changes.
|
||||||
|
* edje_cc only store the image activelly used in an edje file.
|
||||||
|
|
||||||
Changes since Edje 1.0.0:
|
Changes since Edje 1.0.0:
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
|
@ -147,6 +147,7 @@ void data_queue_anonymous_lookup(Edje_Part_Collection *pc, Edje_Program *ep,
|
||||||
void data_queue_copied_anonymous_lookup(Edje_Part_Collection *pc, int *src, int *dest);
|
void data_queue_copied_anonymous_lookup(Edje_Part_Collection *pc, int *src, int *dest);
|
||||||
void data_queue_image_lookup(char *name, int *dest, Eina_Bool *set);
|
void data_queue_image_lookup(char *name, int *dest, Eina_Bool *set);
|
||||||
void data_queue_copied_image_lookup(int *src, int *dest, Eina_Bool *set);
|
void data_queue_copied_image_lookup(int *src, int *dest, Eina_Bool *set);
|
||||||
|
void data_queue_image_remove(int *dest, Eina_Bool *set);
|
||||||
void data_queue_part_slave_lookup(int *master, int *slave);
|
void data_queue_part_slave_lookup(int *master, int *slave);
|
||||||
void data_queue_image_slave_lookup(int *master, int *slave);
|
void data_queue_image_slave_lookup(int *master, int *slave);
|
||||||
void data_queue_spectrum_lookup(char *name, int *dest);
|
void data_queue_spectrum_lookup(char *name, int *dest);
|
||||||
|
|
|
@ -2156,7 +2156,7 @@ st_collections_group_name(void)
|
||||||
Edje_Part_Collection *pc;
|
Edje_Part_Collection *pc;
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
Code *cd;
|
Code *cd;
|
||||||
int i = 0;
|
unsigned int i = 0;
|
||||||
|
|
||||||
pc = eina_list_nth(edje_collections, older->id);
|
pc = eina_list_nth(edje_collections, older->id);
|
||||||
cd = eina_list_nth(codes, older->id);
|
cd = eina_list_nth(codes, older->id);
|
||||||
|
@ -2173,6 +2173,23 @@ st_collections_group_name(void)
|
||||||
if (older) older->id = pc->id;
|
if (older) older->id = pc->id;
|
||||||
else if (pc->part == current_pc->part) current_de->id = pc->id;
|
else if (pc->part == current_pc->part) current_de->id = pc->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < pc->parts_count; ++i)
|
||||||
|
{
|
||||||
|
Edje_Part_Description_Image *ed;
|
||||||
|
unsigned int j;
|
||||||
|
|
||||||
|
if (pc->parts[i]->type != EDJE_PART_TYPE_IMAGE)
|
||||||
|
continue ;
|
||||||
|
|
||||||
|
ed = (Edje_Part_Description_Image*) &pc->parts[i];
|
||||||
|
|
||||||
|
data_queue_image_remove(&(ed->image.id), &(ed->image.set));
|
||||||
|
|
||||||
|
for (j = 0; j < ed->image.tweens_count; ++j)
|
||||||
|
data_queue_image_remove(&(ed->image.tweens[ed->image.tweens_count - 1]->id),
|
||||||
|
&(ed->image.tweens[ed->image.tweens_count - 1]->set));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eina_hash_direct_add(edje_file->collection, current_de->entry, current_de);
|
eina_hash_direct_add(edje_file->collection, current_de->entry, current_de);
|
||||||
|
|
|
@ -102,7 +102,7 @@ struct _Code_Lookup
|
||||||
Eina_Bool set;
|
Eina_Bool set;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void data_process_string(Edje_Part_Collection *pc, const char *prefix, char *s, void (*func)(Edje_Part_Collection *pc, char *name, char *ptr, int len));
|
static void data_process_string(Edje_Part_Collection *pc, const char *prefix, char *s, void (*func)(Edje_Part_Collection *pc, char *name, char* ptr, int len));
|
||||||
|
|
||||||
Edje_File *edje_file = NULL;
|
Edje_File *edje_file = NULL;
|
||||||
Eina_List *edje_collections = NULL;
|
Eina_List *edje_collections = NULL;
|
||||||
|
@ -500,7 +500,8 @@ data_write_images(Eet_File *ef, int *image_num, int *input_bytes, int *input_raw
|
||||||
{
|
{
|
||||||
img = &edje_file->image_dir->entries[i];
|
img = &edje_file->image_dir->entries[i];
|
||||||
|
|
||||||
if (img->source_type == EDJE_IMAGE_SOURCE_TYPE_EXTERNAL)
|
if (img->source_type == EDJE_IMAGE_SOURCE_TYPE_EXTERNAL
|
||||||
|
|| img->entry == NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1549,6 +1550,22 @@ data_queue_image_lookup(char *name, int *dest, Eina_Bool *set)
|
||||||
il->set = set;
|
il->set = set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
data_queue_image_remove(int *dest, Eina_Bool *set)
|
||||||
|
{
|
||||||
|
Eina_List *l;
|
||||||
|
Image_Lookup *il;
|
||||||
|
|
||||||
|
EINA_LIST_FOREACH(image_lookups, l, il)
|
||||||
|
{
|
||||||
|
if (il->dest == dest && il->set == set)
|
||||||
|
{
|
||||||
|
image_lookups = eina_list_remove_list(image_lookups, l);
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
data_queue_copied_image_lookup(int *src, int *dest, Eina_Bool *set)
|
data_queue_copied_image_lookup(int *src, int *dest, Eina_Bool *set)
|
||||||
{
|
{
|
||||||
|
@ -1603,6 +1620,7 @@ data_process_lookups(void)
|
||||||
Group_Lookup *group;
|
Group_Lookup *group;
|
||||||
Image_Lookup *image;
|
Image_Lookup *image;
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
|
Eina_Hash *images_in_use;
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
EINA_LIST_FOREACH(edje_collections, l, pc)
|
EINA_LIST_FOREACH(edje_collections, l, pc)
|
||||||
|
@ -1738,13 +1756,15 @@ data_process_lookups(void)
|
||||||
free(group);
|
free(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
images_in_use = eina_hash_string_superfast_new(NULL);
|
||||||
|
|
||||||
EINA_LIST_FREE(image_lookups, image)
|
EINA_LIST_FREE(image_lookups, image)
|
||||||
{
|
{
|
||||||
Edje_Image_Directory_Entry *de;
|
|
||||||
Eina_Bool find = EINA_FALSE;
|
Eina_Bool find = EINA_FALSE;
|
||||||
|
|
||||||
if (edje_file->image_dir)
|
if (edje_file->image_dir)
|
||||||
{
|
{
|
||||||
|
Edje_Image_Directory_Entry *de;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < edje_file->image_dir->entries_count; ++i)
|
for (i = 0; i < edje_file->image_dir->entries_count; ++i)
|
||||||
|
@ -1760,6 +1780,9 @@ data_process_lookups(void)
|
||||||
*(image->dest) = de->id;
|
*(image->dest) = de->id;
|
||||||
*(image->set) = EINA_FALSE;
|
*(image->set) = EINA_FALSE;
|
||||||
find = EINA_TRUE;
|
find = EINA_TRUE;
|
||||||
|
|
||||||
|
if (!eina_hash_find(images_in_use, image->name))
|
||||||
|
eina_hash_direct_add(images_in_use, de->entry, de);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1778,6 +1801,9 @@ data_process_lookups(void)
|
||||||
*(image->dest) = set->id;
|
*(image->dest) = set->id;
|
||||||
*(image->set) = EINA_TRUE;
|
*(image->set) = EINA_TRUE;
|
||||||
find = EINA_TRUE;
|
find = EINA_TRUE;
|
||||||
|
|
||||||
|
if (!eina_hash_find(images_in_use, image->name))
|
||||||
|
eina_hash_direct_add(images_in_use, set->name, set);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1795,6 +1821,54 @@ data_process_lookups(void)
|
||||||
free(image);
|
free(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (edje_file->image_dir)
|
||||||
|
{
|
||||||
|
Edje_Image_Directory_Entry *de;
|
||||||
|
Edje_Image_Directory_Set *set;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i < edje_file->image_dir->entries_count; ++i)
|
||||||
|
{
|
||||||
|
de = edje_file->image_dir->entries + i;
|
||||||
|
|
||||||
|
if (de->entry && eina_hash_find(images_in_use, de->entry))
|
||||||
|
continue ;
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
{
|
||||||
|
printf("%s: Image '%s' in ressource 'edje/image/%i' will not be included as it is unused.\n", progname, de->entry, de->id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
INF("Image '%s' in ressource 'edje/image/%i' will not be included as it is unused.", de->entry, de->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
de->entry = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < edje_file->image_dir->sets_count; ++i)
|
||||||
|
{
|
||||||
|
set = edje_file->image_dir->sets + i;
|
||||||
|
|
||||||
|
if (set->name && eina_hash_find(images_in_use, set->name))
|
||||||
|
continue ;
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
{
|
||||||
|
printf("%s: Set '%s' will not be included as it is unused.\n", progname, set->name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
INF("Set '%s' will not be included as it is unused.", set->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
set->name = NULL;
|
||||||
|
set->entries = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
eina_hash_free(images_in_use);
|
||||||
|
|
||||||
EINA_LIST_FREE(part_slave_lookups, data)
|
EINA_LIST_FREE(part_slave_lookups, data)
|
||||||
free(data);
|
free(data);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue