summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/edje/edje_cc.c2
-rw-r--r--src/bin/edje/edje_cc.h2
-rw-r--r--src/bin/edje/edje_cc_handlers.c67
-rw-r--r--src/bin/edje/edje_cc_out.c20
-rw-r--r--src/bin/edje/edje_decc.c1
-rw-r--r--src/lib/edje/edje_cache.c68
-rw-r--r--src/lib/edje/edje_calc.c163
-rw-r--r--src/lib/edje/edje_data.c10
-rw-r--r--src/lib/edje/edje_load.c10
-rw-r--r--src/lib/edje/edje_private.h14
10 files changed, 287 insertions, 70 deletions
diff --git a/src/bin/edje/edje_cc.c b/src/bin/edje/edje_cc.c
index 52d2e28af1..df2a877c5a 100644
--- a/src/bin/edje/edje_cc.c
+++ b/src/bin/edje/edje_cc.c
@@ -33,6 +33,7 @@ char *depfile = NULL;
33char *authors = NULL; 33char *authors = NULL;
34char *license = NULL; 34char *license = NULL;
35Eina_List *licenses = NULL; 35Eina_List *licenses = NULL;
36Eina_Array *requires;
36 37
37static const char *progname = NULL; 38static const char *progname = NULL;
38 39
@@ -418,6 +419,7 @@ main(int argc, char **argv)
418 edje_file->efl_version.major = 1; 419 edje_file->efl_version.major = 1;
419 edje_file->efl_version.minor = 18; 420 edje_file->efl_version.minor = 18;
420 edje_file->base_scale = FROM_INT(1); 421 edje_file->base_scale = FROM_INT(1);
422 requires = eina_array_new(10);
421 423
422#ifdef HAVE_SYS_RESOURCE_H 424#ifdef HAVE_SYS_RESOURCE_H
423 { 425 {
diff --git a/src/bin/edje/edje_cc.h b/src/bin/edje/edje_cc.h
index 3bcea20871..6208d139d1 100644
--- a/src/bin/edje/edje_cc.h
+++ b/src/bin/edje/edje_cc.h
@@ -355,5 +355,5 @@ extern int beta;
355extern int had_quote; 355extern int had_quote;
356 356
357extern unsigned int max_open_files; 357extern unsigned int max_open_files;
358 358extern Eina_Array *requires;
359#endif 359#endif
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c
index e5109d1c8d..efefe32b29 100644
--- a/src/bin/edje/edje_cc_handlers.c
+++ b/src/bin/edje/edje_cc_handlers.c
@@ -203,6 +203,7 @@ static void *_part_free(Edje_Part_Collection *pc, Edje_Part *ep);
203static void check_has_anchors(void); 203static void check_has_anchors(void);
204 204
205static void st_id(void); 205static void st_id(void);
206static void st_requires(void);
206static void st_efl_version(void); 207static void st_efl_version(void);
207static void st_externals_external(void); 208static void st_externals_external(void);
208 209
@@ -703,6 +704,7 @@ static void _handle_vector_image(void);
703New_Statement_Handler statement_handlers[] = 704New_Statement_Handler statement_handlers[] =
704{ 705{
705 {"id", st_id}, 706 {"id", st_id},
707 {"requires", st_requires},
706 {"efl_version", st_efl_version}, 708 {"efl_version", st_efl_version},
707 {"externals.external", st_externals_external}, 709 {"externals.external", st_externals_external},
708 IMAGE_STATEMENTS("") 710 IMAGE_STATEMENTS("")
@@ -2243,10 +2245,47 @@ st_efl_version(void)
2243static void 2245static void
2244st_id(void) 2246st_id(void)
2245{ 2247{
2248 Eina_Array_Iterator it;
2249 unsigned int i;
2250 char *str, *id;
2251
2252 check_arg_count(1);
2253 id = parse_str(0);
2254
2255 EINA_ARRAY_ITER_NEXT(requires, i, str, it)
2256 if (eina_streq(str, id))
2257 error_and_abort(NULL, "Cannot use same id for file as one of its required files!");
2258 free((void*)edje_file->id);
2259 edje_file->id = id;
2260}
2261
2262/** @edcsubsection{toplevel_requires,
2263 * requires} */
2264
2265/**
2266 @page edcref
2267
2268 @property
2269 requires
2270 @parameters
2271 [name]
2272 @effect
2273 Specifying this property informs edje not to close the
2274 file with the corresponding id property for as long as this
2275 file is open. Multiple requires properties can be individually specified.
2276 @since 1.21
2277 @endproperty
2278 */
2279static void
2280st_requires(void)
2281{
2282 char *str;
2246 check_arg_count(1); 2283 check_arg_count(1);
2247 2284
2248 free(edje_file->id); 2285 str = parse_str(0);
2249 edje_file->id = parse_str(0); 2286 if (eina_streq(str, edje_file->id))
2287 error_and_abort(NULL, "Cannot require the current file!");
2288 eina_array_push(requires, str);
2250} 2289}
2251 2290
2252/** @edcsubsection{toplevel_externals, 2291/** @edcsubsection{toplevel_externals,
@@ -2353,7 +2392,7 @@ st_externals_external(void)
2353 @property 2392 @property
2354 image 2393 image
2355 @parameters 2394 @parameters
2356 [image file] [compression method] (compression level) 2395 [image file] [compression method] (compression level)(edje file id)
2357 @effect 2396 @effect
2358 Used to include each image file. The full path to the directory holding 2397 Used to include each image file. The full path to the directory holding
2359 the images can be defined later with edje_cc's "-id" option. 2398 the images can be defined later with edje_cc's "-id" option.
@@ -2364,6 +2403,7 @@ st_externals_external(void)
2364 @li LOSSY_ETC1 [0-100]: ETC1 lossy texture compression with quality from 0 to 100. 2403 @li LOSSY_ETC1 [0-100]: ETC1 lossy texture compression with quality from 0 to 100.
2365 @li LOSSY_ETC2 [0-100]: ETC2 lossy texture compression with quality from 0 to 100 (supports alpha). 2404 @li LOSSY_ETC2 [0-100]: ETC2 lossy texture compression with quality from 0 to 100 (supports alpha).
2366 @li USER: Do not embed the file, refer to the external file instead. 2405 @li USER: Do not embed the file, refer to the external file instead.
2406 @li EXTERNAL: The file exists in the edje file with the specified id.
2367 2407
2368 Defaults: compression level for lossy methods is 90. 2408 Defaults: compression level for lossy methods is 90.
2369 @endproperty 2409 @endproperty
@@ -2417,6 +2457,7 @@ st_images_image(void)
2417 "LOSSY_ETC1", 3, 2457 "LOSSY_ETC1", 3,
2418 "LOSSY_ETC2", 4, 2458 "LOSSY_ETC2", 4,
2419 "USER", 5, 2459 "USER", 5,
2460 "EXTERNAL", 6,
2420 NULL); 2461 NULL);
2421 if (v == 0) 2462 if (v == 0)
2422 { 2463 {
@@ -2448,16 +2489,29 @@ st_images_image(void)
2448 img->source_type = EDJE_IMAGE_SOURCE_TYPE_USER; 2489 img->source_type = EDJE_IMAGE_SOURCE_TYPE_USER;
2449 img->source_param = 0; 2490 img->source_param = 0;
2450 } 2491 }
2492 else if (v == 6)
2493 {
2494 img->source_type = EDJE_IMAGE_SOURCE_TYPE_EXTERNAL;
2495 img->source_param = 0;
2496 img->external_id = parse_str(2);
2497 }
2451 if ((img->source_type < EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY) || 2498 if ((img->source_type < EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY) ||
2452 (img->source_type > EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY_ETC2)) 2499 (img->source_type == EDJE_IMAGE_SOURCE_TYPE_USER))
2453 check_arg_count(2); 2500 check_arg_count(2);
2454 else 2501 else if (img->source_type != EDJE_IMAGE_SOURCE_TYPE_EXTERNAL)
2455 { 2502 {
2456 if (check_range_arg_count(2, 3) > 2) 2503 if (check_range_arg_count(2, 3) > 2)
2457 img->source_param = parse_int_range(2, 0, 100); 2504 img->source_param = parse_int_range(2, 0, 100);
2458 else 2505 else
2459 img->source_param = 90; 2506 img->source_param = 90;
2460 } 2507 }
2508 if (!edje_file->image_id_hash)
2509 edje_file->image_id_hash = eina_hash_string_superfast_new(free);
2510 {
2511 Edje_Image_Hash *eih = mem_alloc(SZ(Edje_Image_Hash));
2512 eih->id = img->id;
2513 eina_hash_add(edje_file->image_id_hash, tmp, eih);
2514 }
2461} 2515}
2462 2516
2463static void 2517static void
@@ -2736,7 +2790,7 @@ ob_images_set_image(void)
2736 @property 2790 @property
2737 image 2791 image
2738 @parameters 2792 @parameters
2739 [image file] [compression method] (compression level) 2793 [image file] [compression method] (compression level)(edje file id)
2740 @effect 2794 @effect
2741 Used to include each image file. The full path to the directory holding 2795 Used to include each image file. The full path to the directory holding
2742 the images can be defined later with edje_cc's "-id" option. 2796 the images can be defined later with edje_cc's "-id" option.
@@ -2747,6 +2801,7 @@ ob_images_set_image(void)
2747 @li LOSSY_ETC1 [0-100]: ETC1 lossy texture compression with quality from 0 to 100. 2801 @li LOSSY_ETC1 [0-100]: ETC1 lossy texture compression with quality from 0 to 100.
2748 @li LOSSY_ETC2 [0-100]: ETC2 lossy texture compression with quality from 0 to 100 (supports alpha). 2802 @li LOSSY_ETC2 [0-100]: ETC2 lossy texture compression with quality from 0 to 100 (supports alpha).
2749 @li USER: Do not embed the file, refer to the external file instead. 2803 @li USER: Do not embed the file, refer to the external file instead.
2804 @li EXTERNAL: The file exists in the edje file with the specified id.
2750 2805
2751 Defaults: compression level for lossy methods is 90. 2806 Defaults: compression level for lossy methods is 90.
2752 @endproperty 2807 @endproperty
diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c
index b13cf20abd..f315526e4f 100644
--- a/src/bin/edje/edje_cc_out.c
+++ b/src/bin/edje/edje_cc_out.c
@@ -1381,7 +1381,7 @@ data_write_images(void)
1381 Image_Write *iw; 1381 Image_Write *iw;
1382 1382
1383 img = &edje_file->image_dir->entries[cur_image_entry]; 1383 img = &edje_file->image_dir->entries[cur_image_entry];
1384 if ((img->source_type == EDJE_IMAGE_SOURCE_TYPE_USER) || !img->entry) 1384 if ((img->source_type >= EDJE_IMAGE_SOURCE_TYPE_USER) || !img->entry)
1385 continue; 1385 continue;
1386 1386
1387 if (img->source_type == EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY_ETC1 || 1387 if (img->source_type == EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY_ETC1 ||
@@ -1452,7 +1452,7 @@ data_write_images(void)
1452 } 1452 }
1453 } 1453 }
1454 1454
1455 if (img->source_type != EDJE_IMAGE_SOURCE_TYPE_USER) 1455 if (img->source_type < EDJE_IMAGE_SOURCE_TYPE_USER)
1456 { 1456 {
1457 ext = strrchr(img->entry, '.'); 1457 ext = strrchr(img->entry, '.');
1458 if (ext && (!strcasecmp(ext, ".svg") || !strcasecmp(ext, ".svgz"))) 1458 if (ext && (!strcasecmp(ext, ".svg") || !strcasecmp(ext, ".svgz")))
@@ -2713,6 +2713,20 @@ data_write(void)
2713 EFL_VERSION_MAJOR, EFL_VERSION_MINOR); 2713 EFL_VERSION_MAJOR, EFL_VERSION_MINOR);
2714 } 2714 }
2715 2715
2716 if (eina_array_count(requires))
2717 {
2718 int i = 0;
2719
2720 edje_file->requires_count = eina_array_count(requires);
2721 edje_file->requires = mem_alloc(edje_file->requires_count * sizeof(void*));
2722 do
2723 {
2724 edje_file->requires[i] = eina_array_pop(requires);
2725 i++;
2726 } while (eina_array_count(requires));
2727 eina_array_free(requires);
2728 }
2729
2716 check_groups(ef); 2730 check_groups(ef);
2717 2731
2718 ecore_thread_max_set(ecore_thread_max_get() * 2); 2732 ecore_thread_max_set(ecore_thread_max_get() * 2);
@@ -3947,7 +3961,7 @@ free_group:
3947 3961
3948 if ((de->entry) && (!strcmp(de->entry, image->name))) 3962 if ((de->entry) && (!strcmp(de->entry, image->name)))
3949 { 3963 {
3950 if (de->source_type == EDJE_IMAGE_SOURCE_TYPE_USER) 3964 if (de->source_type >= EDJE_IMAGE_SOURCE_TYPE_USER)
3951 *(image->dest) = -de->id - 1; 3965 *(image->dest) = -de->id - 1;
3952 else 3966 else
3953 *(image->dest) = de->id; 3967 *(image->dest) = de->id;
diff --git a/src/bin/edje/edje_decc.c b/src/bin/edje/edje_decc.c
index ee640479d7..dfee86affe 100644
--- a/src/bin/edje/edje_decc.c
+++ b/src/bin/edje/edje_decc.c
@@ -304,6 +304,7 @@ output(void)
304 if ((ei->source_type > EDJE_IMAGE_SOURCE_TYPE_NONE) && 304 if ((ei->source_type > EDJE_IMAGE_SOURCE_TYPE_NONE) &&
305 (ei->source_type < EDJE_IMAGE_SOURCE_TYPE_LAST) && 305 (ei->source_type < EDJE_IMAGE_SOURCE_TYPE_LAST) &&
306 (ei->source_type != EDJE_IMAGE_SOURCE_TYPE_USER) && 306 (ei->source_type != EDJE_IMAGE_SOURCE_TYPE_USER) &&
307 (ei->source_type != EDJE_IMAGE_SOURCE_TYPE_EXTERNAL) &&
307 (ei->entry)) 308 (ei->entry))
308 { 309 {
309 Ecore_Evas *ee; 310 Ecore_Evas *ee;
diff --git a/src/lib/edje/edje_cache.c b/src/lib/edje/edje_cache.c
index 22414df4e9..b1b4eefe9a 100644
--- a/src/lib/edje/edje_cache.c
+++ b/src/lib/edje/edje_cache.c
@@ -1,7 +1,9 @@
1#include "edje_private.h" 1#include "edje_private.h"
2 2
3Eina_Hash *_edje_file_hash = NULL; 3Eina_Hash *_edje_file_hash = NULL;
4Eina_Hash *_edje_id_hash = NULL;
4 5
6static Eina_Hash *_edje_requires_pending;
5static int _edje_file_cache_size = 16; 7static int _edje_file_cache_size = 16;
6static Eina_List *_edje_file_cache = NULL; 8static Eina_List *_edje_file_cache = NULL;
7 9
@@ -387,6 +389,39 @@ _edje_file_open(const Eina_File *f, int *error_ret, time_t mtime, Eina_Bool coll
387 if (sc->name) 389 if (sc->name)
388 eina_hash_direct_add(edf->size_hash, sc->name, sc); 390 eina_hash_direct_add(edf->size_hash, sc->name, sc);
389 391
392 if (edf->requires_count)
393 {
394 unsigned int i;
395 Edje_File *required_edf;
396
397 for (i = 0; i < edf->requires_count; i++)
398 {
399 required_edf = eina_hash_find(_edje_id_hash, edf->requires[i]);
400 if (required_edf)
401 {
402 required_edf->references++;
403 continue;
404 }
405 ERR("edje file '%s' REQUIRES file '%s' which is not loaded", edf->path, edf->requires[i]);
406 if (!_edje_requires_pending)
407 _edje_requires_pending = eina_hash_stringshared_new(NULL);
408 eina_hash_list_append(_edje_requires_pending, edf->requires[i], edf);
409 }
410 }
411 if (_edje_requires_pending && edf->id)
412 {
413 l = eina_hash_set(_edje_requires_pending, edf->id, NULL);
414
415 edf->references += eina_list_count(l);
416 eina_list_free(l);
417
418 if (!eina_hash_population(_edje_requires_pending))
419 {
420 eina_hash_free(_edje_requires_pending);
421 _edje_requires_pending = NULL;
422 }
423 }
424
390 return edf; 425 return edf;
391} 426}
392 427
@@ -416,6 +451,8 @@ _edje_cache_file_coll_open(const Eina_File *file, const char *coll, int *error_r
416 Edje_Part_Collection *edc; 451 Edje_Part_Collection *edc;
417 Edje_Part *ep; 452 Edje_Part *ep;
418 453
454 if (!_edje_id_hash)
455 _edje_id_hash = eina_hash_stringshared_new(NULL);
419 if (!_edje_file_hash) 456 if (!_edje_file_hash)
420 { 457 {
421 _edje_file_hash = eina_hash_pointer_new(NULL); 458 _edje_file_hash = eina_hash_pointer_new(NULL);
@@ -445,6 +482,8 @@ find_list:
445 if (!edf) return NULL; 482 if (!edf) return NULL;
446 483
447 eina_hash_direct_add(_edje_file_hash, &edf->f, edf); 484 eina_hash_direct_add(_edje_file_hash, &edf->f, edf);
485 if (edf->id)
486 eina_hash_list_append(_edje_id_hash, edf->id, edf);
448 /* return edf; */ 487 /* return edf; */
449 488
450open: 489open:
@@ -648,12 +687,41 @@ _edje_cache_file_unref(Edje_File *edf)
648 edf->references--; 687 edf->references--;
649 if (edf->references != 0) return; 688 if (edf->references != 0) return;
650 689
690 if (edf->requires_count)
691 {
692 unsigned int i;
693
694 for (i = 0; i < edf->requires_count; i++)
695 {
696 Edje_File *required_edf = eina_hash_find(_edje_id_hash, edf->requires[i]);
697
698 if (required_edf)
699 _edje_cache_file_unref(edf);
700 else if (_edje_requires_pending)
701 {
702 eina_hash_list_remove(_edje_requires_pending, edf->requires[i], edf);
703 if (!eina_hash_population(_edje_requires_pending))
704 {
705 eina_hash_free(_edje_requires_pending);
706 _edje_requires_pending = NULL;
707 }
708 }
709 }
710 }
711
651 if (edf->dangling) 712 if (edf->dangling)
652 { 713 {
653 _edje_file_free(edf); 714 _edje_file_free(edf);
654 return; 715 return;
655 } 716 }
656 717
718 if (edf->id)
719 eina_hash_list_remove(_edje_id_hash, edf->id, edf);
720 if (!eina_hash_population(_edje_id_hash))
721 {
722 eina_hash_free(_edje_id_hash);
723 _edje_id_hash = NULL;
724 }
657 eina_hash_del(_edje_file_hash, &edf->f, edf); 725 eina_hash_del(_edje_file_hash, &edf->f, edf);
658 if (!eina_hash_population(_edje_file_hash)) 726 if (!eina_hash_population(_edje_file_hash))
659 { 727 {
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index 1bb2833265..4a9dde787b 100644
--- a/src/lib/edje/edje_calc.c
+++ b/src/lib/edje/edje_calc.c
@@ -597,6 +597,100 @@ _edje_image_find(Evas_Object *obj, Edje *ed, Edje_Real_Part_Set **eps,
597} 597}
598 598
599static void 599static void
600_edje_real_part_image_error_check(Edje_Real_Part *ep)
601{
602 switch (evas_object_image_load_error_get(ep->object))
603 {
604 case EVAS_LOAD_ERROR_GENERIC:
605 ERR("Error type: EVAS_LOAD_ERROR_GENERIC");
606 break;
607
608 case EVAS_LOAD_ERROR_DOES_NOT_EXIST:
609 ERR("Error type: EVAS_LOAD_ERROR_DOES_NOT_EXIST");
610 break;
611
612 case EVAS_LOAD_ERROR_PERMISSION_DENIED:
613 ERR("Error type: EVAS_LOAD_ERROR_PERMISSION_DENIED");
614 break;
615
616 case EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED:
617 ERR("Error type: EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED");
618 break;
619
620 case EVAS_LOAD_ERROR_CORRUPT_FILE:
621 ERR("Error type: EVAS_LOAD_ERROR_CORRUPT_FILE");
622 break;
623
624 case EVAS_LOAD_ERROR_UNKNOWN_FORMAT:
625 ERR("Error type: EVAS_LOAD_ERROR_UNKNOWN_FORMAT");
626 break;
627
628 default:
629 ERR("Error type: ???");
630 break;
631 }
632}
633
634static Eina_Bool
635_edje_real_part_image_internal_set(Edje_File *edf, Edje_Real_Part *ep, int image_id)
636{
637 char buf[1024] = "edje/images/";
638
639 /* Replace snprint("edje/images/%i") == memcpy + itoa */
640 eina_convert_itoa(image_id, buf + 12); /* No need to check length as 2³² need only 10 characteres. */
641
642 evas_object_image_mmap_set(ep->object, edf->f, buf);
643 if (evas_object_image_load_error_get(ep->object) != EVAS_LOAD_ERROR_NONE)
644 {
645 ERR("Error loading image collection \"%s\" from "
646 "file \"%s\". Missing EET Evas loader module?",
647 buf, edf->path);
648 _edje_real_part_image_error_check(ep);
649 return EINA_FALSE;
650 }
651 return EINA_TRUE;
652}
653
654static Eina_Bool
655_edje_real_part_image_external_set(Edje_File *edf, Edje_Real_Part *ep, int image_id)
656{
657 Edje_Image_Directory_Entry *ie;
658
659 if (!edf->image_dir) return EINA_FALSE;
660 ie = edf->image_dir->entries + (-image_id) - 1;
661 if ((ie) &&
662 (ie->source_type == EDJE_IMAGE_SOURCE_TYPE_USER) &&
663 (ie->entry))
664 {
665 evas_object_image_file_set(ep->object, ie->entry, NULL);
666 _edje_real_part_image_error_check(ep);
667 return EINA_TRUE;
668 }
669 else if ((ie) &&
670 (ie->source_type == EDJE_IMAGE_SOURCE_TYPE_EXTERNAL) &&
671 (ie->entry))
672 {
673 Edje_File *edff;
674 Eina_List *l, *ll;
675
676 l = eina_hash_find(_edje_id_hash, ie->external_id);
677 EINA_LIST_FOREACH(l, ll, edff)
678 {
679 Edje_Image_Hash *eih = eina_hash_find(edff->image_id_hash, ie->entry);
680
681 if (!eih) continue;
682 if (eih->id < 0)
683 return _edje_real_part_image_external_set(edff, ep, eih->id);
684 else
685 _edje_real_part_image_internal_set(edff, ep, eih->id);
686 return EINA_TRUE;
687 }
688 return EINA_FALSE;
689 }
690 return EINA_FALSE;
691}
692
693static void
600_edje_real_part_image_set(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part_Set **set, FLOAT_T pos) 694_edje_real_part_image_set(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part_Set **set, FLOAT_T pos)
601{ 695{
602 int image_id; 696 int image_id;
@@ -609,16 +703,7 @@ _edje_real_part_image_set(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part_Set **set
609 if (set) *set = ep->param1.set; 703 if (set) *set = ep->param1.set;
610 if (image_id < 0) 704 if (image_id < 0)
611 { 705 {
612 Edje_Image_Directory_Entry *ie; 706 _edje_real_part_image_external_set(ed->file, ep, image_id);
613
614 if (!ed->file->image_dir) ie = NULL;
615 else ie = ed->file->image_dir->entries + (-image_id) - 1;
616 if ((ie) &&
617 (ie->source_type == EDJE_IMAGE_SOURCE_TYPE_USER) &&
618 (ie->entry))
619 {
620 evas_object_image_file_set(ep->object, ie->entry, NULL);
621 }
622 } 707 }
623 else 708 else
624 { 709 {
@@ -659,58 +744,18 @@ _edje_real_part_image_set(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part_Set **set
659 } 744 }
660 if (image_id < 0) 745 if (image_id < 0)
661 { 746 {
662 ERR("Part \"%s\" description, " 747 if (!_edje_real_part_image_external_set(ed->file, ep, image_id))
663 "\"%s\" %3.3f with image %i index has a missing image id in a set of %i !!!", 748 ERR("Part \"%s\" description, "
664 ep->part->name, 749 "\"%s\" %3.3f with image %i index has a missing image id in a set of %i !!!",
665 ep->param1.description->state.name, 750 ep->part->name,
666 ep->param1.description->state.value, 751 ep->param1.description->state.name,
667 image_num, 752 ep->param1.description->state.value,
668 image_count); 753 image_num,
754 image_count);
669 } 755 }
670 else 756 else
671 { 757 {
672 char buf[1024] = "edje/images/"; 758 _edje_real_part_image_internal_set(ed->file, ep, image_id);
673
674 /* Replace snprint("edje/images/%i") == memcpy + itoa */
675 eina_convert_itoa(image_id, buf + 12); /* No need to check length as 2³² need only 10 characteres. */
676
677 evas_object_image_mmap_set(ep->object, ed->file->f, buf);
678 if (evas_object_image_load_error_get(ep->object) != EVAS_LOAD_ERROR_NONE)
679 {
680 ERR("Error loading image collection \"%s\" from "
681 "file \"%s\". Missing EET Evas loader module?",
682 buf, ed->file->path);
683 switch (evas_object_image_load_error_get(ep->object))
684 {
685 case EVAS_LOAD_ERROR_GENERIC:
686 ERR("Error type: EVAS_LOAD_ERROR_GENERIC");
687 break;
688
689 case EVAS_LOAD_ERROR_DOES_NOT_EXIST:
690 ERR("Error type: EVAS_LOAD_ERROR_DOES_NOT_EXIST");
691 break;
692
693 case EVAS_LOAD_ERROR_PERMISSION_DENIED:
694 ERR("Error type: EVAS_LOAD_ERROR_PERMISSION_DENIED");
695 break;
696
697 case EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED:
698 ERR("Error type: EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED");
699 break;
700
701 case EVAS_LOAD_ERROR_CORRUPT_FILE:
702 ERR("Error type: EVAS_LOAD_ERROR_CORRUPT_FILE");
703 break;
704
705 case EVAS_LOAD_ERROR_UNKNOWN_FORMAT:
706 ERR("Error type: EVAS_LOAD_ERROR_UNKNOWN_FORMAT");
707 break;
708
709 default:
710 ERR("Error type: ???");
711 break;
712 }
713 }
714 } 759 }
715 } 760 }
716} 761}
diff --git a/src/lib/edje/edje_data.c b/src/lib/edje/edje_data.c
index b6df4b6fab..941a614313 100644
--- a/src/lib/edje/edje_data.c
+++ b/src/lib/edje/edje_data.c
@@ -13,6 +13,7 @@ Eet_Data_Descriptor *_edje_edd_edje_size_class = NULL;
13Eet_Data_Descriptor *_edje_edd_edje_external_directory = NULL; 13Eet_Data_Descriptor *_edje_edd_edje_external_directory = NULL;
14Eet_Data_Descriptor *_edje_edd_edje_external_directory_entry = NULL; 14Eet_Data_Descriptor *_edje_edd_edje_external_directory_entry = NULL;
15Eet_Data_Descriptor *_edje_edd_edje_font_directory_entry = NULL; 15Eet_Data_Descriptor *_edje_edd_edje_font_directory_entry = NULL;
16Eet_Data_Descriptor *_edje_edd_edje_image_id_hash = NULL;
16Eet_Data_Descriptor *_edje_edd_edje_image_directory = NULL; 17Eet_Data_Descriptor *_edje_edd_edje_image_directory = NULL;
17Eet_Data_Descriptor *_edje_edd_edje_image_directory_entry = NULL; 18Eet_Data_Descriptor *_edje_edd_edje_image_directory_entry = NULL;
18Eet_Data_Descriptor *_edje_edd_edje_image_directory_set = NULL; 19Eet_Data_Descriptor *_edje_edd_edje_image_directory_set = NULL;
@@ -253,6 +254,7 @@ _edje_edd_shutdown(void)
253 FREED(_edje_edd_edje_external_directory); 254 FREED(_edje_edd_edje_external_directory);
254 FREED(_edje_edd_edje_external_directory_entry); 255 FREED(_edje_edd_edje_external_directory_entry);
255 FREED(_edje_edd_edje_font_directory_entry); 256 FREED(_edje_edd_edje_font_directory_entry);
257 FREED(_edje_edd_edje_image_id_hash);
256 FREED(_edje_edd_edje_image_directory); 258 FREED(_edje_edd_edje_image_directory);
257 FREED(_edje_edd_edje_image_directory_entry); 259 FREED(_edje_edd_edje_image_directory_entry);
258 FREED(_edje_edd_edje_image_directory_set); 260 FREED(_edje_edd_edje_image_directory_set);
@@ -374,6 +376,11 @@ _edje_edd_init(void)
374 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_font_directory_entry, Edje_Font_Directory_Entry, "entry", entry, EET_T_STRING); 376 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_font_directory_entry, Edje_Font_Directory_Entry, "entry", entry, EET_T_STRING);
375 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_font_directory_entry, Edje_Font_Directory_Entry, "file", file, EET_T_STRING); 377 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_font_directory_entry, Edje_Font_Directory_Entry, "file", file, EET_T_STRING);
376 378
379 /* image hash */
380 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Image_Hash);
381 _edje_edd_edje_image_id_hash = eet_data_descriptor_file_new(&eddc);
382 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_id_hash, Edje_Image_Hash, "id", id, EET_T_INT);
383
377 /* image directory */ 384 /* image directory */
378 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Image_Directory_Entry); 385 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Image_Directory_Entry);
379 _edje_edd_edje_image_directory_entry = 386 _edje_edd_edje_image_directory_entry =
@@ -382,6 +389,7 @@ _edje_edd_init(void)
382 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_entry, Edje_Image_Directory_Entry, "source_type", source_type, EET_T_INT); 389 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_entry, Edje_Image_Directory_Entry, "source_type", source_type, EET_T_INT);
383 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_entry, Edje_Image_Directory_Entry, "source_param", source_param, EET_T_INT); 390 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_entry, Edje_Image_Directory_Entry, "source_param", source_param, EET_T_INT);
384 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_entry, Edje_Image_Directory_Entry, "id", id, EET_T_INT); 391 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_entry, Edje_Image_Directory_Entry, "id", id, EET_T_INT);
392 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_entry, Edje_Image_Directory_Entry, "external_id", external_id, EET_T_STRING);
385 393
386 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Image_Directory_Set_Entry); 394 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Image_Directory_Set_Entry);
387 _edje_edd_edje_image_directory_set_entry = 395 _edje_edd_edje_image_directory_set_entry =
@@ -614,6 +622,7 @@ _edje_edd_init(void)
614 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_file, Edje_File, "efl_version.minor", efl_version.minor, EET_T_INT); 622 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_file, Edje_File, "efl_version.minor", efl_version.minor, EET_T_INT);
615 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_file, Edje_File, "base_scale", base_scale, EDJE_T_FLOAT); 623 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_file, Edje_File, "base_scale", base_scale, EDJE_T_FLOAT);
616 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_file, Edje_File, "id", id, EET_T_STRING); 624 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_file, Edje_File, "id", id, EET_T_STRING);
625 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY_STRING(_edje_edd_edje_file, Edje_File, "requires", requires);
617 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "external_dir", external_dir, _edje_edd_edje_external_directory); 626 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "external_dir", external_dir, _edje_edd_edje_external_directory);
618 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "image_dir", image_dir, _edje_edd_edje_image_directory); 627 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "image_dir", image_dir, _edje_edd_edje_image_directory);
619 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "model_dir", model_dir, _edje_edd_edje_model_directory); 628 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "model_dir", model_dir, _edje_edd_edje_model_directory);
@@ -630,6 +639,7 @@ _edje_edd_init(void)
630 EET_DATA_DESCRIPTOR_ADD_HASH(_edje_edd_edje_file, Edje_File, "data", data, _edje_edd_edje_string); 639 EET_DATA_DESCRIPTOR_ADD_HASH(_edje_edd_edje_file, Edje_File, "data", data, _edje_edd_edje_string);
631 EET_DATA_DESCRIPTOR_ADD_HASH(_edje_edd_edje_file, Edje_File, "fonts", fonts, _edje_edd_edje_font_directory_entry); 640 EET_DATA_DESCRIPTOR_ADD_HASH(_edje_edd_edje_file, Edje_File, "fonts", fonts, _edje_edd_edje_font_directory_entry);
632 EET_DATA_DESCRIPTOR_ADD_HASH(_edje_edd_edje_file, Edje_File, "collection", collection, _edje_edd_edje_part_collection_directory_entry); 641 EET_DATA_DESCRIPTOR_ADD_HASH(_edje_edd_edje_file, Edje_File, "collection", collection, _edje_edd_edje_part_collection_directory_entry);
642 EET_DATA_DESCRIPTOR_ADD_HASH(_edje_edd_edje_file, Edje_File, "image_id_hash", image_id_hash, _edje_edd_edje_image_id_hash);
633 643
634 /* parts & limit & programs - loaded induvidually */ 644 /* parts & limit & programs - loaded induvidually */
635 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Limit); 645 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Limit);
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index f809d5a987..e69841b7fc 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -2111,6 +2111,16 @@ _edje_file_free(Edje_File *edf)
2111 HASH_FREE(edf->fonts); 2111 HASH_FREE(edf->fonts);
2112 HASH_FREE(edf->collection); 2112 HASH_FREE(edf->collection);
2113 HASH_FREE(edf->data); 2113 HASH_FREE(edf->data);
2114 HASH_FREE(edf->image_id_hash);
2115
2116 if (edf->requires_count)
2117 {
2118 unsigned int i;
2119
2120 for (i = 0; i < edf->requires_count; i++)
2121 eina_stringshare_del(edf->requires[i]);
2122 free(edf->requires);
2123 }
2114 2124
2115 if (edf->image_dir) 2125 if (edf->image_dir)
2116 { 2126 {
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index 87975753eb..02cbceaeab 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -430,7 +430,8 @@ typedef struct _Edje_Signal_Callback_Custom Edje_Signal_Callback_Custom;
430#define EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY_ETC1 3 430#define EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY_ETC1 3
431#define EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY_ETC2 4 431#define EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY_ETC2 4
432#define EDJE_IMAGE_SOURCE_TYPE_USER 5 432#define EDJE_IMAGE_SOURCE_TYPE_USER 5
433#define EDJE_IMAGE_SOURCE_TYPE_LAST 6 433#define EDJE_IMAGE_SOURCE_TYPE_EXTERNAL 6
434#define EDJE_IMAGE_SOURCE_TYPE_LAST 7
434 435
435#define EDJE_SOUND_SOURCE_TYPE_NONE 0 436#define EDJE_SOUND_SOURCE_TYPE_NONE 0
436#define EDJE_SOUND_SOURCE_TYPE_INLINE_RAW 1 437#define EDJE_SOUND_SOURCE_TYPE_INLINE_RAW 1
@@ -551,6 +552,11 @@ struct _AABB {
551 int rel_to; 552 int rel_to;
552}; 553};
553 554
555typedef struct Edje_Image_Hash
556{
557 int id;
558} Edje_Image_Hash;
559
554struct _Edje_File 560struct _Edje_File
555{ 561{
556 const char *path; 562 const char *path;
@@ -563,6 +569,10 @@ struct _Edje_File
563 Edje_Mo_Directory *mo_dir; 569 Edje_Mo_Directory *mo_dir;
564 Edje_Gfx_Filter_Directory *filter_dir; 570 Edje_Gfx_Filter_Directory *filter_dir;
565 571
572 Eina_Hash *image_id_hash;
573 Eina_Stringshare **requires;
574 unsigned int requires_count;
575
566 Eina_List *styles; 576 Eina_List *styles;
567 577
568 Eina_List *color_tree; 578 Eina_List *color_tree;
@@ -682,6 +692,7 @@ struct _Edje_Image_Directory_Entry
682 const char *entry; /* the nominal name of the image - if any */ 692 const char *entry; /* the nominal name of the image - if any */
683 int source_type; /* alternate source mode. 0 = none */ 693 int source_type; /* alternate source mode. 0 = none */
684 int source_param; /* extra params on encoding */ 694 int source_param; /* extra params on encoding */
695 Eina_Stringshare *external_id;
685 int id; /* the id no. of the image */ 696 int id; /* the id no. of the image */
686}; 697};
687 698
@@ -2377,6 +2388,7 @@ extern Eina_Cow *_edje_calc_params_map_cow;
2377extern Eina_Cow *_edje_calc_params_physics_cow; 2388extern Eina_Cow *_edje_calc_params_physics_cow;
2378 2389
2379extern Eina_Hash *_edje_file_hash; 2390extern Eina_Hash *_edje_file_hash;
2391extern Eina_Hash *_edje_id_hash;
2380 2392
2381extern const char *_edje_language; 2393extern const char *_edje_language;
2382extern const char *_edje_cache_path; 2394extern const char *_edje_cache_path;