forked from enlightenment/efl
evas/cserve2: no cache for large images or non-smooth
The concept is taken from scalecache. I am not sure of the performance impact.
This commit is contained in:
parent
7c7c231015
commit
09a5c28e5b
|
@ -454,6 +454,7 @@ _load_request_build(Image_Data *i, int *bufsize)
|
|||
msg.opts.region = i->opts.region;
|
||||
msg.opts.scale_down_by = i->opts.scale_down_by;
|
||||
msg.opts.dpi = i->opts.dpi;
|
||||
msg.opts.degree = i->opts.degree;
|
||||
msg.opts.orientation = i->opts.orientation;
|
||||
|
||||
msg.shm.mmap_offset = cserve2_shm_map_offset_get(i->shm);
|
||||
|
@ -1038,9 +1039,9 @@ cserve2_cache_client_del(Client *client)
|
|||
}
|
||||
|
||||
static Image_Data *
|
||||
_image_msg_new(Client *client, int rid,
|
||||
unsigned int file_id, unsigned int image_id,
|
||||
Evas_Image_Load_Opts *opts)
|
||||
_image_entry_new(Client *client, int rid,
|
||||
unsigned int file_id, unsigned int image_id,
|
||||
Evas_Image_Load_Opts *opts)
|
||||
{
|
||||
Reference *ref;
|
||||
Image_Data *im_entry;
|
||||
|
@ -2097,7 +2098,7 @@ cserve2_cache_image_opts_set(Client *client, int rid,
|
|||
oldref = eina_hash_find(client->images.referencing, &client_image_id);
|
||||
|
||||
// search whether the image is already loaded by another client
|
||||
entry = _image_msg_new(client, rid, file_id, client_image_id, opts);
|
||||
entry = _image_entry_new(client, rid, file_id, client_image_id, opts);
|
||||
if (!entry)
|
||||
return -1;
|
||||
image_id = _img_opts_id_get(entry, buf, sizeof(buf));
|
||||
|
|
|
@ -844,7 +844,9 @@ _scaled_image_find(Image_Entry *im, int src_x, int src_y, int src_w, int src_h,
|
|||
}
|
||||
|
||||
EAPI Image_Entry *
|
||||
evas_cache2_image_scale_load(Image_Entry *im, int src_x, int src_y, int src_w, int src_h, int dst_w, int dst_h, int smooth)
|
||||
evas_cache2_image_scale_load(Image_Entry *im,
|
||||
int src_x, int src_y, int src_w, int src_h,
|
||||
int dst_w, int dst_h, int smooth)
|
||||
{
|
||||
size_t pathlen, keylen, size;
|
||||
char *hkey;
|
||||
|
@ -852,6 +854,16 @@ evas_cache2_image_scale_load(Image_Entry *im, int src_x, int src_y, int src_w, i
|
|||
int error = EVAS_LOAD_ERROR_NONE;
|
||||
Image_Entry *ret;
|
||||
|
||||
if (!smooth && im->scale_hint != EVAS_IMAGE_SCALE_HINT_STATIC)
|
||||
goto parent_out;
|
||||
|
||||
// Concept from scalecache: don't cache large images.
|
||||
if (((((dst_w > 640) || (dst_h > 640)) &&
|
||||
((dst_w * dst_h) > (480 * 480))) ||
|
||||
(im->scale_hint == EVAS_IMAGE_SCALE_HINT_STATIC)) &&
|
||||
(im->scale_hint != EVAS_IMAGE_SCALE_HINT_DYNAMIC))
|
||||
goto parent_out;
|
||||
|
||||
if (((!im->file) || ((!im->file) && (!im->key))) ||
|
||||
((src_w == 0) || (src_h == 0) || (dst_w == 0) || (dst_h == 0)) ||
|
||||
(im->scale_hint == EVAS_IMAGE_SCALE_HINT_DYNAMIC)) goto parent_out;
|
||||
|
|
Loading…
Reference in New Issue