summaryrefslogtreecommitdiff
path: root/src/bin/evas
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2013-09-06 11:53:28 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2013-10-28 15:47:15 +0900
commit0d506a7b7369aad8376336497e755092cbe8cb40 (patch)
tree87c6926fafb4ddef6c6ca45352dc4292ddba61d5 /src/bin/evas
parent85cd382725ab877a62d935d9fb37368d4b868f59 (diff)
evas/cserve2: Fix images indexing (File_Entry stuff)
High-level problem: cserve2 does not support load_opts properly when opening an image. As a result, when (pre)loading a JPEG file with specific load options (eg. w, h, region and orientation), the image buffer might have the wrong dimensions. So, we need to use load_opts when computing file hash key. And, pass these load options to the loader slave, and use them while OPENING the image. This will set properly the geometry. Fixes test "Preload and Prescale" in elementary_test.
Diffstat (limited to 'src/bin/evas')
-rw-r--r--src/bin/evas/evas_cserve2.h17
-rw-r--r--src/bin/evas/evas_cserve2_cache.c146
-rw-r--r--src/bin/evas/evas_cserve2_main.c12
-rw-r--r--src/bin/evas/evas_cserve2_shm_debug.c52
-rw-r--r--src/bin/evas/evas_cserve2_slave.c34
5 files changed, 207 insertions, 54 deletions
diff --git a/src/bin/evas/evas_cserve2.h b/src/bin/evas/evas_cserve2.h
index 3b0ec1544c..b1b6d6882e 100644
--- a/src/bin/evas/evas_cserve2.h
+++ b/src/bin/evas/evas_cserve2.h
@@ -5,7 +5,7 @@
5#include "evas_cs2.h" 5#include "evas_cs2.h"
6 6
7#ifndef CSERVE2_LOG_LEVEL 7#ifndef CSERVE2_LOG_LEVEL
8#define CSERVE2_LOG_LEVEL 2 8#define CSERVE2_LOG_LEVEL 4
9#endif 9#endif
10 10
11#ifdef CRIT 11#ifdef CRIT
@@ -103,8 +103,17 @@ typedef enum {
103} Slave_Command; 103} Slave_Command;
104 104
105struct _Slave_Msg_Image_Open { 105struct _Slave_Msg_Image_Open {
106 Eina_Bool has_loader_data : 1; 106 struct {
107 // Optionally followed by: 107 struct {
108 unsigned int x, y, w, h;
109 } region;
110 double dpi;
111 unsigned int w, h;
112 int scale_down_by;
113 Eina_Bool orientation;
114 } lo;
115 // const char path[];
116 // const char key[];
108 // const char loader[]; 117 // const char loader[];
109}; 118};
110 119
@@ -308,7 +317,7 @@ void cserve2_cache_init(void);
308void cserve2_cache_shutdown(void); 317void cserve2_cache_shutdown(void);
309void cserve2_cache_client_new(Client *client); 318void cserve2_cache_client_new(Client *client);
310void cserve2_cache_client_del(Client *client); 319void cserve2_cache_client_del(Client *client);
311int cserve2_cache_file_open(Client *client, unsigned int client_file_id, const char *path, const char *key, unsigned int rid); 320int cserve2_cache_file_open(Client *client, unsigned int client_file_id, const char *path, const char *key, unsigned int rid, Evas_Image_Load_Opts *lo);
312void cserve2_cache_file_close(Client *client, unsigned int client_file_id); 321void cserve2_cache_file_close(Client *client, unsigned int client_file_id);
313int cserve2_cache_image_entry_create(Client *client, int rid, unsigned int client_file_id, unsigned int image_id, Evas_Image_Load_Opts *opts); 322int cserve2_cache_image_entry_create(Client *client, int rid, unsigned int client_file_id, unsigned int image_id, Evas_Image_Load_Opts *opts);
314void 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); 323void 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);
diff --git a/src/bin/evas/evas_cserve2_cache.c b/src/bin/evas/evas_cserve2_cache.c
index 30f4cf530f..5361c137a1 100644
--- a/src/bin/evas/evas_cserve2_cache.c
+++ b/src/bin/evas/evas_cserve2_cache.c
@@ -27,6 +27,22 @@ typedef struct _File_Watch File_Watch;
27typedef struct _Font_Source Font_Source; 27typedef struct _Font_Source Font_Source;
28typedef struct _Font_Entry Font_Entry; 28typedef struct _Font_Entry Font_Entry;
29 29
30static const Evas_Image_Load_Opts empty_lo = {
31 { 0, 0, 0, 0 },
32 {
33 0, 0, 0, 0,
34 0, 0,
35 0,
36 0
37 },
38 0.0,
39 0, 0,
40 0,
41 0,
42
43 EINA_FALSE
44};
45
30typedef enum { 46typedef enum {
31 CSERVE2_IMAGE_FILE, 47 CSERVE2_IMAGE_FILE,
32 CSERVE2_IMAGE_DATA, 48 CSERVE2_IMAGE_DATA,
@@ -550,11 +566,12 @@ _font_loaded_send(Client *client, unsigned int rid)
550static void * 566static void *
551_open_request_build(Entry *entry, int *bufsize) 567_open_request_build(Entry *entry, int *bufsize)
552{ 568{
569 Slave_Msg_Image_Open msg = { { { 0,0,0,0}, 0,0,0,0,0, } };
553 const char *loader_data, *key, *path; 570 const char *loader_data, *key, *path;
554 char *buf; 571 void *buf;
555 int size, pathlen, keylen, loaderlen; 572 size_t pathlen, keylen, loaderlen;
556 Slave_Msg_Image_Open msg;
557 File_Data *fd; 573 File_Data *fd;
574 Eina_Binbuf *bb;
558 575
559 if (!entry || entry->type != CSERVE2_IMAGE_FILE) 576 if (!entry || entry->type != CSERVE2_IMAGE_FILE)
560 return NULL; 577 return NULL;
@@ -568,30 +585,33 @@ _open_request_build(Entry *entry, int *bufsize)
568 585
569 path = cserve2_shared_string_get(fd->path); 586 path = cserve2_shared_string_get(fd->path);
570 key = cserve2_shared_string_get(fd->key); 587 key = cserve2_shared_string_get(fd->key);
588 loader_data = cserve2_shared_string_get(fd->loader_data);
571 if (!path) path = ""; 589 if (!path) path = "";
572 if (!key) key = ""; 590 if (!key) key = "";
591 if (!loader_data) loader_data = "";
573 pathlen = strlen(path) + 1; 592 pathlen = strlen(path) + 1;
574 keylen = strlen(key) + 1; 593 keylen = strlen(key) + 1;
575 594 loaderlen = strlen(loader_data) + 1;
576 memset(&msg, 0, sizeof(msg)); 595
577 loader_data = cserve2_shared_string_get(fd->loader_data); 596 msg.lo.region.x = fd->lo.region.x;
578 msg.has_loader_data = !!loader_data; 597 msg.lo.region.y = fd->lo.region.y;
579 loaderlen = msg.has_loader_data ? (strlen(loader_data) + 1) : 0; 598 msg.lo.region.w = fd->lo.region.w;
580 599 msg.lo.region.h = fd->lo.region.h;
581 size = sizeof(msg) + pathlen + keylen + loaderlen; 600 msg.lo.dpi = fd->lo.dpi;
582 buf = malloc(size); 601 msg.lo.w = fd->lo.w;
583 if (!buf) return NULL; 602 msg.lo.h = fd->lo.h;
584 603 msg.lo.scale_down_by = fd->lo.scale_down_by;
585 memcpy(buf, &msg, sizeof(msg)); 604 msg.lo.orientation = fd->lo.orientation;
586 memcpy(buf + sizeof(msg), path, pathlen); 605
587 memcpy(buf + sizeof(msg) + pathlen, key, keylen); 606 bb = eina_binbuf_new();
588 if (msg.has_loader_data) 607 eina_binbuf_append_length(bb, (unsigned char *) &msg, sizeof(msg));
589 memcpy(buf + sizeof(msg) + pathlen + keylen, loader_data, loaderlen); 608 eina_binbuf_append_length(bb, (unsigned char *) path, pathlen);
590 609 eina_binbuf_append_length(bb, (unsigned char *) key, keylen);
591 *bufsize = size; 610 eina_binbuf_append_length(bb, (unsigned char *) loader_data, loaderlen);
592 611
593 _entry_load_start(entry); 612 *bufsize = eina_binbuf_length_get(bb);
594 613 buf = eina_binbuf_string_steal(bb);
614 eina_binbuf_free(bb);
595 return buf; 615 return buf;
596} 616}
597 617
@@ -940,17 +960,66 @@ _image_entry_size_get(Image_Entry *ientry)
940 return size / 1024; 960 return size / 1024;
941} 961}
942 962
963static Eina_Bool
964_evas_image_load_opts_empty(Evas_Image_Load_Opts *lo)
965{
966 if (!lo) return EINA_TRUE;
967
968 return ((lo->scale_down_by == 0)
969 && (lo->dpi == 0.0)
970 && (lo->w == 0) && (lo->h == 0)
971 && (lo->region.x == 0) && (lo->region.y == 0)
972 && (lo->region.w == 0) && (lo->region.h == 0)
973 && (lo->orientation == 0));
974}
975
976static void
977_file_hkey_get(char *buf, size_t sz, const char *path, const char *key,
978 Evas_Image_Load_Opts *lo)
979{
980 // Same as _evas_cache_image_loadopts_append() but not optimized :)
981 if (lo && _evas_image_load_opts_empty(lo))
982 lo = NULL;
983
984 if (!lo)
985 snprintf(buf, sz, "%s:%s", path, key);
986 else
987 {
988 if (lo->orientation)
989 {
990 snprintf(buf, sz, "%s:%s//@/%d/%f/%dx%d/%d+%d.%dx%d",
991 path, key, lo->scale_down_by, lo->dpi, lo->w, lo->h,
992 lo->region.x, lo->region.y, lo->region.w, lo->region.h);
993 }
994 else
995 {
996 snprintf(buf, sz, "%s:%s//@/%d/%f/%dx%d/%d+%d.%dx%d/o",
997 path, key, lo->scale_down_by, lo->dpi, lo->w, lo->h,
998 lo->region.x, lo->region.y, lo->region.w, lo->region.h);
999 }
1000 }
1001}
1002
943static void 1003static void
944_file_id_free(File_Data *fd) 1004_file_id_free(File_Data *fd)
945{ 1005{
1006 Evas_Image_Load_Opts lo = empty_lo;
946 char buf[4096]; 1007 char buf[4096];
947 1008
948 DBG("Removing entry file id: %d, file: \"%s:%s\"", 1009 lo.region.x = fd->lo.region.x;
949 fd->id, cserve2_shared_string_get(fd->path), 1010 lo.region.y = fd->lo.region.y;
950 cserve2_shared_string_get(fd->key)); 1011 lo.region.w = fd->lo.region.w;
951 snprintf(buf, sizeof(buf), "%s:%s", 1012 lo.region.h = fd->lo.region.h;
952 cserve2_shared_string_get(fd->path), 1013 lo.dpi = fd->lo.dpi;
953 cserve2_shared_string_get(fd->key)); 1014 lo.w = fd->lo.w;
1015 lo.h = fd->lo.h;
1016 lo.scale_down_by = fd->lo.scale_down_by;
1017 lo.orientation = fd->lo.orientation;
1018
1019 _file_hkey_get(buf, sizeof(buf), cserve2_shared_string_get(fd->path),
1020 cserve2_shared_string_get(fd->key), &lo);
1021
1022 DBG("Removing entry file id: %u, file: \"%s\"", fd->id, buf);
954 eina_hash_del_by_key(file_ids, buf); 1023 eina_hash_del_by_key(file_ids, buf);
955} 1024}
956 1025
@@ -2450,7 +2519,8 @@ _cserve2_cache_font_debug(unsigned int rid, unsigned int *size)
2450 2519
2451int 2520int
2452cserve2_cache_file_open(Client *client, unsigned int client_file_id, 2521cserve2_cache_file_open(Client *client, unsigned int client_file_id,
2453 const char *path, const char *key, unsigned int rid) 2522 const char *path, const char *key, unsigned int rid,
2523 Evas_Image_Load_Opts *lo)
2454{ 2524{
2455 unsigned int file_id; 2525 unsigned int file_id;
2456 File_Data *fd; 2526 File_Data *fd;
@@ -2460,6 +2530,7 @@ cserve2_cache_file_open(Client *client, unsigned int client_file_id,
2460 File_Entry *fentry; 2530 File_Entry *fentry;
2461 int idx; 2531 int idx;
2462 2532
2533#if 0
2463 // look for this file on client references 2534 // look for this file on client references
2464 ref = eina_hash_find(client->files.referencing, &client_file_id); 2535 ref = eina_hash_find(client->files.referencing, &client_file_id);
2465 if (ref) 2536 if (ref)
@@ -2483,9 +2554,10 @@ cserve2_cache_file_open(Client *client, unsigned int client_file_id,
2483 _image_opened_send(client, fd, rid); 2554 _image_opened_send(client, fd, rid);
2484 return 0; 2555 return 0;
2485 } 2556 }
2557#endif
2486 2558
2487 // search whether the file is already opened by another client 2559 // search whether the file is already opened by another client
2488 snprintf(buf, sizeof(buf), "%s:%s", path, key); 2560 _file_hkey_get(buf, sizeof(buf), path, key, lo);
2489 file_id = (unsigned int)(uintptr_t)eina_hash_find(file_ids, buf); 2561 file_id = (unsigned int)(uintptr_t)eina_hash_find(file_ids, buf);
2490 if (file_id) 2562 if (file_id)
2491 { 2563 {
@@ -2527,9 +2599,19 @@ cserve2_cache_file_open(Client *client, unsigned int client_file_id,
2527 return -1; 2599 return -1;
2528 } 2600 }
2529 fd->valid = EINA_FALSE; 2601 fd->valid = EINA_FALSE;
2530 fd->refcount = 1;
2531 fd->path = cserve2_shared_string_add(path); 2602 fd->path = cserve2_shared_string_add(path);
2532 fd->key = cserve2_shared_string_add(key); 2603 fd->key = cserve2_shared_string_add(key);
2604 if (!lo) lo = (Evas_Image_Load_Opts *) &empty_lo;
2605 fd->lo.region.x = lo->region.x;
2606 fd->lo.region.y = lo->region.y;
2607 fd->lo.region.w = lo->region.w;
2608 fd->lo.region.h = lo->region.h;
2609 fd->lo.dpi = lo->dpi;
2610 fd->lo.w = lo->w;
2611 fd->lo.h = lo->h;
2612 fd->lo.scale_down_by = lo->scale_down_by;
2613 fd->lo.orientation = lo->orientation;
2614 fd->refcount = 1;
2533 fd->id = file_id; 2615 fd->id = file_id;
2534 2616
2535 fentry = calloc(1, sizeof(File_Entry)); 2617 fentry = calloc(1, sizeof(File_Entry));
diff --git a/src/bin/evas/evas_cserve2_main.c b/src/bin/evas/evas_cserve2_main.c
index 90a811af62..bd54cbfb3d 100644
--- a/src/bin/evas/evas_cserve2_main.c
+++ b/src/bin/evas/evas_cserve2_main.c
@@ -136,6 +136,8 @@ _cserve2_client_open(Client *client)
136{ 136{
137 Msg_Open *msg = (Msg_Open *)client->msg.buf; 137 Msg_Open *msg = (Msg_Open *)client->msg.buf;
138 const char *path, *key, *end; 138 const char *path, *key, *end;
139 Evas_Image_Load_Opts *opts = NULL;
140 Evas_Image_Load_Opts opts_copy;
139 141
140 path = ((const char *)msg) + sizeof(*msg) + msg->path_offset; 142 path = ((const char *)msg) + sizeof(*msg) + msg->path_offset;
141 key = ((const char *)msg) + sizeof(*msg) + msg->key_offset; 143 key = ((const char *)msg) + sizeof(*msg) + msg->key_offset;
@@ -146,7 +148,14 @@ _cserve2_client_open(Client *client)
146 msg->file_id, path, key, (int) msg->has_load_opts); 148 msg->file_id, path, key, (int) msg->has_load_opts);
147 149
148 if (!key[0]) key = NULL; 150 if (!key[0]) key = NULL;
149 cserve2_cache_file_open(client, msg->file_id, path, key, msg->base.rid); 151 if (msg->has_load_opts)
152 {
153 opts = &opts_copy;
154 memcpy(&opts_copy, end, sizeof(opts_copy));
155 }
156
157 cserve2_cache_file_open(client, msg->file_id, path, key, msg->base.rid,
158 opts);
150 159
151 if (!msg->has_load_opts) 160 if (!msg->has_load_opts)
152 cserve2_cache_image_entry_create(client, msg->base.rid, 161 cserve2_cache_image_entry_create(client, msg->base.rid,
@@ -154,7 +163,6 @@ _cserve2_client_open(Client *client)
154 else 163 else
155 { 164 {
156 // FIXME: Check message size first? 165 // FIXME: Check message size first?
157 Evas_Image_Load_Opts *opts = (Evas_Image_Load_Opts *) end;
158 166
159 DBG("Load Options:"); 167 DBG("Load Options:");
160 DBG("\tdpi: %03.1f", opts->dpi); 168 DBG("\tdpi: %03.1f", opts->dpi);
diff --git a/src/bin/evas/evas_cserve2_shm_debug.c b/src/bin/evas/evas_cserve2_shm_debug.c
index 882864618e..12ee29dd55 100644
--- a/src/bin/evas/evas_cserve2_shm_debug.c
+++ b/src/bin/evas/evas_cserve2_shm_debug.c
@@ -384,7 +384,7 @@ _strings_all_print(Eina_Bool full)
384} 384}
385 385
386static void 386static void
387_files_all_print(Eina_Bool full) 387_files_all_print_short()
388{ 388{
389 int k; 389 int k;
390 390
@@ -401,7 +401,7 @@ _files_all_print(Eina_Bool full)
401 401
402 fd = _shared_array_item_get(sf_files, k); 402 fd = _shared_array_item_get(sf_files, k);
403 if (!fd) break; 403 if (!fd) break;
404 if (!fd->id || (!full && !fd->refcount)) continue; 404 if (!fd->id || !fd->refcount) continue;
405 405
406 printf("%7d %7d %5dx%-6d %d %d %6.6s %6d %6d '%s':'%s'\n", 406 printf("%7d %7d %5dx%-6d %d %d %6.6s %6d %6d '%s':'%s'\n",
407 k, fd->id, fd->w, fd->h, !!fd->alpha, !!fd->invalid, 407 k, fd->id, fd->w, fd->h, !!fd->alpha, !!fd->invalid,
@@ -414,6 +414,51 @@ _files_all_print(Eina_Bool full)
414} 414}
415 415
416static void 416static void
417_files_all_print_all(void)
418{
419 int k;
420
421 if (!sf_files) return;
422
423 printf("List of opened image files: %s\n", eina_file_filename_get(sf_files->f));
424 printf_newline(0);
425
426 for (k = 0; k < sf_files->header->count; k++)
427 {
428 File_Data *fd;
429
430 fd = _shared_array_item_get(sf_files, k);
431 if (!fd) break;
432 if (!fd->id) continue;
433
434 printf("File #%-8d %d\n", k, fd->id);
435 printf("Path:Key: '%s':'%s'\n",
436 _shared_string_get(fd->path), _shared_string_get(fd->key));
437 printf("LoadOpts: Region: %d,%d-%dx%d\n",
438 fd->lo.region.x, fd->lo.region.y, fd->lo.region.w, fd->lo.region.h);
439 if (fd->lo.dpi != 0)
440 printf(" DPI: %f\n");
441 else
442 printf(" DPI: 0\n");
443 printf(" Requested: %dx%d\n", fd->lo.w, fd->lo.h);
444 printf(" Scale down: %d\n", fd->lo.scale_down_by);
445 printf(" Orientation: %s\n", fd->lo.orientation ? "YES" : "NO");
446 printf("Loader: %s\n", _shared_string_get(fd->loader_data));
447 printf("Geometry: %dx%d\n", fd->w, fd->h);
448 printf("Animation: anim: %s, frames: %d, loop: %d, hint: %d\n",
449 fd->animated ? "YES" : "NO",
450 fd->frame_count, fd->loop_count, fd->loop_hint);
451 printf("Alpha: %s\n", fd->alpha ? "YES" : "NO");
452 printf("Invalid: %s\n", fd->invalid ? "YES" : "NO");
453
454 printf_newline(0);
455 }
456
457 printf("\n\n");
458 fflush(stdout);
459}
460
461static void
417_images_all_print_short(void) 462_images_all_print_short(void)
418{ 463{
419 int k; 464 int k;
@@ -752,7 +797,8 @@ main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
752 797
753 _index_tables_summary_print(); 798 _index_tables_summary_print();
754 _strings_all_print(full); 799 _strings_all_print(full);
755 _files_all_print(full); 800 _files_all_print_short();
801 if (full) _files_all_print_all();
756 _images_all_print_short(); 802 _images_all_print_short();
757 if (full) _images_all_print_full(); 803 if (full) _images_all_print_full();
758 _fonts_all_print_short(); 804 _fonts_all_print_short();
diff --git a/src/bin/evas/evas_cserve2_slave.c b/src/bin/evas/evas_cserve2_slave.c
index da6099ba59..963a1dba76 100644
--- a/src/bin/evas/evas_cserve2_slave.c
+++ b/src/bin/evas/evas_cserve2_slave.c
@@ -318,7 +318,8 @@ _image_file_header(Eina_File *fd, Eina_Stringshare *key, Evas_Image_Load_Opts *l
318 318
319static Error_Type 319static Error_Type
320image_open(const char *file, const char *key, 320image_open(const char *file, const char *key,
321 Slave_Msg_Image_Opened *result, const char **use_loader) 321 Slave_Msg_Image_Opened *result, const char **use_loader,
322 Evas_Image_Load_Opts *load_opts)
322{ 323{
323 Evas_Module *module; 324 Evas_Module *module;
324 Eina_File *fd; 325 Eina_File *fd;
@@ -327,9 +328,6 @@ image_open(const char *file, const char *key,
327 unsigned int i; 328 unsigned int i;
328 Error_Type ret = CSERVE2_NONE; 329 Error_Type ret = CSERVE2_NONE;
329 Eina_Stringshare *skey = eina_stringshare_add(key); 330 Eina_Stringshare *skey = eina_stringshare_add(key);
330 Evas_Image_Load_Opts load_opts;
331
332 memset(&load_opts, 0, sizeof(load_opts));
333 331
334 fd = eina_file_open(file, EINA_FALSE); 332 fd = eina_file_open(file, EINA_FALSE);
335 if (!fd) 333 if (!fd)
@@ -344,7 +342,7 @@ image_open(const char *file, const char *key,
344 module = evas_module_find_type(EVAS_MODULE_TYPE_IMAGE_LOADER, loader); 342 module = evas_module_find_type(EVAS_MODULE_TYPE_IMAGE_LOADER, loader);
345 if (module) 343 if (module)
346 { 344 {
347 if (_image_file_header(fd, skey, &load_opts, result, module)) 345 if (_image_file_header(fd, skey, load_opts, result, module))
348 goto success; 346 goto success;
349 } 347 }
350 348
@@ -364,7 +362,7 @@ try_extension:
364 if (loader) 362 if (loader)
365 { 363 {
366 module = evas_module_find_type(EVAS_MODULE_TYPE_IMAGE_LOADER, loader); 364 module = evas_module_find_type(EVAS_MODULE_TYPE_IMAGE_LOADER, loader);
367 if (module && _image_file_header(fd, skey, &load_opts, result, module)) 365 if (module && _image_file_header(fd, skey, load_opts, result, module))
368 goto success; 366 goto success;
369 loader = NULL; 367 loader = NULL;
370 module = NULL; 368 module = NULL;
@@ -376,7 +374,7 @@ try_extension:
376 loader = loaders_name[i]; 374 loader = loaders_name[i];
377 module = evas_module_find_type(EVAS_MODULE_TYPE_IMAGE_LOADER, loader); 375 module = evas_module_find_type(EVAS_MODULE_TYPE_IMAGE_LOADER, loader);
378 if (!module) continue; 376 if (!module) continue;
379 if (_image_file_header(fd, skey, &load_opts, result, module)) 377 if (_image_file_header(fd, skey, load_opts, result, module))
380 goto success; 378 goto success;
381 } 379 }
382 380
@@ -487,22 +485,32 @@ done:
487static void 485static void
488handle_image_open(int wfd, void *params) 486handle_image_open(int wfd, void *params)
489{ 487{
490 Slave_Msg_Image_Open *p; 488 Slave_Msg_Image_Open *msg = params;
491 Slave_Msg_Image_Opened result; 489 Slave_Msg_Image_Opened result;
490 Evas_Image_Load_Opts load_opts;
492 Error_Type err; 491 Error_Type err;
493 const char *loader = NULL, *file, *key, *ptr; 492 const char *loader = NULL, *file, *key, *ptr;
494 char *resp; 493 char *resp;
495 size_t resp_size; 494 size_t resp_size;
496 495
497 p = params; 496 memset(&load_opts, 0, sizeof(load_opts));
498 file = (const char *)(p + sizeof(Slave_Msg_Image_Open)); 497 load_opts.region.x = msg->lo.region.x;
498 load_opts.region.y = msg->lo.region.y;
499 load_opts.region.w = msg->lo.region.w;
500 load_opts.region.h = msg->lo.region.h;
501 load_opts.dpi = msg->lo.dpi;
502 load_opts.w = msg->lo.w;
503 load_opts.h = msg->lo.h;
504 load_opts.scale_down_by = msg->lo.scale_down_by;
505 load_opts.orientation = msg->lo.orientation;
506
507 file = (const char *) (msg + 1);
499 key = file + strlen(file) + 1; 508 key = file + strlen(file) + 1;
500 ptr = key + strlen(key) + 1; 509 ptr = key + strlen(key) + 1;
501 if (p->has_loader_data) 510 loader = ptr;
502 loader = ptr;
503 511
504 memset(&result, 0, sizeof(result)); 512 memset(&result, 0, sizeof(result));
505 if ((err = image_open(file, key, &result, &loader)) 513 if ((err = image_open(file, key, &result, &loader, &load_opts))
506 != CSERVE2_NONE) 514 != CSERVE2_NONE)
507 { 515 {
508 printf("OPEN failed at %s:%d\n", __FUNCTION__, __LINE__); 516 printf("OPEN failed at %s:%d\n", __FUNCTION__, __LINE__);