summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/evas/evas_cserve2_slave.c12
-rw-r--r--src/lib/evas/cserve2/evas_cs2_client.c97
2 files changed, 58 insertions, 51 deletions
diff --git a/src/bin/evas/evas_cserve2_slave.c b/src/bin/evas/evas_cserve2_slave.c
index 43fc3a5b19..7aeac6b370 100644
--- a/src/bin/evas/evas_cserve2_slave.c
+++ b/src/bin/evas/evas_cserve2_slave.c
@@ -434,8 +434,8 @@ image_load(const char *file, const char *key, const char *shmfile,
434 } 434 }
435 435
436 memset(&property, 0, sizeof (property)); 436 memset(&property, 0, sizeof (property));
437 property.w = params->w; 437 property.w = params->opts.w; // Should we rather use params->w ?
438 property.h = params->h; 438 property.h = params->opts.h;
439 439
440 skey = eina_stringshare_add(key); 440 skey = eina_stringshare_add(key);
441 loader_data = _image_file_open(fd, skey, opts, module, &property, &animated, &funcs); 441 loader_data = _image_file_open(fd, skey, opts, module, &property, &animated, &funcs);
@@ -446,6 +446,14 @@ image_load(const char *file, const char *key, const char *shmfile,
446 goto done; 446 goto done;
447 } 447 }
448 448
449 if (params->shm.mmap_size < (int) (property.w * property.h * 4))
450 {
451 printf("LOAD failed at %s:%d: shm map is too small (%d) for this image (%ux%u)\n",
452 __FUNCTION__, __LINE__,
453 params->shm.mmap_size, property.w , property.h);
454 goto done;
455 }
456
449 ok = funcs->file_data(loader_data, &property, map, &error); 457 ok = funcs->file_data(loader_data, &property, map, &error);
450 if (!ok || (error != EVAS_LOAD_ERROR_NONE)) 458 if (!ok || (error != EVAS_LOAD_ERROR_NONE))
451 { 459 {
diff --git a/src/lib/evas/cserve2/evas_cs2_client.c b/src/lib/evas/cserve2/evas_cs2_client.c
index e6f43a73cb..fa29fab223 100644
--- a/src/lib/evas/cserve2/evas_cs2_client.c
+++ b/src/lib/evas/cserve2/evas_cs2_client.c
@@ -705,15 +705,56 @@ _build_absolute_path(const char *path, char buf[], int size)
705 return len; 705 return len;
706} 706}
707 707
708// NOTE: Copy & paste from evas_cserve2_cache.c (TODO: Merge into common file)
709static Eina_Bool
710_evas_image_load_opts_empty(Evas_Image_Load_Opts *lo)
711{
712 if (!lo) return EINA_TRUE;
713
714 return ((lo->scale_down_by == 0)
715 && (lo->dpi == 0.0)
716 && (lo->w == 0) && (lo->h == 0)
717 && (lo->region.x == 0) && (lo->region.y == 0)
718 && (lo->region.w == 0) && (lo->region.h == 0)
719 && (lo->orientation == 0));
720}
721
722static void
723_file_hkey_get(char *buf, size_t sz, const char *path, const char *key,
724 Evas_Image_Load_Opts *lo)
725{
726 // Same as _evas_cache_image_loadopts_append() but not optimized :)
727 if (lo && _evas_image_load_opts_empty(lo))
728 lo = NULL;
729
730 if (!lo)
731 snprintf(buf, sz, "%s:%s", path, key);
732 else
733 {
734 if (lo->orientation)
735 {
736 snprintf(buf, sz, "%s:%s//@/%d/%f/%dx%d/%d+%d.%dx%d",
737 path, key, lo->scale_down_by, lo->dpi, lo->w, lo->h,
738 lo->region.x, lo->region.y, lo->region.w, lo->region.h);
739 }
740 else
741 {
742 snprintf(buf, sz, "%s:%s//@/%d/%f/%dx%d/%d+%d.%dx%d/o",
743 path, key, lo->scale_down_by, lo->dpi, lo->w, lo->h,
744 lo->region.x, lo->region.y, lo->region.w, lo->region.h);
745 }
746 }
747}
748
708static unsigned int 749static unsigned int
709_image_open_server_send(Image_Entry *ie, const char *file, const char *key, 750_image_open_server_send(Image_Entry *ie, const char *file, const char *key,
710 Evas_Image_Load_Opts *opts) 751 Evas_Image_Load_Opts *opts)
711{ 752{
712 int flen, klen; 753 int flen, klen;
713 int size; 754 int size, hkey_len;
714 char *buf; 755 char *buf;
715 char filebuf[PATH_MAX]; 756 char filebuf[PATH_MAX];
716 char *file_hkey; 757 char *hkey;
717 Msg_Open msg_open; 758 Msg_Open msg_open;
718 File_Entry *fentry; 759 File_Entry *fentry;
719 Data_Entry *dentry; 760 Data_Entry *dentry;
@@ -738,11 +779,10 @@ _image_open_server_send(Image_Entry *ie, const char *file, const char *key,
738 if (!key) key = ""; 779 if (!key) key = "";
739 klen = strlen(key) + 1; 780 klen = strlen(key) + 1;
740 781
741 file_hkey = alloca(flen + klen); 782 hkey_len = flen + klen + 1024;
742 memcpy(file_hkey, file, flen); 783 hkey = alloca(hkey_len);
743 file_hkey[flen - 1] = ':'; 784 _file_hkey_get(hkey, hkey_len, filebuf, key, opts);
744 memcpy(file_hkey + flen, key, klen); 785 fentry = eina_hash_find(_file_entries, hkey);
745 fentry = eina_hash_find(_file_entries, file_hkey);
746 if (!fentry) 786 if (!fentry)
747 { 787 {
748 fentry = calloc(1, sizeof(*fentry)); 788 fentry = calloc(1, sizeof(*fentry));
@@ -750,7 +790,7 @@ _image_open_server_send(Image_Entry *ie, const char *file, const char *key,
750 return 0; 790 return 0;
751 791
752 fentry->file_id = ++_file_id; 792 fentry->file_id = ++_file_id;
753 fentry->hkey = eina_stringshare_add(file_hkey); 793 fentry->hkey = eina_stringshare_add(hkey);
754 eina_hash_direct_add(_file_entries, fentry->hkey, fentry); 794 eina_hash_direct_add(_file_entries, fentry->hkey, fentry);
755 } 795 }
756 fentry->refcount++; 796 fentry->refcount++;
@@ -2069,47 +2109,6 @@ _shared_string_get(int id)
2069 do { if (!_shared_index_remap_check(&(si), sizeof(typ))) { \ 2109 do { if (!_shared_index_remap_check(&(si), sizeof(typ))) { \
2070 CRIT("Failed to remap index"); return NULL; } } while (0) 2110 CRIT("Failed to remap index"); return NULL; } } while (0)
2071 2111
2072
2073static Eina_Bool
2074_evas_image_load_opts_empty(Evas_Image_Load_Opts *lo)
2075{
2076 if (!lo) return EINA_TRUE;
2077
2078 return ((lo->scale_down_by == 0)
2079 && (lo->dpi == 0.0)
2080 && (lo->w == 0) && (lo->h == 0)
2081 && (lo->region.x == 0) && (lo->region.y == 0)
2082 && (lo->region.w == 0) && (lo->region.h == 0)
2083 && (lo->orientation == 0));
2084}
2085
2086static void
2087_file_hkey_get(char *buf, size_t sz, const char *path, const char *key,
2088 Evas_Image_Load_Opts *lo)
2089{
2090 // Same as _evas_cache_image_loadopts_append() but not optimized :)
2091 if (lo && _evas_image_load_opts_empty(lo))
2092 lo = NULL;
2093
2094 if (!lo)
2095 snprintf(buf, sz, "%s:%s", path, key);
2096 else
2097 {
2098 if (lo->orientation)
2099 {
2100 snprintf(buf, sz, "%s:%s//@/%d/%f/%dx%d/%d+%d.%dx%d",
2101 path, key, lo->scale_down_by, lo->dpi, lo->w, lo->h,
2102 lo->region.x, lo->region.y, lo->region.w, lo->region.h);
2103 }
2104 else
2105 {
2106 snprintf(buf, sz, "%s:%s//@/%d/%f/%dx%d/%d+%d.%dx%d/o",
2107 path, key, lo->scale_down_by, lo->dpi, lo->w, lo->h,
2108 lo->region.x, lo->region.y, lo->region.w, lo->region.h);
2109 }
2110 }
2111}
2112
2113static const File_Data * 2112static const File_Data *
2114_shared_image_entry_file_data_find(Image_Entry *ie) 2113_shared_image_entry_file_data_find(Image_Entry *ie)
2115{ 2114{