summaryrefslogtreecommitdiff
path: root/src/lib/evas/cache2
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-01-01 22:15:24 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-01-02 18:53:56 +0900
commit9e01cf2698d5b24f440d696fd57d469cdc5a6b5f (patch)
tree63d213239f7bc70c0e8a850e5271ffd259ae6ac0 /src/lib/evas/cache2
parentb0530aba4f777352cc3ae9772fb1d22f598679a5 (diff)
evas image async preload - add option to also make header load async
to date if you use async preload we still load the header synchronously and this can be horrible especially with generic loaders. there is no way to farm this off to the preload thread. now there is. youhave to set it as a skip head load option before doing a file_set AND you need to issue a preload ... but now it's possible. @feature
Diffstat (limited to 'src/lib/evas/cache2')
-rw-r--r--src/lib/evas/cache2/evas_cache2.c97
1 files changed, 55 insertions, 42 deletions
diff --git a/src/lib/evas/cache2/evas_cache2.c b/src/lib/evas/cache2/evas_cache2.c
index 1c72155a68..60871dd741 100644
--- a/src/lib/evas/cache2/evas_cache2.c
+++ b/src/lib/evas/cache2/evas_cache2.c
@@ -311,9 +311,22 @@ _evas_cache2_image_preloaded_cb(void *data, Eina_Bool success)
311 { 311 {
312 ie->targets = (Evas_Cache_Target *) 312 ie->targets = (Evas_Cache_Target *)
313 eina_inlist_remove(EINA_INLIST_GET(ie->targets), 313 eina_inlist_remove(EINA_INLIST_GET(ie->targets),
314 EINA_INLIST_GET(ie->targets)); 314 EINA_INLIST_GET(ie->targets));
315 if (!ie->flags.delete_me) 315 if (!ie->flags.delete_me)
316 evas_object_inform_call_image_preloaded((Evas_Object *) tmp->target); 316 {
317 if (tmp->simple_cb)
318 {
319 if (!tmp->delete_me)
320 {
321 tmp->simple_cb(tmp->simple_data);
322 }
323 }
324 else
325 {
326 evas_object_inform_call_image_preloaded
327 ((Evas_Object *)tmp->target);
328 }
329 }
317 free(tmp); 330 free(tmp);
318 } 331 }
319 332
@@ -329,7 +342,7 @@ _evas_cache2_image_entry_preload_add(Image_Entry *ie, const void *target)
329 if (ie->flags.preload_done) 342 if (ie->flags.preload_done)
330 return EINA_FALSE; 343 return EINA_FALSE;
331 344
332 tg = malloc(sizeof(Evas_Cache_Target)); 345 tg = calloc(1, sizeof(Evas_Cache_Target));
333 if (!tg) 346 if (!tg)
334 return EINA_TRUE; 347 return EINA_TRUE;
335 348
@@ -580,62 +593,62 @@ evas_cache2_image_cache_key_create(char *hkey, const char *path, size_t pathlen,
580 { 593 {
581 memcpy(hkey + size, "//@/", 4); 594 memcpy(hkey + size, "//@/", 4);
582 size += 4; 595 size += 4;
583 size += eina_convert_xtoa(lo->scale_down_by, hkey + size); 596 size += eina_convert_xtoa(lo->emile.scale_down_by, hkey + size);
584 hkey[size] = '/'; 597 hkey[size] = '/';
585 size += 1; 598 size += 1;
586 size += eina_convert_dtoa(lo->dpi, hkey + size); 599 size += eina_convert_dtoa(lo->emile.dpi, hkey + size);
587 hkey[size] = '/'; 600 hkey[size] = '/';
588 size += 1; 601 size += 1;
589 size += eina_convert_xtoa(lo->w, hkey + size); 602 size += eina_convert_xtoa(lo->emile.w, hkey + size);
590 hkey[size] = 'x'; 603 hkey[size] = 'x';
591 size += 1; 604 size += 1;
592 size += eina_convert_xtoa(lo->h, hkey + size); 605 size += eina_convert_xtoa(lo->emile.h, hkey + size);
593 hkey[size] = '/'; 606 hkey[size] = '/';
594 size += 1; 607 size += 1;
595 size += eina_convert_xtoa(lo->region.x, hkey + size); 608 size += eina_convert_xtoa(lo->emile.region.x, hkey + size);
596 hkey[size] = '+'; 609 hkey[size] = '+';
597 size += 1; 610 size += 1;
598 size += eina_convert_xtoa(lo->region.y, hkey + size); 611 size += eina_convert_xtoa(lo->emile.region.y, hkey + size);
599 hkey[size] = '.'; 612 hkey[size] = '.';
600 size += 1; 613 size += 1;
601 size += eina_convert_xtoa(lo->region.w, hkey + size); 614 size += eina_convert_xtoa(lo->emile.region.w, hkey + size);
602 hkey[size] = 'x'; 615 hkey[size] = 'x';
603 size += 1; 616 size += 1;
604 617
605 size += eina_convert_xtoa(lo->region.h, hkey + size); 618 size += eina_convert_xtoa(lo->emile.region.h, hkey + size);
606 hkey[size++] = '!'; 619 hkey[size++] = '!';
607 hkey[size++] = '('; 620 hkey[size++] = '(';
608 621
609 hkey[size] = '['; 622 hkey[size] = '[';
610 size += 1; 623 size += 1;
611 size += eina_convert_xtoa(lo->scale_load.src_x, hkey + size); 624 size += eina_convert_xtoa(lo->emile.scale_load.src_x, hkey + size);
612 hkey[size] = ','; 625 hkey[size] = ',';
613 size += 1; 626 size += 1;
614 size += eina_convert_xtoa(lo->scale_load.src_y, hkey + size); 627 size += eina_convert_xtoa(lo->emile.scale_load.src_y, hkey + size);
615 hkey[size] = ':'; 628 hkey[size] = ':';
616 size += 1; 629 size += 1;
617 size += eina_convert_xtoa(lo->scale_load.src_w, hkey + size); 630 size += eina_convert_xtoa(lo->emile.scale_load.src_w, hkey + size);
618 hkey[size] = 'x'; 631 hkey[size] = 'x';
619 size += 1; 632 size += 1;
620 size += eina_convert_xtoa(lo->scale_load.src_h, hkey + size); 633 size += eina_convert_xtoa(lo->emile.scale_load.src_h, hkey + size);
621 hkey[size++] = ']'; 634 hkey[size++] = ']';
622 635
623 hkey[size++] = '-'; 636 hkey[size++] = '-';
624 637
625 hkey[size] = '['; 638 hkey[size] = '[';
626 size += 1; 639 size += 1;
627 size += eina_convert_xtoa(lo->scale_load.dst_w, hkey + size); 640 size += eina_convert_xtoa(lo->emile.scale_load.dst_w, hkey + size);
628 hkey[size] = 'x'; 641 hkey[size] = 'x';
629 size += 1; 642 size += 1;
630 size += eina_convert_xtoa(lo->scale_load.dst_h, hkey + size); 643 size += eina_convert_xtoa(lo->emile.scale_load.dst_h, hkey + size);
631 hkey[size] = ':'; 644 hkey[size] = ':';
632 size += 1; 645 size += 1;
633 size += eina_convert_xtoa(lo->scale_load.smooth, hkey + size); 646 size += eina_convert_xtoa(lo->emile.scale_load.smooth, hkey + size);
634 hkey[size++] = ']'; 647 hkey[size++] = ']';
635 648
636 hkey[size++] = ')'; 649 hkey[size++] = ')';
637 650
638 if (lo->orientation) 651 if (lo->emile.orientation)
639 { 652 {
640 hkey[size] = '/'; 653 hkey[size] = '/';
641 size += 1; 654 size += 1;
@@ -679,12 +692,12 @@ evas_cache2_image_open(Evas_Cache2 *cache, const char *path, const char *key,
679 /* use local var to copy default load options to the image entry */ 692 /* use local var to copy default load options to the image entry */
680 if ((!lo) || 693 if ((!lo) ||
681 (lo && 694 (lo &&
682 (lo->scale_down_by == 0) && 695 (lo->emile.scale_down_by == 0) &&
683 (EINA_DBL_CMP(lo->dpi, 0.0)) && 696 (EINA_DBL_CMP(lo->emile.dpi, 0.0)) &&
684 ((lo->w == 0) || (lo->h == 0)) && 697 ((lo->emile.w == 0) || (lo->emile.h == 0)) &&
685 ((lo->region.w == 0) || (lo->region.h == 0)) && 698 ((lo->emile.region.w == 0) || (lo->emile.region.h == 0)) &&
686 ((lo->scale_load.dst_w == 0) || (lo->scale_load.dst_h == 0)) && 699 ((lo->emile.scale_load.dst_w == 0) || (lo->emile.scale_load.dst_h == 0)) &&
687 (lo->orientation == 0) 700 (lo->emile.orientation == 0)
688 )) 701 ))
689 { 702 {
690 lo = &prevent; 703 lo = &prevent;
@@ -819,17 +832,17 @@ _scaled_image_find(Image_Entry *im, int src_x, int src_y, int src_w,
819 hkey = alloca(sizeof(char) * size); 832 hkey = alloca(sizeof(char) * size);
820 833
821 memcpy(&lo, &im->load_opts, sizeof lo); 834 memcpy(&lo, &im->load_opts, sizeof lo);
822 lo.scale_load.src_x = src_x; 835 lo.emile.scale_load.src_x = src_x;
823 lo.scale_load.src_y = src_y; 836 lo.emile.scale_load.src_y = src_y;
824 lo.scale_load.src_w = src_w; 837 lo.emile.scale_load.src_w = src_w;
825 lo.scale_load.src_h = src_h; 838 lo.emile.scale_load.src_h = src_h;
826 lo.scale_load.dst_w = dst_w; 839 lo.emile.scale_load.dst_w = dst_w;
827 lo.scale_load.dst_h = dst_h; 840 lo.emile.scale_load.dst_h = dst_h;
828 lo.scale_load.smooth = smooth; 841 lo.emile.scale_load.smooth = smooth;
829 842
830 if (!smooth) 843 if (!smooth)
831 { 844 {
832 lo.scale_load.smooth = 1; 845 lo.emile.scale_load.smooth = 1;
833 evas_cache2_image_cache_key_create(hkey, im->file, pathlen, 846 evas_cache2_image_cache_key_create(hkey, im->file, pathlen,
834 im->key, keylen, &lo); 847 im->key, keylen, &lo);
835 848
@@ -839,7 +852,7 @@ _scaled_image_find(Image_Entry *im, int src_x, int src_y, int src_w,
839 ret = eina_hash_find(im->cache2->inactiv, hkey); 852 ret = eina_hash_find(im->cache2->inactiv, hkey);
840 if (ret) goto handle_inactiv; 853 if (ret) goto handle_inactiv;
841 854
842 lo.scale_load.smooth = smooth; 855 lo.emile.scale_load.smooth = smooth;
843 } 856 }
844 857
845 evas_cache2_image_cache_key_create(hkey, im->file, pathlen, 858 evas_cache2_image_cache_key_create(hkey, im->file, pathlen,
@@ -906,14 +919,14 @@ evas_cache2_image_scale_load(Image_Entry *im,
906 hkey = alloca(sizeof(char) * size); 919 hkey = alloca(sizeof(char) * size);
907 920
908 memcpy(&lo, &im->load_opts, sizeof lo); 921 memcpy(&lo, &im->load_opts, sizeof lo);
909 lo.scale_load.src_x = src_x; 922 lo.emile.scale_load.src_x = src_x;
910 lo.scale_load.src_y = src_y; 923 lo.emile.scale_load.src_y = src_y;
911 lo.scale_load.src_w = src_w; 924 lo.emile.scale_load.src_w = src_w;
912 lo.scale_load.src_h = src_h; 925 lo.emile.scale_load.src_h = src_h;
913 lo.scale_load.dst_w = dst_w; 926 lo.emile.scale_load.dst_w = dst_w;
914 lo.scale_load.dst_h = dst_h; 927 lo.emile.scale_load.dst_h = dst_h;
915 lo.scale_load.smooth = smooth; 928 lo.emile.scale_load.smooth = smooth;
916 lo.scale_load.scale_hint = (Emile_Image_Scale_Hint) im->scale_hint; 929 lo.emile.scale_load.scale_hint = (Emile_Image_Scale_Hint) im->scale_hint;
917 930
918 evas_cache2_image_cache_key_create(hkey, im->file, pathlen, 931 evas_cache2_image_cache_key_create(hkey, im->file, pathlen,
919 im->key, keylen, &lo); 932 im->key, keylen, &lo);