summaryrefslogtreecommitdiff
path: root/src/lib/evas/cache2
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2013-07-31 20:29:41 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2013-10-28 15:47:13 +0900
commitf5d0f0aec37fae9e974ce1b5b2e518863297ba3f (patch)
tree98a6bdbd8c1cf296ebac3a400f8f661e324651e7 /src/lib/evas/cache2
parent08648ab2a5033da4f6c835c049238074802fb232 (diff)
evas/cserve2: Scan shared indexes in client side
Read Image descriptors from the shared arrays But, accessing the shared index can be a bit expensive, so try to read from the socket before scanning the index, without blocking.
Diffstat (limited to 'src/lib/evas/cache2')
-rw-r--r--src/lib/evas/cache2/evas_cache2.c21
-rw-r--r--src/lib/evas/cache2/evas_cache2.h1
2 files changed, 15 insertions, 7 deletions
diff --git a/src/lib/evas/cache2/evas_cache2.c b/src/lib/evas/cache2/evas_cache2.c
index 81fd78c8d8..77585abe47 100644
--- a/src/lib/evas/cache2/evas_cache2.c
+++ b/src/lib/evas/cache2/evas_cache2.c
@@ -549,8 +549,10 @@ evas_cache2_shutdown(Evas_Cache2 *cache)
549 free(cache); 549 free(cache);
550} 550}
551 551
552static void 552EAPI void
553_create_hash_key(char *hkey, const char *path, size_t pathlen, const char *key, size_t keylen, Evas_Image_Load_Opts *lo) 553evas_cache2_image_cache_key_create(char *hkey, const char *path, size_t pathlen,
554 const char *key, size_t keylen,
555 const Evas_Image_Load_Opts *lo)
554{ 556{
555 const char *ckey = "(null)"; 557 const char *ckey = "(null)";
556 size_t size; 558 size_t size;
@@ -561,6 +563,7 @@ _create_hash_key(char *hkey, const char *path, size_t pathlen, const char *key,
561 memcpy(hkey + size, "//://", 5); 563 memcpy(hkey + size, "//://", 5);
562 size += 5; 564 size += 5;
563 if (key) ckey = key; 565 if (key) ckey = key;
566 else keylen = 6;
564 memcpy(hkey + size, ckey, keylen); 567 memcpy(hkey + size, ckey, keylen);
565 size += keylen; 568 size += keylen;
566 if (lo) 569 if (lo)
@@ -634,7 +637,8 @@ _create_hash_key(char *hkey, const char *path, size_t pathlen, const char *key,
634} 637}
635 638
636EAPI Image_Entry * 639EAPI Image_Entry *
637evas_cache2_image_open(Evas_Cache2 *cache, const char *path, const char *key, Evas_Image_Load_Opts *lo, int *error) 640evas_cache2_image_open(Evas_Cache2 *cache, const char *path, const char *key,
641 Evas_Image_Load_Opts *lo, int *error)
638{ 642{
639 size_t size; 643 size_t size;
640 size_t pathlen; 644 size_t pathlen;
@@ -659,7 +663,7 @@ evas_cache2_image_open(Evas_Cache2 *cache, const char *path, const char *key, Ev
659 size = pathlen + keylen + HKEY_LOAD_OPTS_STR_LEN; 663 size = pathlen + keylen + HKEY_LOAD_OPTS_STR_LEN;
660 hkey = alloca(sizeof(char) * size); 664 hkey = alloca(sizeof(char) * size);
661 665
662 _create_hash_key(hkey, path, pathlen, key, keylen, lo); 666 evas_cache2_image_cache_key_create(hkey, path, pathlen, key, keylen, lo);
663 DBG("Looking at the hash for key '%s'", hkey); 667 DBG("Looking at the hash for key '%s'", hkey);
664 668
665 /* use local var to copy default load options to the image entry */ 669 /* use local var to copy default load options to the image entry */
@@ -816,7 +820,8 @@ _scaled_image_find(Image_Entry *im, int src_x, int src_y, int src_w, int src_h,
816 if (!smooth) 820 if (!smooth)
817 { 821 {
818 lo.scale_load.smooth = 1; 822 lo.scale_load.smooth = 1;
819 _create_hash_key(hkey, im->file, pathlen, im->key, keylen, &lo); 823 evas_cache2_image_cache_key_create(hkey, im->file, pathlen,
824 im->key, keylen, &lo);
820 825
821 ret = eina_hash_find(im->cache2->activ, hkey); 826 ret = eina_hash_find(im->cache2->activ, hkey);
822 if (ret) goto found; 827 if (ret) goto found;
@@ -827,7 +832,8 @@ _scaled_image_find(Image_Entry *im, int src_x, int src_y, int src_w, int src_h,
827 lo.scale_load.smooth = smooth; 832 lo.scale_load.smooth = smooth;
828 } 833 }
829 834
830 _create_hash_key(hkey, im->file, pathlen, im->key, keylen, &lo); 835 evas_cache2_image_cache_key_create(hkey, im->file, pathlen,
836 im->key, keylen, &lo);
831 837
832 ret = eina_hash_find(im->cache2->activ, hkey); 838 ret = eina_hash_find(im->cache2->activ, hkey);
833 if (ret) goto found; 839 if (ret) goto found;
@@ -896,7 +902,8 @@ evas_cache2_image_scale_load(Image_Entry *im,
896 lo.scale_load.smooth = smooth; 902 lo.scale_load.smooth = smooth;
897 lo.scale_load.scale_hint = im->scale_hint; 903 lo.scale_load.scale_hint = im->scale_hint;
898 904
899 _create_hash_key(hkey, im->file, pathlen, im->key, keylen, &lo); 905 evas_cache2_image_cache_key_create(hkey, im->file, pathlen,
906 im->key, keylen, &lo);
900 907
901 ret = _evas_cache_image_entry_new(im->cache2, hkey, NULL, im->file, im->key, 908 ret = _evas_cache_image_entry_new(im->cache2, hkey, NULL, im->file, im->key,
902 &lo, &error); 909 &lo, &error);
diff --git a/src/lib/evas/cache2/evas_cache2.h b/src/lib/evas/cache2/evas_cache2.h
index f6ba8f881e..6f8e588493 100644
--- a/src/lib/evas/cache2/evas_cache2.h
+++ b/src/lib/evas/cache2/evas_cache2.h
@@ -66,6 +66,7 @@ EAPI void evas_cache2_image_close(Image_Entry *im);
66EAPI int evas_cache2_image_load_data(Image_Entry *ie); 66EAPI int evas_cache2_image_load_data(Image_Entry *ie);
67EAPI void evas_cache2_image_unload_data(Image_Entry *im); 67EAPI void evas_cache2_image_unload_data(Image_Entry *im);
68EAPI void evas_cache2_image_preload_data(Image_Entry *im, const void *target); 68EAPI void evas_cache2_image_preload_data(Image_Entry *im, const void *target);
69EAPI void evas_cache2_image_cache_key_create(char *hkey, const char *path, size_t pathlen, const char *key, size_t keylen, const Evas_Image_Load_Opts *lo);
69 70
70EAPI DATA32 * evas_cache2_image_pixels(Image_Entry *im); 71EAPI DATA32 * evas_cache2_image_pixels(Image_Entry *im);
71EAPI Image_Entry * evas_cache2_image_writable(Image_Entry *im); 72EAPI Image_Entry * evas_cache2_image_writable(Image_Entry *im);