From: Jean-Philippe Andre Date: Tue, 1 Oct 2013 02:59:40 +0000 (+0900) Subject: evas/cserve2: Fix reload of image without load_opts X-Git-Tag: submit/devel/efl/20131029.075644~17^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6f485d2a125be78388ffa95d88b041b20b8724ec;p=platform%2Fupstream%2Fefl.git 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. --- diff --git a/src/bin/evas/evas_cserve2.h b/src/bin/evas/evas_cserve2.h index 158eefd..a90dc07 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); void cserve2_cache_client_del(Client *client); int 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); void cserve2_cache_file_close(Client *client, unsigned int client_file_id); -int cserve2_cache_image_entry_create(Client *client, int rid, unsigned int client_file_id, unsigned int image_id, Evas_Image_Load_Opts *opts); +int cserve2_cache_image_entry_create(Client *client, int rid, unsigned int client_file_id, unsigned int image_id, const Evas_Image_Load_Opts *opts); void 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); void cserve2_cache_image_load(Client *client, unsigned int client_image_id, unsigned int rid); void 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 2a358f7..8b4e565 100644 --- a/src/bin/evas/evas_cserve2_cache.c +++ b/src/bin/evas/evas_cserve2_cache.c @@ -932,10 +932,8 @@ static void _image_key_set(unsigned int file_id, const Evas_Image_Load_Opts *opts, char *buf, int size) { - const char empty[sizeof(Evas_Image_Load_Opts)] = {0}; - if (!opts) - opts = (Evas_Image_Load_Opts *) ∅ + opts = &empty_lo; snprintf(buf, size, "%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, } static unsigned int -_image_opts_id_get(unsigned int file_id, Evas_Image_Load_Opts *opts, +_image_opts_id_get(unsigned int file_id, const Evas_Image_Load_Opts *opts, char *buf, int size) { uintptr_t image_id; @@ -1580,7 +1578,7 @@ cserve2_cache_client_del(Client *client) static Image_Entry * _image_entry_new(Client *client, int rid, unsigned int client_file_id, unsigned int client_image_id, - Evas_Image_Load_Opts *opts, char *buf, size_t buf_size) + const Evas_Image_Load_Opts *opts, char *buf, size_t buf_size) { Reference *ref, *oldref; Image_Entry *ientry; @@ -2823,7 +2821,7 @@ int cserve2_cache_image_entry_create(Client *client, int rid, unsigned int client_file_id, unsigned int client_image_id, - Evas_Image_Load_Opts *opts) + const Evas_Image_Load_Opts *opts) { Image_Data *idata; Image_Entry *ientry; @@ -2832,9 +2830,12 @@ cserve2_cache_image_entry_create(Client *client, int rid, unsigned int image_id = 0; char buf[4096]; + if (!opts) + opts = &empty_lo; + // search whether the image is already loaded by another client ref = eina_hash_find(client->files.referencing, &client_file_id); - if (ref && opts) + if (ref) image_id = _image_opts_id_get(ref->entry->id, opts, buf, sizeof(buf)); if (image_id)