summaryrefslogtreecommitdiff
path: root/src/lib/evas/cserve2
diff options
context:
space:
mode:
Diffstat (limited to '')
-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
3 files changed, 21 insertions, 78 deletions
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);