summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/bin/evas/evas_cserve2.h6
-rw-r--r--src/bin/evas/evas_cserve2_cache.c84
-rw-r--r--src/bin/evas/evas_cserve2_client.c21
-rw-r--r--src/bin/evas/evas_cserve2_main.c86
-rw-r--r--src/bin/evas/evas_cserve2_slave.c21
-rw-r--r--src/lib/evas/cache2/evas_cache2.c2
-rw-r--r--src/lib/evas/cserve2/evas_cs2.h20
-rw-r--r--src/lib/evas/cserve2/evas_cs2_client.c77
-rw-r--r--src/lib/evas/cserve2/evas_cs2_private.h2
9 files changed, 110 insertions, 209 deletions
diff --git a/src/bin/evas/evas_cserve2.h b/src/bin/evas/evas_cserve2.h
index ac7ba0a0d1..52232f0548 100644
--- a/src/bin/evas/evas_cserve2.h
+++ b/src/bin/evas/evas_cserve2.h
@@ -79,11 +79,9 @@ typedef enum {
79} Slave_Command; 79} Slave_Command;
80 80
81struct _Slave_Msg_Image_Open { 81struct _Slave_Msg_Image_Open {
82 Eina_Bool has_opts : 1;
83 Eina_Bool has_loader_data : 1; 82 Eina_Bool has_loader_data : 1;
84 // Optionally followed by: 83 // Optionally followed by:
85 // Evas_Image_Load_Opts opts; 84 // const char loader[];
86 // const char *loader;
87}; 85};
88 86
89struct _Slave_Msg_Image_Opened { 87struct _Slave_Msg_Image_Opened {
@@ -293,7 +291,7 @@ void cserve2_cache_client_new(Client *client);
293void cserve2_cache_client_del(Client *client); 291void cserve2_cache_client_del(Client *client);
294int cserve2_cache_file_open(Client *client, unsigned int client_file_id, const char *path, const char *key, unsigned int rid); 292int cserve2_cache_file_open(Client *client, unsigned int client_file_id, const char *path, const char *key, unsigned int rid);
295void cserve2_cache_file_close(Client *client, unsigned int client_file_id); 293void cserve2_cache_file_close(Client *client, unsigned int client_file_id);
296int cserve2_cache_image_opts_set(Client *client, Msg_Setopts *msg); 294int cserve2_cache_image_opts_set(Client *client, int rid, unsigned int file_id, unsigned int image_id, Evas_Image_Load_Opts *opts);
297void cserve2_rgba_image_scale_do(void *src_data, void *dst_data, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int alpha, int smooth); 295void cserve2_rgba_image_scale_do(void *src_data, void *dst_data, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int alpha, int smooth);
298void cserve2_cache_image_load(Client *client, unsigned int client_image_id, unsigned int rid); 296void cserve2_cache_image_load(Client *client, unsigned int client_image_id, unsigned int rid);
299void cserve2_cache_image_preload(Client *client, unsigned int client_image_id, unsigned int rid); 297void cserve2_cache_image_preload(Client *client, unsigned int client_image_id, unsigned int rid);
diff --git a/src/bin/evas/evas_cserve2_cache.c b/src/bin/evas/evas_cserve2_cache.c
index ca9c2b9b53..21e5ecfe5e 100644
--- a/src/bin/evas/evas_cserve2_cache.c
+++ b/src/bin/evas/evas_cserve2_cache.c
@@ -594,15 +594,15 @@ _img_opts_id_get(Image_Data *im, char *buf, int size)
594{ 594{
595 uintptr_t image_id; 595 uintptr_t image_id;
596 596
597 // FIXME: Add degree here?
598 snprintf(buf, size, 597 snprintf(buf, size,
599 "%u:%0.3f:%dx%d:%d:%d,%d+%dx%d:!([%d,%d:%dx%d]-[%dx%d:%d]):%d", 598 "%u:%0.3f:%dx%d:%d:%d,%d+%dx%d:!([%d,%d:%dx%d]-[%dx%d:%d]):%d:%d",
600 im->file_id, im->opts.dpi, im->opts.w, im->opts.h, 599 im->file_id, im->opts.dpi, im->opts.w, im->opts.h,
601 im->opts.scale_down_by, im->opts.region.x, im->opts.region.y, 600 im->opts.scale_down_by, im->opts.region.x, im->opts.region.y,
602 im->opts.region.w, im->opts.region.h, 601 im->opts.region.w, im->opts.region.h,
603 im->opts.scale_load.src_x, im->opts.scale_load.src_y, 602 im->opts.scale_load.src_x, im->opts.scale_load.src_y,
604 im->opts.scale_load.src_w, im->opts.scale_load.src_h, 603 im->opts.scale_load.src_w, im->opts.scale_load.src_h,
605 im->opts.scale_load.dst_w, im->opts.scale_load.dst_h, im->opts.scale_load.smooth, 604 im->opts.scale_load.dst_w, im->opts.scale_load.dst_h,
605 im->opts.scale_load.smooth, im->opts.degree,
606 im->opts.orientation); 606 im->opts.orientation);
607 607
608 image_id = (uintptr_t)eina_hash_find(image_ids, buf); 608 image_id = (uintptr_t)eina_hash_find(image_ids, buf);
@@ -1039,23 +1039,25 @@ cserve2_cache_client_del(Client *client)
1039} 1039}
1040 1040
1041static Image_Data * 1041static Image_Data *
1042_image_msg_new(Client *client, Msg_Setopts *msg) 1042_image_msg_new(Client *client, int rid,
1043 unsigned int file_id, unsigned int image_id,
1044 Evas_Image_Load_Opts *opts)
1043{ 1045{
1044 Reference *ref; 1046 Reference *ref;
1045 Image_Data *im_entry; 1047 Image_Data *im_entry;
1046 1048
1047 ref = eina_hash_find(client->files.referencing, &msg->file_id); 1049 ref = eina_hash_find(client->files.referencing, &file_id);
1048 if (!ref) 1050 if (!ref)
1049 { 1051 {
1050 ERR("Couldn't find file id: %d, for image id: %d", 1052 ERR("Couldn't find file id: %d, for image id: %d",
1051 msg->file_id, msg->image_id); 1053 file_id, image_id);
1052 cserve2_client_error_send(client, msg->base.rid, 1054 cserve2_client_error_send(client, rid,
1053 CSERVE2_INVALID_CACHE); 1055 CSERVE2_INVALID_CACHE);
1054 return NULL; 1056 return NULL;
1055 } 1057 }
1056 if (((File_Data *)ref->entry)->invalid) 1058 if (((File_Data *)ref->entry)->invalid)
1057 { 1059 {
1058 cserve2_client_error_send(client, msg->base.rid, 1060 cserve2_client_error_send(client, rid,
1059 CSERVE2_FILE_CHANGED); 1061 CSERVE2_FILE_CHANGED);
1060 return NULL; 1062 return NULL;
1061 } 1063 }
@@ -1064,24 +1066,27 @@ _image_msg_new(Client *client, Msg_Setopts *msg)
1064 im_entry->base.type = CSERVE2_IMAGE_DATA; 1066 im_entry->base.type = CSERVE2_IMAGE_DATA;
1065 im_entry->file_id = ref->entry->id; 1067 im_entry->file_id = ref->entry->id;
1066 im_entry->file = (File_Data *)ref->entry; 1068 im_entry->file = (File_Data *)ref->entry;
1067 im_entry->opts.dpi = msg->opts.dpi; 1069 if (opts)
1068 im_entry->opts.w = msg->opts.w; 1070 {
1069 im_entry->opts.h = msg->opts.h; 1071 im_entry->opts.dpi = opts->dpi;
1070 im_entry->opts.scale_down_by = msg->opts.scale_down_by; 1072 im_entry->opts.w = opts->w;
1071 im_entry->opts.region.x = msg->opts.region.x; 1073 im_entry->opts.h = opts->h;
1072 im_entry->opts.region.y = msg->opts.region.y; 1074 im_entry->opts.scale_down_by = opts->scale_down_by;
1073 im_entry->opts.region.w = msg->opts.region.w; 1075 im_entry->opts.region.x = opts->region.x;
1074 im_entry->opts.region.h = msg->opts.region.h; 1076 im_entry->opts.region.y = opts->region.y;
1075 im_entry->opts.scale_load.src_x = msg->opts.scale_load.src_x; 1077 im_entry->opts.region.w = opts->region.w;
1076 im_entry->opts.scale_load.src_y = msg->opts.scale_load.src_y; 1078 im_entry->opts.region.h = opts->region.h;
1077 im_entry->opts.scale_load.src_w = msg->opts.scale_load.src_w; 1079 im_entry->opts.scale_load.src_x = opts->scale_load.src_x;
1078 im_entry->opts.scale_load.src_h = msg->opts.scale_load.src_h; 1080 im_entry->opts.scale_load.src_y = opts->scale_load.src_y;
1079 im_entry->opts.scale_load.dst_w = msg->opts.scale_load.dst_w; 1081 im_entry->opts.scale_load.src_w = opts->scale_load.src_w;
1080 im_entry->opts.scale_load.dst_h = msg->opts.scale_load.dst_h; 1082 im_entry->opts.scale_load.src_h = opts->scale_load.src_h;
1081 im_entry->opts.scale_load.smooth = msg->opts.scale_load.smooth; 1083 im_entry->opts.scale_load.dst_w = opts->scale_load.dst_w;
1082 im_entry->opts.scale_load.scale_hint = msg->opts.scale_load.scale_hint; 1084 im_entry->opts.scale_load.dst_h = opts->scale_load.dst_h;
1083 im_entry->opts.degree = msg->opts.degree; 1085 im_entry->opts.scale_load.smooth = opts->scale_load.smooth;
1084 im_entry->opts.orientation = msg->opts.orientation; 1086 im_entry->opts.scale_load.scale_hint = opts->scale_load.scale_hint;
1087 im_entry->opts.degree = opts->degree;
1088 im_entry->opts.orientation = opts->orientation;
1089 }
1085 1090
1086 return im_entry; 1091 return im_entry;
1087} 1092}
@@ -2080,7 +2085,9 @@ cserve2_cache_file_close(Client *client, unsigned int client_file_id)
2080} 2085}
2081 2086
2082int 2087int
2083cserve2_cache_image_opts_set(Client *client, Msg_Setopts *msg) 2088cserve2_cache_image_opts_set(Client *client, int rid,
2089 unsigned int file_id, unsigned int client_image_id,
2090 Evas_Image_Load_Opts *opts)
2084{ 2091{
2085 Image_Data *entry; 2092 Image_Data *entry;
2086 File_Data *fentry = NULL; 2093 File_Data *fentry = NULL;
@@ -2088,10 +2095,10 @@ cserve2_cache_image_opts_set(Client *client, Msg_Setopts *msg)
2088 unsigned int image_id; 2095 unsigned int image_id;
2089 char buf[4096]; 2096 char buf[4096];
2090 2097
2091 oldref = eina_hash_find(client->images.referencing, &msg->image_id); 2098 oldref = eina_hash_find(client->images.referencing, &client_image_id);
2092 2099
2093 // search whether the image is already loaded by another client 2100 // search whether the image is already loaded by another client
2094 entry = _image_msg_new(client, msg); 2101 entry = _image_msg_new(client, rid, file_id, client_image_id, opts);
2095 if (!entry) 2102 if (!entry)
2096 return -1; 2103 return -1;
2097 image_id = _img_opts_id_get(entry, buf, sizeof(buf)); 2104 image_id = _img_opts_id_get(entry, buf, sizeof(buf));
@@ -2099,14 +2106,13 @@ cserve2_cache_image_opts_set(Client *client, Msg_Setopts *msg)
2099 { // if so, just update the references 2106 { // if so, just update the references
2100 free(entry); 2107 free(entry);
2101 DBG("found image_id %d for client image id %d", 2108 DBG("found image_id %d for client image id %d",
2102 image_id, msg->image_id); 2109 image_id, client_image_id);
2103 entry = eina_hash_find(image_entries, &image_id); 2110 entry = eina_hash_find(image_entries, &image_id);
2104 if (!entry) 2111 if (!entry)
2105 { 2112 {
2106 ERR("image id %d is in file_ids hash, but not in entries hash" 2113 ERR("image id %d is in file_ids hash, but not in entries hash"
2107 "with entry id %d.", msg->image_id, image_id); 2114 "with entry id %d.", client_image_id, image_id);
2108 cserve2_client_error_send(client, msg->base.rid, 2115 cserve2_client_error_send(client, rid, CSERVE2_INVALID_CACHE);
2109 CSERVE2_INVALID_CACHE);
2110 return -1; 2116 return -1;
2111 } 2117 }
2112 2118
@@ -2123,12 +2129,12 @@ cserve2_cache_image_opts_set(Client *client, Msg_Setopts *msg)
2123 if (oldref && (oldref->entry->id == image_id)) 2129 if (oldref && (oldref->entry->id == image_id))
2124 return 0; 2130 return 0;
2125 2131
2126 ref = _entry_reference_add((Entry *)entry, client, msg->image_id); 2132 ref = _entry_reference_add((Entry *)entry, client, client_image_id);
2127 2133
2128 if (oldref) 2134 if (oldref)
2129 eina_hash_del_by_key(client->images.referencing, &msg->image_id); 2135 eina_hash_del_by_key(client->images.referencing, &client_image_id);
2130 2136
2131 eina_hash_add(client->images.referencing, &msg->image_id, ref); 2137 eina_hash_add(client->images.referencing, &client_image_id, ref);
2132 2138
2133 return 0; 2139 return 0;
2134 } 2140 }
@@ -2140,11 +2146,11 @@ cserve2_cache_image_opts_set(Client *client, Msg_Setopts *msg)
2140 entry->base.id = image_id; 2146 entry->base.id = image_id;
2141 eina_hash_add(image_entries, &image_id, entry); 2147 eina_hash_add(image_entries, &image_id, entry);
2142 eina_hash_add(image_ids, buf, (void *)(intptr_t)image_id); 2148 eina_hash_add(image_ids, buf, (void *)(intptr_t)image_id);
2143 ref = _entry_reference_add((Entry *)entry, client, msg->image_id); 2149 ref = _entry_reference_add((Entry *)entry, client, client_image_id);
2144 2150
2145 if (oldref) 2151 if (oldref)
2146 eina_hash_del_by_key(client->images.referencing, &msg->image_id); 2152 eina_hash_del_by_key(client->images.referencing, &client_image_id);
2147 eina_hash_add(client->images.referencing, &msg->image_id, ref); 2153 eina_hash_add(client->images.referencing, &client_image_id, ref);
2148 2154
2149 fentry = entry->file; 2155 fentry = entry->file;
2150 fentry->images = eina_list_append(fentry->images, entry); 2156 fentry->images = eina_list_append(fentry->images, entry);
diff --git a/src/bin/evas/evas_cserve2_client.c b/src/bin/evas/evas_cserve2_client.c
index 7a377df2f8..071a10cb1b 100644
--- a/src/bin/evas/evas_cserve2_client.c
+++ b/src/bin/evas/evas_cserve2_client.c
@@ -67,6 +67,8 @@ parse_input_open(int *size)
67 char *buf; 67 char *buf;
68 int file_id; 68 int file_id;
69 69
70 // TODO: Add load opts
71
70 _read_line(line, sizeof(line)); 72 _read_line(line, sizeof(line));
71 path_len = _read_line(path, sizeof(path)); 73 path_len = _read_line(path, sizeof(path));
72 key_len = _read_line(key, sizeof(key)); 74 key_len = _read_line(key, sizeof(key));
@@ -88,11 +90,9 @@ parse_input_open(int *size)
88 *size = sizeof(msg) + path_len + key_len; 90 *size = sizeof(msg) + path_len + key_len;
89 91
90 return buf; 92 return buf;
91}
92 93
93static void * 94#if 0
94parse_input_setopts(int *size) 95 // TODO: Adapt the following code
95{
96 Msg_Setopts *msg; 96 Msg_Setopts *msg;
97 char line[4096]; 97 char line[4096];
98 int file_id, image_id; 98 int file_id, image_id;
@@ -183,6 +183,7 @@ parse_input_setopts(int *size)
183 *size = sizeof(*msg); 183 *size = sizeof(*msg);
184 184
185 return msg; 185 return msg;
186#endif
186} 187}
187 188
188static void * 189static void *
@@ -283,13 +284,6 @@ parse_answer_opened(const void *buf)
283} 284}
284 285
285static void 286static void
286parse_answer_setoptsed(const void *buf)
287{
288 const Msg_Setoptsed *msg = buf;
289 printf("SETOPTSED rid = %d\n", msg->base.rid);
290}
291
292static void
293parse_answer_loaded(const void *buf) 287parse_answer_loaded(const void *buf)
294{ 288{
295 const Msg_Loaded *msg = buf; 289 const Msg_Loaded *msg = buf;
@@ -321,9 +315,6 @@ parse_answer(const void *buf)
321 case CSERVE2_OPENED: 315 case CSERVE2_OPENED:
322 parse_answer_opened(buf); 316 parse_answer_opened(buf);
323 break; 317 break;
324 case CSERVE2_SETOPTSED:
325 parse_answer_setoptsed(buf);
326 break;
327 case CSERVE2_LOADED: 318 case CSERVE2_LOADED:
328 parse_answer_loaded(buf); 319 parse_answer_loaded(buf);
329 break; 320 break;
@@ -342,8 +333,6 @@ static struct {
342} _msg_types[] = { 333} _msg_types[] = {
343 { "OPEN", CSERVE2_OPEN, parse_input_open }, 334 { "OPEN", CSERVE2_OPEN, parse_input_open },
344 { "OPENED", CSERVE2_OPENED, NULL }, 335 { "OPENED", CSERVE2_OPENED, NULL },
345 { "SETOPTS", CSERVE2_SETOPTS, parse_input_setopts },
346 { "SETOPTSED", CSERVE2_SETOPTSED, NULL },
347 { "LOAD", CSERVE2_LOAD, parse_input_load }, 336 { "LOAD", CSERVE2_LOAD, parse_input_load },
348 { "LOADED", CSERVE2_LOADED, NULL }, 337 { "LOADED", CSERVE2_LOADED, NULL },
349 { "PRELOAD", CSERVE2_PRELOAD, parse_input_preload }, 338 { "PRELOAD", CSERVE2_PRELOAD, parse_input_preload },
diff --git a/src/bin/evas/evas_cserve2_main.c b/src/bin/evas/evas_cserve2_main.c
index 075fefc7a6..a71c864ef5 100644
--- a/src/bin/evas/evas_cserve2_main.c
+++ b/src/bin/evas/evas_cserve2_main.c
@@ -36,21 +36,6 @@ cserve2_client_error_send(Client *client, unsigned int rid, int error_code)
36} 36}
37 37
38static void 38static void
39_cserve2_client_image_setoptsed(Client *client, unsigned int rid)
40{
41 int size;
42 Msg_Setoptsed msg;
43
44 memset(&msg, 0, sizeof(msg));
45 msg.base.rid = rid;
46 msg.base.type = CSERVE2_SETOPTSED;
47
48 size = sizeof(msg);
49 cserve2_client_send(client, &size, sizeof(size));
50 cserve2_client_send(client, &msg, size);
51}
52
53static void
54_cserve2_client_close(Client *client) 39_cserve2_client_close(Client *client)
55{ 40{
56 Msg_Close *msg = (Msg_Close *)client->msg.buf; 41 Msg_Close *msg = (Msg_Close *)client->msg.buf;
@@ -88,40 +73,12 @@ _cserve2_client_load(Client *client)
88{ 73{
89 Msg_Load *msg = (Msg_Load *)client->msg.buf; 74 Msg_Load *msg = (Msg_Load *)client->msg.buf;
90 75
91 INF("Received LOAD command: RID=%d, Image_ID: %d", msg->base.rid, msg->image_id); 76 INF("Received LOAD command: RID=%d, Image_ID: %d",
77 msg->base.rid, msg->image_id);
92 cserve2_cache_image_load(client, msg->image_id, msg->base.rid); 78 cserve2_cache_image_load(client, msg->image_id, msg->base.rid);
93} 79}
94 80
95static void 81static void
96_cserve2_client_setopts(Client *client)
97{
98 Msg_Setopts *msg = (Msg_Setopts *)client->msg.buf;
99
100 INF("Received SETOPTS command: RID=%d", msg->base.rid);
101 INF("File_ID: %d, Image_ID: %d", msg->file_id, msg->image_id);
102 INF("Load Options:");
103 INF("\tdpi: %03.1f", msg->opts.dpi);
104 INF("\tsize: %dx%d", msg->opts.w, msg->opts.h);
105 INF("\tscale down: %d", msg->opts.scale_down_by);
106 INF("\tregion: %d,%d + %dx%d",
107 msg->opts.region.x, msg->opts.region.y, msg->opts.region.w, msg->opts.region.h);
108 INF("\toriginal image's source coord: %d,%d",
109 msg->opts.scale_load.src_x, msg->opts.scale_load.src_y);
110 INF("\toriginal image size: %dx%d",
111 msg->opts.scale_load.src_w, msg->opts.scale_load.src_h);
112 INF("\tscale size: %dx%d", msg->opts.scale_load.dst_w, msg->opts.scale_load.dst_h);
113 INF("\tscale smooth: %d", msg->opts.scale_load.smooth);
114 INF("\tscale hint: %d", msg->opts.scale_load.scale_hint);
115 INF("\tdegree: %d", msg->opts.degree);
116 INF("\torientation: %d", msg->opts.orientation);
117
118 if (cserve2_cache_image_opts_set(client, msg) != 0)
119 return;
120
121 _cserve2_client_image_setoptsed(client, msg->base.rid);
122}
123
124static void
125_cserve2_client_open(Client *client) 82_cserve2_client_open(Client *client)
126{ 83{
127 Msg_Open *msg = (Msg_Open *)client->msg.buf; 84 Msg_Open *msg = (Msg_Open *)client->msg.buf;
@@ -137,17 +94,33 @@ _cserve2_client_open(Client *client)
137 cserve2_cache_file_open(client, msg->file_id, path, key, msg->base.rid); 94 cserve2_cache_file_open(client, msg->file_id, path, key, msg->base.rid);
138 95
139 if (!msg->has_load_opts) 96 if (!msg->has_load_opts)
97 cserve2_cache_image_opts_set(client, msg->base.rid,
98 msg->file_id, msg->image_id, NULL);
99 else
140 { 100 {
141 /* FIXME: We should remove this fake call to setopts and do the 101 // FIXME: Check message size first?
142 * appropriate work instead. (split functions) */ 102 Evas_Image_Load_Opts *opts =
143 Msg_Setopts optsmsg; 103 (Evas_Image_Load_Opts*) (key + strlen(key) + 1);
144 104
145 memset(&optsmsg, 0, sizeof(optsmsg)); 105 DBG("Load Options:");
146 optsmsg.base.rid = msg->base.rid; 106 DBG("\tdpi: %03.1f", opts->dpi);
147 optsmsg.base.type = CSERVE2_SETOPTS; 107 DBG("\tsize: %dx%d", opts->w, opts->h);
148 optsmsg.file_id = msg->file_id; 108 DBG("\tscale down: %d", opts->scale_down_by);
149 optsmsg.image_id = msg->image_id; 109 DBG("\tregion: %d,%d + %dx%d",
150 cserve2_cache_image_opts_set(client, &optsmsg); 110 opts->region.x, opts->region.y, opts->region.w, opts->region.h);
111 DBG("\toriginal image's source coord: %d,%d",
112 opts->scale_load.src_x, opts->scale_load.src_y);
113 DBG("\toriginal image size: %dx%d",
114 opts->scale_load.src_w, opts->scale_load.src_h);
115 DBG("\tscale size: %dx%d",
116 opts->scale_load.dst_w, opts->scale_load.dst_h);
117 DBG("\tscale smooth: %d", opts->scale_load.smooth);
118 DBG("\tscale hint: %d", opts->scale_load.scale_hint);
119 DBG("\tdegree: %d", opts->degree);
120 DBG("\torientation: %d", opts->orientation);
121
122 cserve2_cache_image_opts_set(client, msg->base.rid,
123 msg->file_id, msg->image_id, opts);
151 } 124 }
152} 125}
153 126
@@ -238,9 +211,6 @@ cserve2_command_run(Client *client, Message_Type type)
238 case CSERVE2_OPEN: 211 case CSERVE2_OPEN:
239 _cserve2_client_open(client); 212 _cserve2_client_open(client);
240 break; 213 break;
241 case CSERVE2_SETOPTS:
242 _cserve2_client_setopts(client);
243 break;
244 case CSERVE2_LOAD: 214 case CSERVE2_LOAD:
245 _cserve2_client_load(client); 215 _cserve2_client_load(client);
246 break; 216 break;
diff --git a/src/bin/evas/evas_cserve2_slave.c b/src/bin/evas/evas_cserve2_slave.c
index f4948a0187..a5391e48ca 100644
--- a/src/bin/evas/evas_cserve2_slave.c
+++ b/src/bin/evas/evas_cserve2_slave.c
@@ -336,7 +336,7 @@ _image_file_header(Eina_File *fd, Eina_Stringshare *key, Evas_Image_Load_Opts *l
336} 336}
337 337
338static Error_Type 338static Error_Type
339image_open(const char *file, const char *key, Evas_Image_Load_Opts *load_opts, 339image_open(const char *file, const char *key,
340 Slave_Msg_Image_Opened *result, const char **use_loader) 340 Slave_Msg_Image_Opened *result, const char **use_loader)
341{ 341{
342 Evas_Module *module; 342 Evas_Module *module;
@@ -346,6 +346,9 @@ image_open(const char *file, const char *key, Evas_Image_Load_Opts *load_opts,
346 unsigned int i; 346 unsigned int i;
347 Error_Type ret = CSERVE2_NONE; 347 Error_Type ret = CSERVE2_NONE;
348 Eina_Stringshare *skey = eina_stringshare_add(key); 348 Eina_Stringshare *skey = eina_stringshare_add(key);
349 Evas_Image_Load_Opts load_opts;
350
351 memset(&load_opts, 0, sizeof(load_opts));
349 352
350 fd = eina_file_open(file, EINA_FALSE); 353 fd = eina_file_open(file, EINA_FALSE);
351 if (!fd) 354 if (!fd)
@@ -360,7 +363,7 @@ image_open(const char *file, const char *key, Evas_Image_Load_Opts *load_opts,
360 module = evas_module_find_type(EVAS_MODULE_TYPE_IMAGE_LOADER, loader); 363 module = evas_module_find_type(EVAS_MODULE_TYPE_IMAGE_LOADER, loader);
361 if (module) 364 if (module)
362 { 365 {
363 if (_image_file_header(fd, skey, load_opts, result, module)) 366 if (_image_file_header(fd, skey, &load_opts, result, module))
364 goto success; 367 goto success;
365 } 368 }
366 369
@@ -380,7 +383,7 @@ try_extension:
380 if (loader) 383 if (loader)
381 { 384 {
382 module = evas_module_find_type(EVAS_MODULE_TYPE_IMAGE_LOADER, loader); 385 module = evas_module_find_type(EVAS_MODULE_TYPE_IMAGE_LOADER, loader);
383 if (_image_file_header(fd, skey, load_opts, result, module)) 386 if (_image_file_header(fd, skey, &load_opts, result, module))
384 goto success; 387 goto success;
385 loader = NULL; 388 loader = NULL;
386 module = NULL; 389 module = NULL;
@@ -392,7 +395,7 @@ try_extension:
392 loader = loaders_name[i]; 395 loader = loaders_name[i];
393 module = evas_module_find_type(EVAS_MODULE_TYPE_IMAGE_LOADER, loader); 396 module = evas_module_find_type(EVAS_MODULE_TYPE_IMAGE_LOADER, loader);
394 if (!module) continue; 397 if (!module) continue;
395 if (_image_file_header(fd, skey, load_opts, result, module)) 398 if (_image_file_header(fd, skey, &load_opts, result, module))
396 goto success; 399 goto success;
397 } 400 }
398 401
@@ -507,7 +510,6 @@ handle_image_open(int wfd, void *params)
507{ 510{
508 Slave_Msg_Image_Open *p; 511 Slave_Msg_Image_Open *p;
509 Slave_Msg_Image_Opened result; 512 Slave_Msg_Image_Opened result;
510 Evas_Image_Load_Opts opts;
511 Error_Type err; 513 Error_Type err;
512 const char *loader = NULL, *file, *key, *ptr; 514 const char *loader = NULL, *file, *key, *ptr;
513 char *resp; 515 char *resp;
@@ -517,18 +519,11 @@ handle_image_open(int wfd, void *params)
517 file = (const char *)(p + sizeof(Slave_Msg_Image_Open)); 519 file = (const char *)(p + sizeof(Slave_Msg_Image_Open));
518 key = file + strlen(file) + 1; 520 key = file + strlen(file) + 1;
519 ptr = key + strlen(key) + 1; 521 ptr = key + strlen(key) + 1;
520 if (p->has_opts)
521 {
522 //opts = (Evas_Image_Load_Opts *)ptr;
523 memcpy(&opts, ptr, sizeof(opts));
524 ptr += sizeof(opts);
525 }
526 else memset(&opts, 0, sizeof(opts));
527 if (p->has_loader_data) 522 if (p->has_loader_data)
528 loader = ptr; 523 loader = ptr;
529 524
530 memset(&result, 0, sizeof(result)); 525 memset(&result, 0, sizeof(result));
531 if ((err = image_open(file, key, &opts, &result, &loader)) 526 if ((err = image_open(file, key, &result, &loader))
532 != CSERVE2_NONE) 527 != CSERVE2_NONE)
533 { 528 {
534 printf("OPEN failed at %s:%d\n", __FUNCTION__, __LINE__); 529 printf("OPEN failed at %s:%d\n", __FUNCTION__, __LINE__);
diff --git a/src/lib/evas/cache2/evas_cache2.c b/src/lib/evas/cache2/evas_cache2.c
index f753233a51..302c65800b 100644
--- a/src/lib/evas/cache2/evas_cache2.c
+++ b/src/lib/evas/cache2/evas_cache2.c
@@ -259,7 +259,7 @@ _evas_cache_image_entry_new(Evas_Cache2 *cache,
259 if (lo) ie->load_opts = *lo; 259 if (lo) ie->load_opts = *lo;
260 if (ie->file) 260 if (ie->file)
261 { 261 {
262 if (!evas_cserve2_image_load(ie, ie->file, ie->key, &(ie->load_opts))) 262 if (!evas_cserve2_image_load(ie))
263 { 263 {
264 ERR("couldn't load '%s' '%s' with cserve2!", 264 ERR("couldn't load '%s' '%s' with cserve2!",
265 ie->file, ie->key ? ie->key : ""); 265 ie->file, ie->key ? ie->key : "");
diff --git a/src/lib/evas/cserve2/evas_cs2.h b/src/lib/evas/cserve2/evas_cs2.h
index b35af47348..ad36b4e7fe 100644
--- a/src/lib/evas/cserve2/evas_cs2.h
+++ b/src/lib/evas/cserve2/evas_cs2.h
@@ -10,8 +10,6 @@
10typedef enum { 10typedef enum {
11 CSERVE2_OPEN = 1, 11 CSERVE2_OPEN = 1,
12 CSERVE2_OPENED, 12 CSERVE2_OPENED,
13 CSERVE2_SETOPTS,
14 CSERVE2_SETOPTSED,
15 CSERVE2_LOAD, 13 CSERVE2_LOAD,
16 CSERVE2_LOADED, 14 CSERVE2_LOADED,
17 CSERVE2_PRELOAD, 15 CSERVE2_PRELOAD,
@@ -59,6 +57,11 @@ struct _Msg_Open {
59 unsigned int image_id; 57 unsigned int image_id;
60 58
61 Eina_Bool has_load_opts : 1; 59 Eina_Bool has_load_opts : 1;
60
61 // Followed by:
62 // const char file[];
63 // const char key[];
64 // Evas_Image_Load_Opts opts; // if has_load_opts
62}; 65};
63 66
64struct _Msg_Opened { 67struct _Msg_Opened {
@@ -72,17 +75,6 @@ struct _Msg_Opened {
72 } image; 75 } image;
73}; 76};
74 77
75struct _Msg_Setopts {
76 Msg_Base base;
77 unsigned int file_id;
78 unsigned int image_id;
79 Evas_Image_Load_Opts opts;
80};
81
82struct _Msg_Setoptsed {
83 Msg_Base base;
84};
85
86struct _Msg_Load { 78struct _Msg_Load {
87 Msg_Base base; 79 Msg_Base base;
88 unsigned int image_id; 80 unsigned int image_id;
@@ -277,8 +269,6 @@ struct _Msg_Error {
277 269
278typedef struct _Msg_Open Msg_Open; 270typedef struct _Msg_Open Msg_Open;
279typedef struct _Msg_Opened Msg_Opened; 271typedef struct _Msg_Opened Msg_Opened;
280typedef struct _Msg_Setopts Msg_Setopts;
281typedef struct _Msg_Setoptsed Msg_Setoptsed;
282typedef struct _Msg_Load Msg_Load; 272typedef struct _Msg_Load Msg_Load;
283typedef struct _Msg_Loaded Msg_Loaded; 273typedef struct _Msg_Loaded Msg_Loaded;
284typedef struct _Msg_Preload Msg_Preload; 274typedef struct _Msg_Preload Msg_Preload;
diff --git a/src/lib/evas/cserve2/evas_cs2_client.c b/src/lib/evas/cserve2/evas_cs2_client.c
index ccfc456b59..d2cb490398 100644
--- a/src/lib/evas/cserve2/evas_cs2_client.c
+++ b/src/lib/evas/cserve2/evas_cs2_client.c
@@ -221,7 +221,6 @@ _server_send(const void *buf, int size, Op_Callback cb, void *data)
221 switch (msg->type) 221 switch (msg->type)
222 { 222 {
223 case CSERVE2_OPEN: 223 case CSERVE2_OPEN:
224 case CSERVE2_SETOPTS:
225 case CSERVE2_LOAD: 224 case CSERVE2_LOAD:
226 case CSERVE2_PRELOAD: 225 case CSERVE2_PRELOAD:
227 case CSERVE2_FONT_LOAD: 226 case CSERVE2_FONT_LOAD:
@@ -616,7 +615,8 @@ _build_absolute_path(const char *path, char buf[], int size)
616} 615}
617 616
618static unsigned int 617static unsigned int
619_image_open_server_send(Image_Entry *ie, const char *file, const char *key, Eina_Bool has_load_opts) 618_image_open_server_send(Image_Entry *ie, const char *file, const char *key,
619 Evas_Image_Load_Opts *opts)
620{ 620{
621 int flen, klen; 621 int flen, klen;
622 int size; 622 int size;
@@ -656,7 +656,6 @@ _image_open_server_send(Image_Entry *ie, const char *file, const char *key, Eina
656 return 0; 656 return 0;
657 } 657 }
658 658
659
660 memset(&msg_open, 0, sizeof(msg_open)); 659 memset(&msg_open, 0, sizeof(msg_open));
661 660
662 fentry->file_id = ++_file_id; 661 fentry->file_id = ++_file_id;
@@ -667,10 +666,12 @@ _image_open_server_send(Image_Entry *ie, const char *file, const char *key, Eina
667 msg_open.file_id = fentry->file_id; 666 msg_open.file_id = fentry->file_id;
668 msg_open.path_offset = 0; 667 msg_open.path_offset = 0;
669 msg_open.key_offset = flen; 668 msg_open.key_offset = flen;
670 msg_open.has_load_opts = has_load_opts; 669 msg_open.has_load_opts = (opts != NULL);
671 msg_open.image_id = ++_data_id; 670 msg_open.image_id = ++_data_id;
672 671
673 size = sizeof(msg_open) + flen + klen; 672 size = sizeof(msg_open) + flen + klen;
673 if (opts)
674 size += sizeof(*opts);
674 buf = malloc(size); 675 buf = malloc(size);
675 if (!buf) 676 if (!buf)
676 { 677 {
@@ -681,6 +682,8 @@ _image_open_server_send(Image_Entry *ie, const char *file, const char *key, Eina
681 memcpy(buf, &msg_open, sizeof(msg_open)); 682 memcpy(buf, &msg_open, sizeof(msg_open));
682 memcpy(buf + sizeof(msg_open), filebuf, flen); 683 memcpy(buf + sizeof(msg_open), filebuf, flen);
683 memcpy(buf + sizeof(msg_open) + flen, key, klen); 684 memcpy(buf + sizeof(msg_open) + flen, key, klen);
685 if (opts)
686 memcpy(buf + sizeof(msg_open) + flen + klen, opts, sizeof(*opts));
684 687
685 if (!_server_send(buf, size, _image_opened_cb, ie)) 688 if (!_server_send(buf, size, _image_opened_cb, ie))
686 { 689 {
@@ -700,55 +703,6 @@ _image_open_server_send(Image_Entry *ie, const char *file, const char *key, Eina
700 return msg_open.base.rid; 703 return msg_open.base.rid;
701} 704}
702 705
703static unsigned int
704_image_setopts_server_send(Image_Entry *ie)
705{
706 File_Entry *fentry = ie->data1;
707 Data_Entry *dentry = ie->data2;
708 Msg_Setopts msg;
709
710 if (cserve2_init == 0)
711 return 0;
712
713 if (!fentry || !dentry)
714 return 0;
715
716 memset(&msg, 0, sizeof(msg));
717
718 msg.base.rid = _next_rid();
719 msg.base.type = CSERVE2_SETOPTS;
720 msg.file_id = fentry->file_id;
721 msg.image_id = dentry->image_id;
722
723 msg.opts.scale_down_by = ie->load_opts.scale_down_by;
724 msg.opts.dpi = ie->load_opts.dpi;
725 msg.opts.w = ie->load_opts.w;
726 msg.opts.h = ie->load_opts.h;
727 msg.opts.region.x = ie->load_opts.region.x;
728 msg.opts.region.y = ie->load_opts.region.y;
729 msg.opts.region.w = ie->load_opts.region.w;
730 msg.opts.region.h = ie->load_opts.region.h;
731 msg.opts.scale_load.src_x = ie->load_opts.scale_load.src_x;
732 msg.opts.scale_load.src_y = ie->load_opts.scale_load.src_y;
733 msg.opts.scale_load.src_w = ie->load_opts.scale_load.src_w;
734 msg.opts.scale_load.src_h = ie->load_opts.scale_load.src_h;
735 msg.opts.scale_load.dst_w = ie->load_opts.scale_load.dst_w;
736 msg.opts.scale_load.dst_h = ie->load_opts.scale_load.dst_h;
737 msg.opts.scale_load.smooth = ie->load_opts.scale_load.smooth;
738 msg.opts.scale_load.scale_hint = ie->load_opts.scale_load.scale_hint;
739 msg.opts.degree = ie->load_opts.degree;
740 msg.opts.orientation = ie->load_opts.orientation;
741
742 if (!_server_send(&msg, sizeof(msg), NULL, NULL))
743 {
744 free(dentry);
745 ie->data2 = NULL;
746 return 0;
747 }
748
749 return msg.base.rid;
750}
751
752unsigned int 706unsigned int
753_image_load_server_send(Image_Entry *ie) 707_image_load_server_send(Image_Entry *ie)
754{ 708{
@@ -887,26 +841,25 @@ _image_unload_server_send(Image_Entry *ie)
887} 841}
888 842
889Eina_Bool 843Eina_Bool
890evas_cserve2_image_load(Image_Entry *ie, const char *file, const char *key, Evas_Image_Load_Opts *lopt) 844evas_cserve2_image_load(Image_Entry *ie)
891{ 845{
892 unsigned int rid; 846 unsigned int rid;
893 Eina_Bool has_load_opts; 847 const char *file, *key;
848 Evas_Image_Load_Opts *opts = NULL;
894 849
895 if (!ie) 850 if (!ie)
896 return EINA_FALSE; 851 return EINA_FALSE;
897 852
898 has_load_opts = !_memory_zero_cmp(lopt, sizeof(*lopt)); 853 file = ie->file;
899 rid = _image_open_server_send(ie, file, key, has_load_opts); 854 key = ie->key;
855 if (!_memory_zero_cmp(&ie->load_opts, sizeof(ie->load_opts)))
856 opts = &ie->load_opts;
857 rid = _image_open_server_send(ie, file, key, opts);
900 if (!rid) 858 if (!rid)
901 return EINA_FALSE; 859 return EINA_FALSE;
902 860
903 ie->open_rid = rid; 861 ie->open_rid = rid;
904 862
905 if (has_load_opts)
906 _image_setopts_server_send(ie);
907
908 // _server_dispatch_until(rid);
909
910 if (ie->data1) 863 if (ie->data1)
911 return EINA_TRUE; 864 return EINA_TRUE;
912 else 865 else
diff --git a/src/lib/evas/cserve2/evas_cs2_private.h b/src/lib/evas/cserve2/evas_cs2_private.h
index b055d1b90b..1cb59a3bdb 100644
--- a/src/lib/evas/cserve2/evas_cs2_private.h
+++ b/src/lib/evas/cserve2/evas_cs2_private.h
@@ -23,7 +23,7 @@ typedef struct _Font_Entry Font_Entry;
23int evas_cserve2_init(void); 23int evas_cserve2_init(void);
24int evas_cserve2_shutdown(void); 24int evas_cserve2_shutdown(void);
25EAPI int evas_cserve2_use_get(void); 25EAPI int evas_cserve2_use_get(void);
26Eina_Bool evas_cserve2_image_load(Image_Entry *ie, const char *file, const char *key, Evas_Image_Load_Opts *lopt); 26Eina_Bool evas_cserve2_image_load(Image_Entry *ie);
27int evas_cserve2_image_load_wait(Image_Entry *ie); 27int evas_cserve2_image_load_wait(Image_Entry *ie);
28Eina_Bool evas_cserve2_image_data_load(Image_Entry *ie); 28Eina_Bool evas_cserve2_image_data_load(Image_Entry *ie);
29int evas_cserve2_image_load_data_wait(Image_Entry *ie); 29int evas_cserve2_image_load_data_wait(Image_Entry *ie);