summaryrefslogtreecommitdiff
path: root/src/lib/evas/cserve2/evas_cs2_client.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2013-07-03 15:49:59 +0900
committerCedric Bail <cedric.bail@samsung.com>2013-07-04 13:02:48 +0900
commit46b7baa3790e700c941c62431e3e2c06ef5550bb (patch)
treeed46d31b6fba50e7fb0dd73320b586a442dc3331 /src/lib/evas/cserve2/evas_cs2_client.c
parentca5d174568e7ebae829899811d36f48bf0dc9d6e (diff)
evas/cserve2: merge SETOPTS into OPEN
When opening an image, OPEN and SETOPTS were always sent consecutively. Merging these two messages may improve the performance a bit (not measured), but also simplify the whole thing. Note: cserve2 debug tools have not been fixed yet.
Diffstat (limited to '')
-rw-r--r--src/lib/evas/cserve2/evas_cs2_client.c77
1 files changed, 15 insertions, 62 deletions
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