summaryrefslogtreecommitdiff
path: root/src/bin/evas
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2013-10-01 11:59:40 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2013-10-28 15:47:15 +0900
commit6f485d2a125be78388ffa95d88b041b20b8724ec (patch)
treede32692b35b0b0399642ba63e0021068ef2fb61f /src/bin/evas
parent74080fba226410257084df7cde9cb02f96ed37b6 (diff)
evas/cserve2: Fix reload of image without load_opts
Problem: Images opened without load_opts are reopened multiple times. Solution: Use empty load opts when looking for the key.
Diffstat (limited to 'src/bin/evas')
-rw-r--r--src/bin/evas/evas_cserve2.h2
-rw-r--r--src/bin/evas/evas_cserve2_cache.c15
2 files changed, 9 insertions, 8 deletions
diff --git a/src/bin/evas/evas_cserve2.h b/src/bin/evas/evas_cserve2.h
index 158eefda3d..a90dc079c7 100644
--- a/src/bin/evas/evas_cserve2.h
+++ b/src/bin/evas/evas_cserve2.h
@@ -320,7 +320,7 @@ void cserve2_cache_client_new(Client *client);
320void cserve2_cache_client_del(Client *client); 320void cserve2_cache_client_del(Client *client);
321int 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); 321int 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);
322void cserve2_cache_file_close(Client *client, unsigned int client_file_id); 322void cserve2_cache_file_close(Client *client, unsigned int client_file_id);
323int cserve2_cache_image_entry_create(Client *client, int rid, unsigned int client_file_id, unsigned int image_id, Evas_Image_Load_Opts *opts); 323int cserve2_cache_image_entry_create(Client *client, int rid, unsigned int client_file_id, unsigned int image_id, const Evas_Image_Load_Opts *opts);
324void cserve2_rgba_image_scale_do(void *src_data, int src_full_w, int src_full_h, 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); 324void cserve2_rgba_image_scale_do(void *src_data, int src_full_w, int src_full_h, 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);
325void cserve2_cache_image_load(Client *client, unsigned int client_image_id, unsigned int rid); 325void cserve2_cache_image_load(Client *client, unsigned int client_image_id, unsigned int rid);
326void cserve2_cache_image_preload(Client *client, unsigned int client_image_id, unsigned int rid); 326void 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 2a358f7ef9..8b4e5659ca 100644
--- a/src/bin/evas/evas_cserve2_cache.c
+++ b/src/bin/evas/evas_cserve2_cache.c
@@ -932,10 +932,8 @@ static void
932_image_key_set(unsigned int file_id, const Evas_Image_Load_Opts *opts, 932_image_key_set(unsigned int file_id, const Evas_Image_Load_Opts *opts,
933 char *buf, int size) 933 char *buf, int size)
934{ 934{
935 const char empty[sizeof(Evas_Image_Load_Opts)] = {0};
936
937 if (!opts) 935 if (!opts)
938 opts = (Evas_Image_Load_Opts *) &empty; 936 opts = &empty_lo;
939 937
940 snprintf(buf, size, 938 snprintf(buf, size,
941 "%u:%0.3f:%dx%d:%d:%d,%d+%dx%d:!([%d,%d:%dx%d]-[%dx%d:%d]):%d:%d", 939 "%u:%0.3f:%dx%d:%d:%d,%d+%dx%d:!([%d,%d:%dx%d]-[%dx%d:%d]):%d:%d",
@@ -950,7 +948,7 @@ _image_key_set(unsigned int file_id, const Evas_Image_Load_Opts *opts,
950} 948}
951 949
952static unsigned int 950static unsigned int
953_image_opts_id_get(unsigned int file_id, Evas_Image_Load_Opts *opts, 951_image_opts_id_get(unsigned int file_id, const Evas_Image_Load_Opts *opts,
954 char *buf, int size) 952 char *buf, int size)
955{ 953{
956 uintptr_t image_id; 954 uintptr_t image_id;
@@ -1580,7 +1578,7 @@ cserve2_cache_client_del(Client *client)
1580static Image_Entry * 1578static Image_Entry *
1581_image_entry_new(Client *client, int rid, 1579_image_entry_new(Client *client, int rid,
1582 unsigned int client_file_id, unsigned int client_image_id, 1580 unsigned int client_file_id, unsigned int client_image_id,
1583 Evas_Image_Load_Opts *opts, char *buf, size_t buf_size) 1581 const Evas_Image_Load_Opts *opts, char *buf, size_t buf_size)
1584{ 1582{
1585 Reference *ref, *oldref; 1583 Reference *ref, *oldref;
1586 Image_Entry *ientry; 1584 Image_Entry *ientry;
@@ -2823,7 +2821,7 @@ int
2823cserve2_cache_image_entry_create(Client *client, int rid, 2821cserve2_cache_image_entry_create(Client *client, int rid,
2824 unsigned int client_file_id, 2822 unsigned int client_file_id,
2825 unsigned int client_image_id, 2823 unsigned int client_image_id,
2826 Evas_Image_Load_Opts *opts) 2824 const Evas_Image_Load_Opts *opts)
2827{ 2825{
2828 Image_Data *idata; 2826 Image_Data *idata;
2829 Image_Entry *ientry; 2827 Image_Entry *ientry;
@@ -2832,9 +2830,12 @@ cserve2_cache_image_entry_create(Client *client, int rid,
2832 unsigned int image_id = 0; 2830 unsigned int image_id = 0;
2833 char buf[4096]; 2831 char buf[4096];
2834 2832
2833 if (!opts)
2834 opts = &empty_lo;
2835
2835 // search whether the image is already loaded by another client 2836 // search whether the image is already loaded by another client
2836 ref = eina_hash_find(client->files.referencing, &client_file_id); 2837 ref = eina_hash_find(client->files.referencing, &client_file_id);
2837 if (ref && opts) 2838 if (ref)
2838 image_id = _image_opts_id_get(ref->entry->id, opts, buf, sizeof(buf)); 2839 image_id = _image_opts_id_get(ref->entry->id, opts, buf, sizeof(buf));
2839 2840
2840 if (image_id) 2841 if (image_id)