forked from enlightenment/efl
evas image async preload - add option to also make header load async
to date if you use async preload we still load the header synchronously and this can be horrible especially with generic loaders. there is no way to farm this off to the preload thread. now there is. youhave to set it as a skip head load option before doing a file_set AND you need to issue a preload ... but now it's possible. @feature
This commit is contained in:
parent
b0530aba4f
commit
9e01cf2698
|
@ -28,19 +28,22 @@ typedef struct _Font_Source Font_Source;
|
|||
typedef struct _Font_Entry Font_Entry;
|
||||
|
||||
static const Evas_Image_Load_Opts empty_lo = {
|
||||
{ 0, 0, 0, 0 },
|
||||
{
|
||||
0, 0, 0, 0,
|
||||
0, 0,
|
||||
0,
|
||||
0
|
||||
},
|
||||
0.0,
|
||||
0, 0,
|
||||
0,
|
||||
0,
|
||||
{
|
||||
{ 0, 0, 0, 0 },
|
||||
{
|
||||
0, 0, 0, 0,
|
||||
0, 0,
|
||||
0,
|
||||
0
|
||||
},
|
||||
0.0,
|
||||
0, 0,
|
||||
0,
|
||||
0,
|
||||
|
||||
EINA_FALSE
|
||||
EINA_FALSE
|
||||
},
|
||||
EINA_FALSE
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
|
@ -761,13 +764,13 @@ _load_request_build(Image_Entry *ientry, int *bufsize)
|
|||
msg.alpha = fd->alpha;
|
||||
|
||||
// NOTE: Not passing scale_load options
|
||||
msg.opts.w = idata->opts.w;
|
||||
msg.opts.h = idata->opts.h;
|
||||
msg.opts.region = idata->opts.region;
|
||||
msg.opts.scale_down_by = idata->opts.scale_down_by;
|
||||
msg.opts.dpi = idata->opts.dpi;
|
||||
msg.opts.degree = idata->opts.degree;
|
||||
msg.opts.orientation = idata->opts.orientation;
|
||||
msg.opts.emile.w = idata->opts.emile.w;
|
||||
msg.opts.emile.h = idata->opts.emile.h;
|
||||
msg.opts.emile.region = idata->opts.emile.region;
|
||||
msg.opts.emile.scale_down_by = idata->opts.emile.scale_down_by;
|
||||
msg.opts.emile.dpi = idata->opts.emile.dpi;
|
||||
msg.opts.emile.degree = idata->opts.emile.degree;
|
||||
msg.opts.emile.orientation = idata->opts.emile.orientation;
|
||||
|
||||
msg.shm.mmap_offset = cserve2_shm_map_offset_get(ientry->shm);
|
||||
msg.shm.image_offset = cserve2_shm_offset_get(ientry->shm);
|
||||
|
@ -798,9 +801,9 @@ _load_request_build(Image_Entry *ientry, int *bufsize)
|
|||
static inline Eina_Bool
|
||||
_scaling_needed(Image_Data *idata, Slave_Msg_Image_Loaded *resp)
|
||||
{
|
||||
return (((idata->opts.scale_load.dst_w) && (idata->opts.scale_load.dst_h)) &&
|
||||
((idata->opts.scale_load.dst_w != resp->w) ||
|
||||
(idata->opts.scale_load.dst_h != resp->h)));
|
||||
return (((idata->opts.emile.scale_load.dst_w) && (idata->opts.emile.scale_load.dst_h)) &&
|
||||
((idata->opts.emile.scale_load.dst_w != resp->w) ||
|
||||
(idata->opts.emile.scale_load.dst_h != resp->h)));
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -838,20 +841,20 @@ _scaling_do(Shm_Handle *scale_shm, Image_Data *idata, Image_Entry *original)
|
|||
|
||||
DBG("Scaling image ([%dx%d]:[%d,%d:%dx%d] --> [%d,%d:%dx%d])",
|
||||
orig_idata->w, orig_idata->h,
|
||||
idata->opts.scale_load.src_x, idata->opts.scale_load.src_y,
|
||||
idata->opts.scale_load.src_w, idata->opts.scale_load.src_h,
|
||||
idata->opts.emile.scale_load.src_x, idata->opts.emile.scale_load.src_y,
|
||||
idata->opts.emile.scale_load.src_w, idata->opts.emile.scale_load.src_h,
|
||||
0, 0,
|
||||
idata->opts.scale_load.dst_w, idata->opts.scale_load.dst_h);
|
||||
idata->opts.emile.scale_load.dst_w, idata->opts.emile.scale_load.dst_h);
|
||||
|
||||
idata->alpha = orig_idata->alpha;
|
||||
cserve2_rgba_image_scale_do(
|
||||
src_data, orig_idata->w, orig_idata->h,
|
||||
dst_data,
|
||||
idata->opts.scale_load.src_x, idata->opts.scale_load.src_y,
|
||||
idata->opts.scale_load.src_w, idata->opts.scale_load.src_h,
|
||||
idata->opts.emile.scale_load.src_x, idata->opts.emile.scale_load.src_y,
|
||||
idata->opts.emile.scale_load.src_w, idata->opts.emile.scale_load.src_h,
|
||||
0, 0,
|
||||
idata->opts.scale_load.dst_w, idata->opts.scale_load.dst_h,
|
||||
idata->alpha, idata->opts.scale_load.smooth);
|
||||
idata->opts.emile.scale_load.dst_w, idata->opts.emile.scale_load.dst_h,
|
||||
idata->alpha, idata->opts.emile.scale_load.smooth);
|
||||
|
||||
cserve2_shm_unmap(original->shm);
|
||||
cserve2_shm_unmap(scale_shm);
|
||||
|
@ -864,8 +867,8 @@ _scaling_prepare_and_do(Image_Entry *ientry, Image_Data *idata)
|
|||
{
|
||||
Shm_Handle *scale_shm;
|
||||
|
||||
scale_shm = cserve2_shm_request("img", idata->opts.scale_load.dst_w
|
||||
* idata->opts.scale_load.dst_h * 4);
|
||||
scale_shm = cserve2_shm_request("img", idata->opts.emile.scale_load.dst_w
|
||||
* idata->opts.emile.scale_load.dst_h * 4);
|
||||
|
||||
if (!scale_shm)
|
||||
return -1;
|
||||
|
@ -881,8 +884,8 @@ _scaling_prepare_and_do(Image_Entry *ientry, Image_Data *idata)
|
|||
cserve2_shared_string_del(idata->shm_id);
|
||||
ientry->shm = scale_shm;
|
||||
idata->shm_id = 0;
|
||||
idata->w = idata->opts.scale_load.dst_w;
|
||||
idata->h = idata->opts.scale_load.dst_h;
|
||||
idata->w = idata->opts.emile.scale_load.dst_w;
|
||||
idata->h = idata->opts.emile.scale_load.dst_h;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -938,14 +941,14 @@ _image_key_set(unsigned int file_id, const Evas_Image_Load_Opts *opts,
|
|||
|
||||
snprintf(buf, size,
|
||||
"%u:%0.3f:%dx%d:%d:%d,%d+%dx%d:!([%d,%d:%dx%d]-[%dx%d:%d]):%d:%d",
|
||||
file_id, opts->dpi, opts->w, opts->h,
|
||||
opts->scale_down_by, opts->region.x, opts->region.y,
|
||||
opts->region.w, opts->region.h,
|
||||
opts->scale_load.src_x, opts->scale_load.src_y,
|
||||
opts->scale_load.src_w, opts->scale_load.src_h,
|
||||
opts->scale_load.dst_w, opts->scale_load.dst_h,
|
||||
opts->scale_load.smooth, opts->degree,
|
||||
opts->orientation);
|
||||
file_id, opts->emile.dpi, opts->emile.w, opts->emile.h,
|
||||
opts->emile.scale_down_by, opts->emile.region.x, opts->emile.region.y,
|
||||
opts->emile.region.w, opts->emile.region.h,
|
||||
opts->emile.scale_load.src_x, opts->emile.scale_load.src_y,
|
||||
opts->emile.scale_load.src_w, opts->emile.scale_load.src_h,
|
||||
opts->emile.scale_load.dst_w, opts->emile.scale_load.dst_h,
|
||||
opts->emile.scale_load.smooth, opts->emile.degree,
|
||||
opts->emile.orientation);
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
|
@ -975,12 +978,12 @@ _evas_image_load_opts_empty(Evas_Image_Load_Opts *lo)
|
|||
{
|
||||
if (!lo) return EINA_TRUE;
|
||||
|
||||
return ((lo->scale_down_by == 0)
|
||||
&& (lo->dpi == 0.0)
|
||||
&& (lo->w == 0) && (lo->h == 0)
|
||||
&& (lo->region.x == 0) && (lo->region.y == 0)
|
||||
&& (lo->region.w == 0) && (lo->region.h == 0)
|
||||
&& (lo->orientation == 0));
|
||||
return ((lo->emile.scale_down_by == 0)
|
||||
&& (lo->emile.dpi == 0.0)
|
||||
&& (lo->emile.w == 0) && (lo->emile.h == 0)
|
||||
&& (lo->emile.region.x == 0) && (lo->emile.region.y == 0)
|
||||
&& (lo->emile.region.w == 0) && (lo->emile.region.h == 0)
|
||||
&& (lo->emile.orientation == 0));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -995,17 +998,17 @@ _file_hkey_get(char *buf, size_t sz, const char *path, const char *key,
|
|||
snprintf(buf, sz, "%s:%s", path, key);
|
||||
else
|
||||
{
|
||||
if (lo->orientation)
|
||||
if (lo->emile.orientation)
|
||||
{
|
||||
snprintf(buf, sz, "%s:%s//@/%d/%f/%dx%d/%d+%d.%dx%d",
|
||||
path, key, lo->scale_down_by, lo->dpi, lo->w, lo->h,
|
||||
lo->region.x, lo->region.y, lo->region.w, lo->region.h);
|
||||
path, key, lo->emile.scale_down_by, lo->emile.dpi, lo->emile.w, lo->emile.h,
|
||||
lo->emile.region.x, lo->emile.region.y, lo->emile.region.w, lo->emile.region.h);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(buf, sz, "%s:%s//@/%d/%f/%dx%d/%d+%d.%dx%d/o",
|
||||
path, key, lo->scale_down_by, lo->dpi, lo->w, lo->h,
|
||||
lo->region.x, lo->region.y, lo->region.w, lo->region.h);
|
||||
path, key, lo->emile.scale_down_by, lo->emile.dpi, lo->emile.w, lo->emile.h,
|
||||
lo->emile.region.x, lo->emile.region.y, lo->emile.region.w, lo->emile.region.h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1016,15 +1019,15 @@ _file_id_free(File_Data *fd)
|
|||
Evas_Image_Load_Opts lo = empty_lo;
|
||||
char buf[4096];
|
||||
|
||||
lo.region.x = fd->lo.region.x;
|
||||
lo.region.y = fd->lo.region.y;
|
||||
lo.region.w = fd->lo.region.w;
|
||||
lo.region.h = fd->lo.region.h;
|
||||
lo.dpi = fd->lo.dpi;
|
||||
lo.w = fd->lo.w;
|
||||
lo.h = fd->lo.h;
|
||||
lo.scale_down_by = fd->lo.scale_down_by;
|
||||
lo.orientation = fd->lo.orientation;
|
||||
lo.emile.region.x = fd->lo.region.x;
|
||||
lo.emile.region.y = fd->lo.region.y;
|
||||
lo.emile.region.w = fd->lo.region.w;
|
||||
lo.emile.region.h = fd->lo.region.h;
|
||||
lo.emile.dpi = fd->lo.dpi;
|
||||
lo.emile.w = fd->lo.w;
|
||||
lo.emile.h = fd->lo.h;
|
||||
lo.emile.scale_down_by = fd->lo.scale_down_by;
|
||||
lo.emile.orientation = fd->lo.orientation;
|
||||
|
||||
_file_hkey_get(buf, sizeof(buf), cserve2_shared_string_get(fd->path),
|
||||
cserve2_shared_string_get(fd->key), &lo);
|
||||
|
@ -1629,24 +1632,24 @@ _image_entry_new(Client *client, int rid,
|
|||
ientry->base.type = CSERVE2_IMAGE_DATA;
|
||||
if (opts)
|
||||
{
|
||||
idata->opts.dpi = opts->dpi;
|
||||
idata->opts.w = opts->w;
|
||||
idata->opts.h = opts->h;
|
||||
idata->opts.scale_down_by = opts->scale_down_by;
|
||||
idata->opts.region.x = opts->region.x;
|
||||
idata->opts.region.y = opts->region.y;
|
||||
idata->opts.region.w = opts->region.w;
|
||||
idata->opts.region.h = opts->region.h;
|
||||
idata->opts.scale_load.src_x = opts->scale_load.src_x;
|
||||
idata->opts.scale_load.src_y = opts->scale_load.src_y;
|
||||
idata->opts.scale_load.src_w = opts->scale_load.src_w;
|
||||
idata->opts.scale_load.src_h = opts->scale_load.src_h;
|
||||
idata->opts.scale_load.dst_w = opts->scale_load.dst_w;
|
||||
idata->opts.scale_load.dst_h = opts->scale_load.dst_h;
|
||||
idata->opts.scale_load.smooth = opts->scale_load.smooth;
|
||||
idata->opts.scale_load.scale_hint = opts->scale_load.scale_hint;
|
||||
idata->opts.degree = opts->degree;
|
||||
idata->opts.orientation = opts->orientation;
|
||||
idata->opts.emile.dpi = opts->emile.dpi;
|
||||
idata->opts.emile.w = opts->emile.w;
|
||||
idata->opts.emile.h = opts->emile.h;
|
||||
idata->opts.emile.scale_down_by = opts->emile.scale_down_by;
|
||||
idata->opts.emile.region.x = opts->emile.region.x;
|
||||
idata->opts.emile.region.y = opts->emile.region.y;
|
||||
idata->opts.emile.region.w = opts->emile.region.w;
|
||||
idata->opts.emile.region.h = opts->emile.region.h;
|
||||
idata->opts.emile.scale_load.src_x = opts->emile.scale_load.src_x;
|
||||
idata->opts.emile.scale_load.src_y = opts->emile.scale_load.src_y;
|
||||
idata->opts.emile.scale_load.src_w = opts->emile.scale_load.src_w;
|
||||
idata->opts.emile.scale_load.src_h = opts->emile.scale_load.src_h;
|
||||
idata->opts.emile.scale_load.dst_w = opts->emile.scale_load.dst_w;
|
||||
idata->opts.emile.scale_load.dst_h = opts->emile.scale_load.dst_h;
|
||||
idata->opts.emile.scale_load.smooth = opts->emile.scale_load.smooth;
|
||||
idata->opts.emile.scale_load.scale_hint = opts->emile.scale_load.scale_hint;
|
||||
idata->opts.emile.degree = opts->emile.degree;
|
||||
idata->opts.emile.orientation = opts->emile.orientation;
|
||||
}
|
||||
idata->valid = EINA_FALSE;
|
||||
idata->file_id = ref->entry->id;
|
||||
|
@ -2622,15 +2625,15 @@ cserve2_cache_file_open(Client *client, unsigned int client_file_id,
|
|||
fd->path = cserve2_shared_string_add(path);
|
||||
fd->key = cserve2_shared_string_add(key);
|
||||
if (!lo) lo = (Evas_Image_Load_Opts *) &empty_lo;
|
||||
fd->lo.region.x = lo->region.x;
|
||||
fd->lo.region.y = lo->region.y;
|
||||
fd->lo.region.w = lo->region.w;
|
||||
fd->lo.region.h = lo->region.h;
|
||||
fd->lo.dpi = lo->dpi;
|
||||
fd->lo.w = lo->w;
|
||||
fd->lo.h = lo->h;
|
||||
fd->lo.scale_down_by = lo->scale_down_by;
|
||||
fd->lo.orientation = lo->orientation;
|
||||
fd->lo.region.x = lo->emile.region.x;
|
||||
fd->lo.region.y = lo->emile.region.y;
|
||||
fd->lo.region.w = lo->emile.region.w;
|
||||
fd->lo.region.h = lo->emile.region.h;
|
||||
fd->lo.dpi = lo->emile.dpi;
|
||||
fd->lo.w = lo->emile.w;
|
||||
fd->lo.h = lo->emile.h;
|
||||
fd->lo.scale_down_by = lo->emile.scale_down_by;
|
||||
fd->lo.orientation = lo->emile.orientation;
|
||||
fd->refcount = 1;
|
||||
fd->id = file_id;
|
||||
|
||||
|
@ -2698,23 +2701,23 @@ _cserve2_cache_fast_scaling_check(Client *client, Image_Entry *ientry,
|
|||
idata = _image_data_find(ENTRYID(ientry));
|
||||
if (!idata) return -1;
|
||||
|
||||
dst_w = idata->opts.scale_load.dst_w;
|
||||
dst_h = idata->opts.scale_load.dst_h;
|
||||
dst_w = idata->opts.emile.scale_load.dst_w;
|
||||
dst_h = idata->opts.emile.scale_load.dst_h;
|
||||
|
||||
// Copy opts w/o scaling
|
||||
memset(&unscaled, 0, sizeof(unscaled));
|
||||
unscaled.dpi = idata->opts.dpi;
|
||||
unscaled.w = idata->opts.w;
|
||||
unscaled.h = idata->opts.h;
|
||||
unscaled.scale_down_by = idata->opts.scale_down_by;
|
||||
unscaled.region.x = idata->opts.region.x;
|
||||
unscaled.region.y = idata->opts.region.y;
|
||||
unscaled.region.w = idata->opts.region.w;
|
||||
unscaled.region.h = idata->opts.region.h;
|
||||
unscaled.scale_load.scale_hint = 0;
|
||||
unscaled.degree = idata->opts.degree;
|
||||
unscaled.orientation = idata->opts.orientation;
|
||||
unscaled.scale_load.smooth = idata->opts.scale_load.smooth;
|
||||
unscaled.emile.dpi = idata->opts.emile.dpi;
|
||||
unscaled.emile.w = idata->opts.emile.w;
|
||||
unscaled.emile.h = idata->opts.emile.h;
|
||||
unscaled.emile.scale_down_by = idata->opts.emile.scale_down_by;
|
||||
unscaled.emile.region.x = idata->opts.emile.region.x;
|
||||
unscaled.emile.region.y = idata->opts.emile.region.y;
|
||||
unscaled.emile.region.w = idata->opts.emile.region.w;
|
||||
unscaled.emile.region.h = idata->opts.emile.region.h;
|
||||
unscaled.emile.scale_load.scale_hint = 0;
|
||||
unscaled.emile.degree = idata->opts.emile.degree;
|
||||
unscaled.emile.orientation = idata->opts.emile.orientation;
|
||||
unscaled.emile.scale_load.smooth = idata->opts.emile.scale_load.smooth;
|
||||
|
||||
try_again:
|
||||
image_id = _image_opts_id_get(idata->file_id, &unscaled, buf, sizeof(buf));
|
||||
|
@ -2725,17 +2728,17 @@ try_again:
|
|||
if (!orig_data || !orig_entry) return -1;
|
||||
|
||||
DBG("Found original image in hash: %d,%d:%dx%d -> %dx%d shm %p",
|
||||
orig_data->opts.scale_load.src_x, orig_data->opts.scale_load.src_y,
|
||||
orig_data->opts.scale_load.src_w, orig_data->opts.scale_load.src_h,
|
||||
orig_data->opts.scale_load.dst_w, orig_data->opts.scale_load.dst_h,
|
||||
orig_data->opts.emile.scale_load.src_x, orig_data->opts.emile.scale_load.src_y,
|
||||
orig_data->opts.emile.scale_load.src_w, orig_data->opts.emile.scale_load.src_h,
|
||||
orig_data->opts.emile.scale_load.dst_w, orig_data->opts.emile.scale_load.dst_h,
|
||||
orig_entry->shm);
|
||||
goto do_scaling;
|
||||
}
|
||||
|
||||
if (first_attempt && unscaled.scale_load.smooth)
|
||||
if (first_attempt && unscaled.emile.scale_load.smooth)
|
||||
{
|
||||
first_attempt = EINA_FALSE;
|
||||
unscaled.scale_load.smooth = 0;
|
||||
unscaled.emile.scale_load.smooth = 0;
|
||||
goto try_again;
|
||||
}
|
||||
|
||||
|
@ -2749,14 +2752,14 @@ try_again:
|
|||
id = _image_data_find(ENTRYID(i));
|
||||
if (!id) continue;
|
||||
|
||||
if (id->opts.w && id->opts.h &&
|
||||
(!id->opts.scale_load.dst_w &&
|
||||
!id->opts.scale_load.dst_h))
|
||||
if (id->opts.emile.w && id->opts.emile.h &&
|
||||
(!id->opts.emile.scale_load.dst_w &&
|
||||
!id->opts.emile.scale_load.dst_h))
|
||||
{
|
||||
DBG("Found image in list: %d,%d:%dx%d -> %dx%d shm %p",
|
||||
id->opts.scale_load.src_x, id->opts.scale_load.src_y,
|
||||
id->opts.scale_load.src_w, id->opts.scale_load.src_h,
|
||||
id->opts.scale_load.dst_w, id->opts.scale_load.dst_h,
|
||||
id->opts.emile.scale_load.src_x, id->opts.emile.scale_load.src_y,
|
||||
id->opts.emile.scale_load.src_w, id->opts.emile.scale_load.src_h,
|
||||
id->opts.emile.scale_load.dst_w, id->opts.emile.scale_load.dst_h,
|
||||
i->shm);
|
||||
if (i->base.request || !i->shm) continue; // Not loaded yet
|
||||
orig_entry = i;
|
||||
|
@ -2905,7 +2908,7 @@ cserve2_cache_image_entry_create(Client *client, int rid,
|
|||
return -1;
|
||||
fentry->images = eina_list_append(fentry->images, ientry);
|
||||
|
||||
if (opts && opts->scale_load.dst_w && opts->scale_load.dst_h)
|
||||
if (opts && opts->emile.scale_load.dst_w && opts->emile.scale_load.dst_h)
|
||||
{
|
||||
if (!_cserve2_cache_fast_scaling_check(client, ientry, client_file_id))
|
||||
return 0;
|
||||
|
|
|
@ -165,21 +165,21 @@ _cserve2_client_open(Client *client)
|
|||
// FIXME: Check message size first?
|
||||
|
||||
DBG("Load Options:");
|
||||
DBG("\tdpi: %03.1f", opts->dpi);
|
||||
DBG("\tsize: %dx%d", opts->w, opts->h);
|
||||
DBG("\tscale down: %d", opts->scale_down_by);
|
||||
DBG("\tdpi: %03.1f", opts->emile.dpi);
|
||||
DBG("\tsize: %dx%d", opts->emile.w, opts->emile.h);
|
||||
DBG("\tscale down: %d", opts->emile.scale_down_by);
|
||||
DBG("\tregion: %d,%d + %dx%d",
|
||||
opts->region.x, opts->region.y, opts->region.w, opts->region.h);
|
||||
opts->emile.region.x, opts->emile.region.y, opts->emile.region.w, opts->emile.region.h);
|
||||
DBG("\toriginal image's source coord: %d,%d",
|
||||
opts->scale_load.src_x, opts->scale_load.src_y);
|
||||
opts->emile.scale_load.src_x, opts->emile.scale_load.src_y);
|
||||
DBG("\toriginal image size: %dx%d",
|
||||
opts->scale_load.src_w, opts->scale_load.src_h);
|
||||
opts->emile.scale_load.src_w, opts->emile.scale_load.src_h);
|
||||
DBG("\tscale size: %dx%d",
|
||||
opts->scale_load.dst_w, opts->scale_load.dst_h);
|
||||
DBG("\tscale smooth: %d", opts->scale_load.smooth);
|
||||
DBG("\tscale hint: %d", opts->scale_load.scale_hint);
|
||||
DBG("\tdegree: %d", opts->degree);
|
||||
DBG("\torientation: %d", opts->orientation);
|
||||
opts->emile.scale_load.dst_w, opts->emile.scale_load.dst_h);
|
||||
DBG("\tscale smooth: %d", opts->emile.scale_load.smooth);
|
||||
DBG("\tscale hint: %d", opts->emile.scale_load.scale_hint);
|
||||
DBG("\tdegree: %d", opts->emile.degree);
|
||||
DBG("\torientation: %d", opts->emile.orientation);
|
||||
|
||||
cserve2_cache_image_entry_create(client, msg->base.rid,
|
||||
msg->file_id, msg->image_id,
|
||||
|
|
|
@ -515,20 +515,20 @@ _images_all_print_full(void)
|
|||
id->valid ? "YES" : "NO");
|
||||
printf("Shm Path: '%s'\n",
|
||||
id->shm_id ? _shared_string_get(id->shm_id) : "");
|
||||
printf("LoadOpts: width %d\n", id->opts.w);
|
||||
printf(" height %d\n", id->opts.h);
|
||||
printf(" degree %d\n", id->opts.degree);
|
||||
printf(" scale_down_by %d\n", id->opts.scale_down_by);
|
||||
if (!EINA_DBL_CMP(id->opts.dpi, 0.0))
|
||||
printf(" dpi %.2f\n", id->opts.dpi);
|
||||
printf("LoadOpts: width %d\n", id->opts.emile.w);
|
||||
printf(" height %d\n", id->opts.emile.h);
|
||||
printf(" degree %d\n", id->opts.emile.degree);
|
||||
printf(" scale_down_by %d\n", id->opts.emile.scale_down_by);
|
||||
if (!EINA_DBL_CMP(id->opts.emile.dpi, 0.0))
|
||||
printf(" dpi %.2f\n", id->opts.emile.dpi);
|
||||
else
|
||||
printf(" dpi 0\n");
|
||||
printf(" orientation %s\n", id->opts.orientation ? "YES" : "NO");
|
||||
printf(" orientation %s\n", id->opts.emile.orientation ? "YES" : "NO");
|
||||
printf(" region (%d,%d) %dx%d\n",
|
||||
id->opts.region.x, id->opts.region.y,
|
||||
id->opts.region.w, id->opts.region.h);
|
||||
id->opts.emile.region.x, id->opts.emile.region.y,
|
||||
id->opts.emile.region.w, id->opts.emile.region.h);
|
||||
|
||||
switch (id->opts.scale_load.scale_hint)
|
||||
switch (id->opts.emile.scale_load.scale_hint)
|
||||
{
|
||||
case EVAS_IMAGE_SCALE_HINT_NONE:
|
||||
scale_hint = "EVAS_IMAGE_SCALE_HINT_NONE"; break;
|
||||
|
@ -541,14 +541,14 @@ _images_all_print_full(void)
|
|||
}
|
||||
|
||||
printf(" scale src (%d,%d) %dx%d\n",
|
||||
id->opts.scale_load.src_x, id->opts.scale_load.src_y,
|
||||
id->opts.scale_load.src_w, id->opts.scale_load.src_h);
|
||||
id->opts.emile.scale_load.src_x, id->opts.emile.scale_load.src_y,
|
||||
id->opts.emile.scale_load.src_w, id->opts.emile.scale_load.src_h);
|
||||
printf(" scale dst %dx%d\n",
|
||||
id->opts.scale_load.dst_w, id->opts.scale_load.dst_h);
|
||||
id->opts.emile.scale_load.dst_w, id->opts.emile.scale_load.dst_h);
|
||||
printf(" scale smooth %s\n",
|
||||
id->opts.scale_load.smooth ? "YES" : "NO");
|
||||
id->opts.emile.scale_load.smooth ? "YES" : "NO");
|
||||
printf(" scale hint %s (%d)\n",
|
||||
scale_hint, id->opts.scale_load.scale_hint);
|
||||
scale_hint, id->opts.emile.scale_load.scale_hint);
|
||||
|
||||
fd = (File_Data *)
|
||||
_shared_index_item_get_by_id(sf_files, sizeof(*fd), id->file_id);
|
||||
|
|
|
@ -475,8 +475,8 @@ image_load(const char *file, const char *key, const char *shmfile,
|
|||
}
|
||||
|
||||
memset(&property, 0, sizeof (property));
|
||||
property.w = params->opts.w; // Should we rather use params->w ?
|
||||
property.h = params->opts.h;
|
||||
property.w = params->opts.emile.w; // Should we rather use params->w ?
|
||||
property.h = params->opts.emile.h;
|
||||
|
||||
skey = eina_stringshare_add(key);
|
||||
loader_data = _image_file_open(fd, skey, opts, module, &property, &animated, &funcs);
|
||||
|
@ -544,15 +544,15 @@ handle_image_open(int wfd, void *params)
|
|||
size_t resp_size;
|
||||
|
||||
memset(&load_opts, 0, sizeof(load_opts));
|
||||
load_opts.region.x = msg->lo.region.x;
|
||||
load_opts.region.y = msg->lo.region.y;
|
||||
load_opts.region.w = msg->lo.region.w;
|
||||
load_opts.region.h = msg->lo.region.h;
|
||||
load_opts.dpi = msg->lo.dpi;
|
||||
load_opts.w = msg->lo.w;
|
||||
load_opts.h = msg->lo.h;
|
||||
load_opts.scale_down_by = msg->lo.scale_down_by;
|
||||
load_opts.orientation = msg->lo.orientation;
|
||||
load_opts.emile.region.x = msg->lo.region.x;
|
||||
load_opts.emile.region.y = msg->lo.region.y;
|
||||
load_opts.emile.region.w = msg->lo.region.w;
|
||||
load_opts.emile.region.h = msg->lo.region.h;
|
||||
load_opts.emile.dpi = msg->lo.dpi;
|
||||
load_opts.emile.w = msg->lo.w;
|
||||
load_opts.emile.h = msg->lo.h;
|
||||
load_opts.emile.scale_down_by = msg->lo.scale_down_by;
|
||||
load_opts.emile.orientation = msg->lo.orientation;
|
||||
|
||||
file = (const char *) (msg + 1);
|
||||
key = file + strlen(file) + 1;
|
||||
|
|
|
@ -182,6 +182,21 @@ interface Efl.Image.Load ()
|
|||
]]
|
||||
}
|
||||
}
|
||||
@property load_skip_header {
|
||||
[[Initial load should skip header check and leave it all to data load
|
||||
|
||||
If this is true, then future loads of images will defer header
|
||||
loading to a preload stage and/or data load later on rather than
|
||||
at the start when the load begins (e.g. when file is set).
|
||||
]]
|
||||
set {
|
||||
[[Set the skip header state for susbsequent loads of a file. ]]
|
||||
}
|
||||
get {}
|
||||
values {
|
||||
skip: bool; [[Will be true if header is to be skipped. ]]
|
||||
}
|
||||
}
|
||||
}
|
||||
events {
|
||||
load,done; [[Called when he image was loaded]]
|
||||
|
|
|
@ -4067,6 +4067,31 @@ EAPI void evas_object_image_load_scale_down_set(Evas_Object *obj, int scale_down
|
|||
*/
|
||||
EAPI int evas_object_image_load_scale_down_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* @brief Set a load option to skip initial header load and defer to preload
|
||||
*
|
||||
* This is meant to be used in conjunction with evas_object_image_file_set()
|
||||
* and evas_object_image_preload() by deferring any header loading until
|
||||
* a evas_object_image_preload() is issued making the file file set simply
|
||||
* set up the file to refer to without any validation of its type or
|
||||
* file existence or even inspecting the image header to get size or alpha
|
||||
* channel flags etc. All of this will then be done as part of the preload
|
||||
* stage.
|
||||
*
|
||||
* @since 1.19
|
||||
*/
|
||||
EAPI void evas_object_image_load_head_skip_set(Evas_Object *obj, Eina_Bool skip);
|
||||
|
||||
/**
|
||||
* @breif Get the load option to skip header loads before preload
|
||||
*
|
||||
* This gets the heade skip value set by evas_object_image_load_head_skip_set()
|
||||
*
|
||||
* @see evas_object_image_load_head_skip_set
|
||||
* @since 1.19
|
||||
*/
|
||||
EAPI Eina_Bool evas_object_image_load_head_skip_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* @brief Retrieves a number representing any error that occurred during the
|
||||
* last loading of the given image object's source image.
|
||||
|
|
|
@ -119,7 +119,16 @@ struct _Evas_Module
|
|||
unsigned char loaded : 1;
|
||||
};
|
||||
|
||||
typedef Emile_Image_Load_Opts Evas_Image_Load_Opts;
|
||||
typedef struct _Evas_Image_Load_Opts Evas_Image_Load_Opts;
|
||||
|
||||
struct _Evas_Image_Load_Opts
|
||||
{
|
||||
Emile_Image_Load_Opts emile;
|
||||
Eina_Bool skip_head; // skip open of file and header load and
|
||||
// defer this until a preload is done
|
||||
// to allow for real async/threaded load
|
||||
};
|
||||
|
||||
typedef Emile_Image_Animated Evas_Image_Animated;
|
||||
typedef Emile_Image_Property Evas_Image_Property;
|
||||
|
||||
|
|
|
@ -281,7 +281,10 @@ _evas_cache_image_entry_new(Evas_Cache_Image *cache,
|
|||
SLKI(ie->lock_cancel);
|
||||
SLKI(ie->lock_task);
|
||||
|
||||
if (lo) ie->load_opts = *lo;
|
||||
if (lo)
|
||||
{
|
||||
ie->load_opts = *lo;
|
||||
}
|
||||
if (ie->file || ie->f)
|
||||
{
|
||||
*error = cache->func.constructor(ie);
|
||||
|
@ -417,10 +420,20 @@ _evas_cache_image_async_end(void *data)
|
|||
|
||||
while ((tmp = ie->targets))
|
||||
{
|
||||
evas_object_inform_call_image_preloaded((Evas_Object*) tmp->target);
|
||||
ie->targets = (Evas_Cache_Target *)
|
||||
eina_inlist_remove(EINA_INLIST_GET(ie->targets),
|
||||
EINA_INLIST_GET(ie->targets));
|
||||
eina_inlist_remove(EINA_INLIST_GET(ie->targets),
|
||||
EINA_INLIST_GET(ie->targets));
|
||||
if (tmp->simple_cb)
|
||||
{
|
||||
if (!tmp->delete_me)
|
||||
{
|
||||
tmp->simple_cb(tmp->simple_data);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
evas_object_inform_call_image_preloaded((Evas_Object*) tmp->target);
|
||||
}
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
|
@ -460,14 +473,14 @@ _evas_cache_image_async_cancel(void *data)
|
|||
// entry. make sure you only add once, or remove first, then add
|
||||
static int
|
||||
_evas_cache_image_entry_preload_add(Image_Entry *ie, const Eo *target,
|
||||
Evas_Engine_Thread_Task_Cb func, const void *engine_data, const void *custom_data)
|
||||
Evas_Engine_Thread_Task_Cb func, const void *engine_data, const void *custom_data)
|
||||
{
|
||||
Evas_Cache_Target *tg;
|
||||
Image_Entry_Task *task;
|
||||
|
||||
if (ie->flags.preload_done) return 0;
|
||||
|
||||
tg = malloc(sizeof (Evas_Cache_Target));
|
||||
tg = calloc(1, sizeof(Evas_Cache_Target));
|
||||
if (!tg) return 0;
|
||||
tg->target = target;
|
||||
|
||||
|
@ -688,19 +701,22 @@ evas_cache_image_shutdown(Evas_Cache_Image *cache)
|
|||
}
|
||||
|
||||
static const Evas_Image_Load_Opts prevent = {
|
||||
{ 0, 0, 0, 0 },
|
||||
{
|
||||
0, 0, 0, 0,
|
||||
0, 0,
|
||||
0,
|
||||
0
|
||||
},
|
||||
0.0,
|
||||
0, 0,
|
||||
0,
|
||||
0,
|
||||
{
|
||||
{ 0, 0, 0, 0 },
|
||||
{
|
||||
0, 0, 0, 0,
|
||||
0, 0,
|
||||
0,
|
||||
0
|
||||
},
|
||||
0.0,
|
||||
0, 0,
|
||||
0,
|
||||
0,
|
||||
|
||||
EINA_FALSE
|
||||
EINA_FALSE
|
||||
},
|
||||
EINA_FALSE
|
||||
};
|
||||
|
||||
static size_t
|
||||
|
@ -711,11 +727,11 @@ _evas_cache_image_loadopts_append(char *hkey, Evas_Image_Load_Opts **plo)
|
|||
|
||||
if ((!lo) ||
|
||||
(lo &&
|
||||
(lo->scale_down_by == 0) &&
|
||||
(EINA_DBL_CMP(lo->dpi, 0.0)) &&
|
||||
((lo->w == 0) || (lo->h == 0)) &&
|
||||
((lo->region.w == 0) || (lo->region.h == 0)) &&
|
||||
(lo->orientation == 0)
|
||||
(lo->emile.scale_down_by == 0) &&
|
||||
(EINA_DBL_CMP(lo->emile.dpi, 0.0)) &&
|
||||
((lo->emile.w == 0) || (lo->emile.h == 0)) &&
|
||||
((lo->emile.region.w == 0) || (lo->emile.region.h == 0)) &&
|
||||
(lo->emile.orientation == 0)
|
||||
))
|
||||
{
|
||||
*plo = (Evas_Image_Load_Opts*) &prevent;
|
||||
|
@ -724,30 +740,30 @@ _evas_cache_image_loadopts_append(char *hkey, Evas_Image_Load_Opts **plo)
|
|||
{
|
||||
memcpy(hkey, "//@/", 4);
|
||||
offset += 4;
|
||||
offset += eina_convert_xtoa(lo->scale_down_by, hkey + offset);
|
||||
offset += eina_convert_xtoa(lo->emile.scale_down_by, hkey + offset);
|
||||
hkey[offset] = '/';
|
||||
offset += 1;
|
||||
offset += eina_convert_dtoa(lo->dpi, hkey + offset);
|
||||
offset += eina_convert_dtoa(lo->emile.dpi, hkey + offset);
|
||||
hkey[offset] = '/';
|
||||
offset += 1;
|
||||
offset += eina_convert_xtoa(lo->w, hkey + offset);
|
||||
offset += eina_convert_xtoa(lo->emile.w, hkey + offset);
|
||||
hkey[offset] = 'x';
|
||||
offset += 1;
|
||||
offset += eina_convert_xtoa(lo->h, hkey + offset);
|
||||
offset += eina_convert_xtoa(lo->emile.h, hkey + offset);
|
||||
hkey[offset] = '/';
|
||||
offset += 1;
|
||||
offset += eina_convert_xtoa(lo->region.x, hkey + offset);
|
||||
offset += eina_convert_xtoa(lo->emile.region.x, hkey + offset);
|
||||
hkey[offset] = '+';
|
||||
offset += 1;
|
||||
offset += eina_convert_xtoa(lo->region.y, hkey + offset);
|
||||
offset += eina_convert_xtoa(lo->emile.region.y, hkey + offset);
|
||||
hkey[offset] = '.';
|
||||
offset += 1;
|
||||
offset += eina_convert_xtoa(lo->region.w, hkey + offset);
|
||||
offset += eina_convert_xtoa(lo->emile.region.w, hkey + offset);
|
||||
hkey[offset] = 'x';
|
||||
offset += 1;
|
||||
offset += eina_convert_xtoa(lo->region.h, hkey + offset);
|
||||
offset += eina_convert_xtoa(lo->emile.region.h, hkey + offset);
|
||||
|
||||
if (lo->orientation)
|
||||
if (lo->emile.orientation)
|
||||
{
|
||||
hkey[offset] = '/';
|
||||
offset += 1;
|
||||
|
@ -839,6 +855,8 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
|
|||
size_t key_length;
|
||||
struct stat st;
|
||||
Image_Timestamp tstamp;
|
||||
Eina_Bool skip = lo->skip_head;
|
||||
Evas_Image_Load_Opts tlo;
|
||||
|
||||
if (!file)
|
||||
{
|
||||
|
@ -859,6 +877,8 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
|
|||
memcpy(hkey + size, ckey, key_length);
|
||||
size += key_length;
|
||||
size += _evas_cache_image_loadopts_append(hkey + size, &lo);
|
||||
tlo = *lo;
|
||||
tlo.skip_head = skip;
|
||||
|
||||
/* find image by key in active hash */
|
||||
im = eina_hash_find(cache->activ, hkey);
|
||||
|
@ -867,12 +887,15 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
|
|||
int ok = 1;
|
||||
|
||||
stat_done = 1;
|
||||
if (stat(file, &st) < 0)
|
||||
if (!skip)
|
||||
{
|
||||
stat_failed = 1;
|
||||
ok = 0;
|
||||
if (stat(file, &st) < 0)
|
||||
{
|
||||
stat_failed = 1;
|
||||
ok = 0;
|
||||
}
|
||||
else if (!_timestamp_compare(&(im->tstamp), &st)) ok = 0;
|
||||
}
|
||||
else if (!_timestamp_compare(&(im->tstamp), &st)) ok = 0;
|
||||
if (ok) goto on_ok;
|
||||
/* image we found doesn't match what's on disk (stat info wise)
|
||||
* so dirty the active cache entry so we never find it again. this
|
||||
|
@ -889,17 +912,20 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
|
|||
{
|
||||
int ok = 1;
|
||||
|
||||
if (!stat_done)
|
||||
if (!skip)
|
||||
{
|
||||
stat_done = 1;
|
||||
if (stat(file, &st) < 0)
|
||||
if (!stat_done)
|
||||
{
|
||||
stat_failed = 1;
|
||||
ok = 0;
|
||||
stat_done = 1;
|
||||
if (stat(file, &st) < 0)
|
||||
{
|
||||
stat_failed = 1;
|
||||
ok = 0;
|
||||
}
|
||||
else if (!_timestamp_compare(&(im->tstamp), &st)) ok = 0;
|
||||
}
|
||||
else if (!_timestamp_compare(&(im->tstamp), &st)) ok = 0;
|
||||
}
|
||||
else if (!_timestamp_compare(&(im->tstamp), &st)) ok = 0;
|
||||
|
||||
if (ok)
|
||||
{
|
||||
|
@ -916,13 +942,21 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file,
|
|||
}
|
||||
if (stat_failed) goto on_stat_error;
|
||||
|
||||
if (!stat_done)
|
||||
if (!skip)
|
||||
{
|
||||
if (stat(file, &st) < 0) goto on_stat_error;
|
||||
if (!stat_done)
|
||||
{
|
||||
if (stat(file, &st) < 0) goto on_stat_error;
|
||||
}
|
||||
_timestamp_build(&tstamp, &st);
|
||||
im = _evas_cache_image_entry_new(cache, hkey, &tstamp, NULL,
|
||||
file, key, &tlo, error);
|
||||
}
|
||||
else
|
||||
{
|
||||
im = _evas_cache_image_entry_new(cache, hkey, NULL, NULL,
|
||||
file, key, &tlo, error);
|
||||
}
|
||||
_timestamp_build(&tstamp, &st);
|
||||
im = _evas_cache_image_entry_new(cache, hkey, &tstamp, NULL, file, key,
|
||||
lo, error);
|
||||
if (!im) goto on_stat_error;
|
||||
if (cache->func.debug) cache->func.debug("request", im);
|
||||
|
||||
|
|
|
@ -311,9 +311,22 @@ _evas_cache2_image_preloaded_cb(void *data, Eina_Bool success)
|
|||
{
|
||||
ie->targets = (Evas_Cache_Target *)
|
||||
eina_inlist_remove(EINA_INLIST_GET(ie->targets),
|
||||
EINA_INLIST_GET(ie->targets));
|
||||
EINA_INLIST_GET(ie->targets));
|
||||
if (!ie->flags.delete_me)
|
||||
evas_object_inform_call_image_preloaded((Evas_Object *) tmp->target);
|
||||
{
|
||||
if (tmp->simple_cb)
|
||||
{
|
||||
if (!tmp->delete_me)
|
||||
{
|
||||
tmp->simple_cb(tmp->simple_data);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
evas_object_inform_call_image_preloaded
|
||||
((Evas_Object *)tmp->target);
|
||||
}
|
||||
}
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
|
@ -329,7 +342,7 @@ _evas_cache2_image_entry_preload_add(Image_Entry *ie, const void *target)
|
|||
if (ie->flags.preload_done)
|
||||
return EINA_FALSE;
|
||||
|
||||
tg = malloc(sizeof(Evas_Cache_Target));
|
||||
tg = calloc(1, sizeof(Evas_Cache_Target));
|
||||
if (!tg)
|
||||
return EINA_TRUE;
|
||||
|
||||
|
@ -580,62 +593,62 @@ evas_cache2_image_cache_key_create(char *hkey, const char *path, size_t pathlen,
|
|||
{
|
||||
memcpy(hkey + size, "//@/", 4);
|
||||
size += 4;
|
||||
size += eina_convert_xtoa(lo->scale_down_by, hkey + size);
|
||||
size += eina_convert_xtoa(lo->emile.scale_down_by, hkey + size);
|
||||
hkey[size] = '/';
|
||||
size += 1;
|
||||
size += eina_convert_dtoa(lo->dpi, hkey + size);
|
||||
size += eina_convert_dtoa(lo->emile.dpi, hkey + size);
|
||||
hkey[size] = '/';
|
||||
size += 1;
|
||||
size += eina_convert_xtoa(lo->w, hkey + size);
|
||||
size += eina_convert_xtoa(lo->emile.w, hkey + size);
|
||||
hkey[size] = 'x';
|
||||
size += 1;
|
||||
size += eina_convert_xtoa(lo->h, hkey + size);
|
||||
size += eina_convert_xtoa(lo->emile.h, hkey + size);
|
||||
hkey[size] = '/';
|
||||
size += 1;
|
||||
size += eina_convert_xtoa(lo->region.x, hkey + size);
|
||||
size += eina_convert_xtoa(lo->emile.region.x, hkey + size);
|
||||
hkey[size] = '+';
|
||||
size += 1;
|
||||
size += eina_convert_xtoa(lo->region.y, hkey + size);
|
||||
size += eina_convert_xtoa(lo->emile.region.y, hkey + size);
|
||||
hkey[size] = '.';
|
||||
size += 1;
|
||||
size += eina_convert_xtoa(lo->region.w, hkey + size);
|
||||
size += eina_convert_xtoa(lo->emile.region.w, hkey + size);
|
||||
hkey[size] = 'x';
|
||||
size += 1;
|
||||
|
||||
size += eina_convert_xtoa(lo->region.h, hkey + size);
|
||||
size += eina_convert_xtoa(lo->emile.region.h, hkey + size);
|
||||
hkey[size++] = '!';
|
||||
hkey[size++] = '(';
|
||||
|
||||
hkey[size] = '[';
|
||||
size += 1;
|
||||
size += eina_convert_xtoa(lo->scale_load.src_x, hkey + size);
|
||||
size += eina_convert_xtoa(lo->emile.scale_load.src_x, hkey + size);
|
||||
hkey[size] = ',';
|
||||
size += 1;
|
||||
size += eina_convert_xtoa(lo->scale_load.src_y, hkey + size);
|
||||
size += eina_convert_xtoa(lo->emile.scale_load.src_y, hkey + size);
|
||||
hkey[size] = ':';
|
||||
size += 1;
|
||||
size += eina_convert_xtoa(lo->scale_load.src_w, hkey + size);
|
||||
size += eina_convert_xtoa(lo->emile.scale_load.src_w, hkey + size);
|
||||
hkey[size] = 'x';
|
||||
size += 1;
|
||||
size += eina_convert_xtoa(lo->scale_load.src_h, hkey + size);
|
||||
size += eina_convert_xtoa(lo->emile.scale_load.src_h, hkey + size);
|
||||
hkey[size++] = ']';
|
||||
|
||||
hkey[size++] = '-';
|
||||
|
||||
hkey[size] = '[';
|
||||
size += 1;
|
||||
size += eina_convert_xtoa(lo->scale_load.dst_w, hkey + size);
|
||||
size += eina_convert_xtoa(lo->emile.scale_load.dst_w, hkey + size);
|
||||
hkey[size] = 'x';
|
||||
size += 1;
|
||||
size += eina_convert_xtoa(lo->scale_load.dst_h, hkey + size);
|
||||
size += eina_convert_xtoa(lo->emile.scale_load.dst_h, hkey + size);
|
||||
hkey[size] = ':';
|
||||
size += 1;
|
||||
size += eina_convert_xtoa(lo->scale_load.smooth, hkey + size);
|
||||
size += eina_convert_xtoa(lo->emile.scale_load.smooth, hkey + size);
|
||||
hkey[size++] = ']';
|
||||
|
||||
hkey[size++] = ')';
|
||||
|
||||
if (lo->orientation)
|
||||
if (lo->emile.orientation)
|
||||
{
|
||||
hkey[size] = '/';
|
||||
size += 1;
|
||||
|
@ -679,12 +692,12 @@ evas_cache2_image_open(Evas_Cache2 *cache, const char *path, const char *key,
|
|||
/* use local var to copy default load options to the image entry */
|
||||
if ((!lo) ||
|
||||
(lo &&
|
||||
(lo->scale_down_by == 0) &&
|
||||
(EINA_DBL_CMP(lo->dpi, 0.0)) &&
|
||||
((lo->w == 0) || (lo->h == 0)) &&
|
||||
((lo->region.w == 0) || (lo->region.h == 0)) &&
|
||||
((lo->scale_load.dst_w == 0) || (lo->scale_load.dst_h == 0)) &&
|
||||
(lo->orientation == 0)
|
||||
(lo->emile.scale_down_by == 0) &&
|
||||
(EINA_DBL_CMP(lo->emile.dpi, 0.0)) &&
|
||||
((lo->emile.w == 0) || (lo->emile.h == 0)) &&
|
||||
((lo->emile.region.w == 0) || (lo->emile.region.h == 0)) &&
|
||||
((lo->emile.scale_load.dst_w == 0) || (lo->emile.scale_load.dst_h == 0)) &&
|
||||
(lo->emile.orientation == 0)
|
||||
))
|
||||
{
|
||||
lo = &prevent;
|
||||
|
@ -819,17 +832,17 @@ _scaled_image_find(Image_Entry *im, int src_x, int src_y, int src_w,
|
|||
hkey = alloca(sizeof(char) * size);
|
||||
|
||||
memcpy(&lo, &im->load_opts, sizeof lo);
|
||||
lo.scale_load.src_x = src_x;
|
||||
lo.scale_load.src_y = src_y;
|
||||
lo.scale_load.src_w = src_w;
|
||||
lo.scale_load.src_h = src_h;
|
||||
lo.scale_load.dst_w = dst_w;
|
||||
lo.scale_load.dst_h = dst_h;
|
||||
lo.scale_load.smooth = smooth;
|
||||
lo.emile.scale_load.src_x = src_x;
|
||||
lo.emile.scale_load.src_y = src_y;
|
||||
lo.emile.scale_load.src_w = src_w;
|
||||
lo.emile.scale_load.src_h = src_h;
|
||||
lo.emile.scale_load.dst_w = dst_w;
|
||||
lo.emile.scale_load.dst_h = dst_h;
|
||||
lo.emile.scale_load.smooth = smooth;
|
||||
|
||||
if (!smooth)
|
||||
{
|
||||
lo.scale_load.smooth = 1;
|
||||
lo.emile.scale_load.smooth = 1;
|
||||
evas_cache2_image_cache_key_create(hkey, im->file, pathlen,
|
||||
im->key, keylen, &lo);
|
||||
|
||||
|
@ -839,7 +852,7 @@ _scaled_image_find(Image_Entry *im, int src_x, int src_y, int src_w,
|
|||
ret = eina_hash_find(im->cache2->inactiv, hkey);
|
||||
if (ret) goto handle_inactiv;
|
||||
|
||||
lo.scale_load.smooth = smooth;
|
||||
lo.emile.scale_load.smooth = smooth;
|
||||
}
|
||||
|
||||
evas_cache2_image_cache_key_create(hkey, im->file, pathlen,
|
||||
|
@ -906,14 +919,14 @@ evas_cache2_image_scale_load(Image_Entry *im,
|
|||
hkey = alloca(sizeof(char) * size);
|
||||
|
||||
memcpy(&lo, &im->load_opts, sizeof lo);
|
||||
lo.scale_load.src_x = src_x;
|
||||
lo.scale_load.src_y = src_y;
|
||||
lo.scale_load.src_w = src_w;
|
||||
lo.scale_load.src_h = src_h;
|
||||
lo.scale_load.dst_w = dst_w;
|
||||
lo.scale_load.dst_h = dst_h;
|
||||
lo.scale_load.smooth = smooth;
|
||||
lo.scale_load.scale_hint = (Emile_Image_Scale_Hint) im->scale_hint;
|
||||
lo.emile.scale_load.src_x = src_x;
|
||||
lo.emile.scale_load.src_y = src_y;
|
||||
lo.emile.scale_load.src_w = src_w;
|
||||
lo.emile.scale_load.src_h = src_h;
|
||||
lo.emile.scale_load.dst_w = dst_w;
|
||||
lo.emile.scale_load.dst_h = dst_h;
|
||||
lo.emile.scale_load.smooth = smooth;
|
||||
lo.emile.scale_load.scale_hint = (Emile_Image_Scale_Hint) im->scale_hint;
|
||||
|
||||
evas_cache2_image_cache_key_create(hkey, im->file, pathlen,
|
||||
im->key, keylen, &lo);
|
||||
|
|
|
@ -322,6 +322,32 @@ _efl_canvas_image_efl_image_load_load_scale_down_get(Eo *eo_obj, void *_pd EINA_
|
|||
return _evas_image_load_scale_down_get(eo_obj);
|
||||
}
|
||||
|
||||
void
|
||||
_evas_image_load_head_skip_set(const Eo *eo_obj, Eina_Bool skip)
|
||||
{
|
||||
Evas_Image_Data *o = efl_data_scope_get(eo_obj, EFL_CANVAS_IMAGE_INTERNAL_CLASS);
|
||||
o->skip_head = skip;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_canvas_image_efl_image_load_load_skip_header_set(Eo *eo_obj, void *_pd EINA_UNUSED, Eina_Bool skip)
|
||||
{
|
||||
_evas_image_load_head_skip_set(eo_obj, skip);
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
_evas_image_load_head_skip_get(const Eo *eo_obj)
|
||||
{
|
||||
Evas_Image_Data *o = efl_data_scope_get(eo_obj, EFL_CANVAS_IMAGE_INTERNAL_CLASS);
|
||||
return o->skip_head;
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_canvas_image_efl_image_load_load_skip_header_get(Eo *eo_obj, void *_pd EINA_UNUSED)
|
||||
{
|
||||
return _evas_image_load_head_skip_get(eo_obj);
|
||||
}
|
||||
|
||||
void
|
||||
_evas_image_load_region_set(Eo *eo_obj, int x, int y, int w, int h)
|
||||
{
|
||||
|
|
|
@ -31,6 +31,7 @@ class Efl.Canvas.Image (Efl.Canvas.Image.Internal, Efl.Gfx.Buffer,
|
|||
Efl.Image.Load.load_size { get; set; }
|
||||
Efl.Image.Load.load_orientation { get; set; }
|
||||
Efl.Image.Load.load_scale_down { get; set; }
|
||||
Efl.Image.Load.load_skip_header { get; set; }
|
||||
Efl.Image.Load.load_region { get; set; }
|
||||
Efl.Image.Load.load_region_support { get; }
|
||||
Efl.Object.dbg_info_get;
|
||||
|
|
|
@ -325,6 +325,20 @@ evas_object_image_load_scale_down_get(const Evas_Object *obj)
|
|||
return _evas_image_load_scale_down_get(obj);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_object_image_load_head_skip_set(Evas_Object *obj, Eina_Bool skip)
|
||||
{
|
||||
EVAS_IMAGE_API(obj);
|
||||
_evas_image_load_head_skip_set(obj, skip);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
evas_object_image_load_head_skip_get(const Evas_Object *obj)
|
||||
{
|
||||
EVAS_IMAGE_API(obj, EINA_FALSE);
|
||||
return _evas_image_load_head_skip_get(obj);
|
||||
}
|
||||
|
||||
EAPI Evas_Load_Error
|
||||
evas_object_image_load_error_get(const Evas_Object *obj)
|
||||
{
|
||||
|
|
|
@ -141,6 +141,7 @@ struct _Evas_Image_Data
|
|||
Eina_Bool video_hide : 1;
|
||||
} delayed;
|
||||
Eina_Bool legacy_type : 1;
|
||||
Eina_Bool skip_head : 1;
|
||||
};
|
||||
|
||||
/* shared functions between legacy and new eo classes */
|
||||
|
@ -159,6 +160,7 @@ void _evas_image_file_get(const Eo *eo_obj, const char **file, const char **key)
|
|||
|
||||
/* Efl.Image.Load */
|
||||
Efl_Image_Load_Error _evas_image_load_error_get(const Eo *eo_obj);
|
||||
void _evas_image_load_post_update(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj);
|
||||
void _evas_image_load_async_start(Eo *eo_obj);
|
||||
void _evas_image_load_async_cancel(Eo *eo_obj);
|
||||
void _evas_image_load_dpi_set(Eo *eo_obj, double dpi);
|
||||
|
@ -169,6 +171,8 @@ void _evas_image_load_scale_down_set(Eo *eo_obj, int scale_down);
|
|||
int _evas_image_load_scale_down_get(const Eo *eo_obj);
|
||||
void _evas_image_load_region_set(Eo *eo_obj, int x, int y, int w, int h);
|
||||
void _evas_image_load_region_get(const Eo *eo_obj, int *x, int *y, int *w, int *h);
|
||||
void _evas_image_load_head_skip_set(const Eo *eo_obj, Eina_Bool skip);
|
||||
Eina_Bool _evas_image_load_head_skip_get(const Eo *eo_obj);
|
||||
void _evas_image_load_orientation_set(Eo *eo_obj, Eina_Bool enable);
|
||||
Eina_Bool _evas_image_load_orientation_get(const Eo *eo_obj);
|
||||
Eina_Bool _evas_image_load_region_support_get(const Eo *eo_obj);
|
||||
|
|
|
@ -321,24 +321,25 @@ _evas_image_init_set(const Eina_File *f, const char *file, const char *key,
|
|||
o->file_obj = NULL;
|
||||
}
|
||||
o->load_error = EVAS_LOAD_ERROR_NONE;
|
||||
lo->scale_down_by = o->load_opts->scale_down_by;
|
||||
lo->dpi = o->load_opts->dpi;
|
||||
lo->w = o->load_opts->w;
|
||||
lo->h = o->load_opts->h;
|
||||
lo->region.x = o->load_opts->region.x;
|
||||
lo->region.y = o->load_opts->region.y;
|
||||
lo->region.w = o->load_opts->region.w;
|
||||
lo->region.h = o->load_opts->region.h;
|
||||
lo->scale_load.src_x = o->load_opts->scale_load.src_x;
|
||||
lo->scale_load.src_y = o->load_opts->scale_load.src_y;
|
||||
lo->scale_load.src_w = o->load_opts->scale_load.src_w;
|
||||
lo->scale_load.src_h = o->load_opts->scale_load.src_h;
|
||||
lo->scale_load.dst_w = o->load_opts->scale_load.dst_w;
|
||||
lo->scale_load.dst_h = o->load_opts->scale_load.dst_h;
|
||||
lo->scale_load.smooth = o->load_opts->scale_load.smooth;
|
||||
lo->scale_load.scale_hint = o->load_opts->scale_load.scale_hint;
|
||||
lo->orientation = o->load_opts->orientation;
|
||||
lo->degree = 0;
|
||||
lo->emile.scale_down_by = o->load_opts->scale_down_by;
|
||||
lo->emile.dpi = o->load_opts->dpi;
|
||||
lo->emile.w = o->load_opts->w;
|
||||
lo->emile.h = o->load_opts->h;
|
||||
lo->emile.region.x = o->load_opts->region.x;
|
||||
lo->emile.region.y = o->load_opts->region.y;
|
||||
lo->emile.region.w = o->load_opts->region.w;
|
||||
lo->emile.region.h = o->load_opts->region.h;
|
||||
lo->emile.scale_load.src_x = o->load_opts->scale_load.src_x;
|
||||
lo->emile.scale_load.src_y = o->load_opts->scale_load.src_y;
|
||||
lo->emile.scale_load.src_w = o->load_opts->scale_load.src_w;
|
||||
lo->emile.scale_load.src_h = o->load_opts->scale_load.src_h;
|
||||
lo->emile.scale_load.dst_w = o->load_opts->scale_load.dst_w;
|
||||
lo->emile.scale_load.dst_h = o->load_opts->scale_load.dst_h;
|
||||
lo->emile.scale_load.smooth = o->load_opts->scale_load.smooth;
|
||||
lo->emile.scale_load.scale_hint = o->load_opts->scale_load.scale_hint;
|
||||
lo->emile.orientation = o->load_opts->orientation;
|
||||
lo->emile.degree = 0;
|
||||
lo->skip_head = o->skip_head;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1288,24 +1289,25 @@ _evas_image_load(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Imag
|
|||
|
||||
if (o->engine_data) return;
|
||||
|
||||
lo.scale_down_by = o->load_opts->scale_down_by;
|
||||
lo.dpi = o->load_opts->dpi;
|
||||
lo.w = o->load_opts->w;
|
||||
lo.h = o->load_opts->h;
|
||||
lo.region.x = o->load_opts->region.x;
|
||||
lo.region.y = o->load_opts->region.y;
|
||||
lo.region.w = o->load_opts->region.w;
|
||||
lo.region.h = o->load_opts->region.h;
|
||||
lo.scale_load.src_x = o->load_opts->scale_load.src_x;
|
||||
lo.scale_load.src_y = o->load_opts->scale_load.src_y;
|
||||
lo.scale_load.src_w = o->load_opts->scale_load.src_w;
|
||||
lo.scale_load.src_h = o->load_opts->scale_load.src_h;
|
||||
lo.scale_load.dst_w = o->load_opts->scale_load.dst_w;
|
||||
lo.scale_load.dst_h = o->load_opts->scale_load.dst_h;
|
||||
lo.scale_load.smooth = o->load_opts->scale_load.smooth;
|
||||
lo.scale_load.scale_hint = o->load_opts->scale_load.scale_hint;
|
||||
lo.orientation = o->load_opts->orientation;
|
||||
lo.degree = 0;
|
||||
lo.emile.scale_down_by = o->load_opts->scale_down_by;
|
||||
lo.emile.dpi = o->load_opts->dpi;
|
||||
lo.emile.w = o->load_opts->w;
|
||||
lo.emile.h = o->load_opts->h;
|
||||
lo.emile.region.x = o->load_opts->region.x;
|
||||
lo.emile.region.y = o->load_opts->region.y;
|
||||
lo.emile.region.w = o->load_opts->region.w;
|
||||
lo.emile.region.h = o->load_opts->region.h;
|
||||
lo.emile.scale_load.src_x = o->load_opts->scale_load.src_x;
|
||||
lo.emile.scale_load.src_y = o->load_opts->scale_load.src_y;
|
||||
lo.emile.scale_load.src_w = o->load_opts->scale_load.src_w;
|
||||
lo.emile.scale_load.src_h = o->load_opts->scale_load.src_h;
|
||||
lo.emile.scale_load.dst_w = o->load_opts->scale_load.dst_w;
|
||||
lo.emile.scale_load.dst_h = o->load_opts->scale_load.dst_h;
|
||||
lo.emile.scale_load.smooth = o->load_opts->scale_load.smooth;
|
||||
lo.emile.scale_load.scale_hint = o->load_opts->scale_load.scale_hint;
|
||||
lo.emile.orientation = o->load_opts->orientation;
|
||||
lo.emile.degree = 0;
|
||||
lo.skip_head = o->skip_head;
|
||||
if (o->cur->mmaped_source)
|
||||
o->engine_data = ENFN->image_mmap(ENDT, o->cur->u.f, o->cur->key, &o->load_error, &lo);
|
||||
else
|
||||
|
@ -1354,6 +1356,42 @@ _evas_image_load(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Imag
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
_evas_image_load_post_update(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
|
||||
{
|
||||
Evas_Image_Data *o = efl_data_scope_get(eo_obj, MY_CLASS);
|
||||
|
||||
if (o->engine_data)
|
||||
{
|
||||
int w, h;
|
||||
int stride = 0;
|
||||
Eina_Bool resize_call = EINA_FALSE;
|
||||
|
||||
ENFN->image_size_get(ENDT, o->engine_data, &w, &h);
|
||||
if (ENFN->image_stride_get)
|
||||
ENFN->image_stride_get(ENDT, o->engine_data, &stride);
|
||||
else
|
||||
stride = w * 4;
|
||||
|
||||
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
|
||||
{
|
||||
state_write->has_alpha = ENFN->image_alpha_get(ENDT, o->engine_data);
|
||||
state_write->cspace = ENFN->image_colorspace_get(ENDT, o->engine_data);
|
||||
if ((state_write->image.w != w) || (state_write->image.h != h))
|
||||
resize_call = EINA_TRUE;
|
||||
state_write->image.w = w;
|
||||
state_write->image.h = h;
|
||||
state_write->image.stride = stride;
|
||||
}
|
||||
EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
|
||||
if (resize_call) evas_object_inform_call_image_resize(eo_obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
o->load_error = EVAS_LOAD_ERROR_GENERIC;
|
||||
}
|
||||
}
|
||||
|
||||
static Evas_Coord
|
||||
evas_object_image_figure_x_fill(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, Evas_Coord start, Evas_Coord size, Evas_Coord *size_ret)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "evas_common_private.h"
|
||||
#include "evas_image_private.h"
|
||||
#include "evas_private.h"
|
||||
|
||||
/* local calls */
|
||||
|
@ -59,6 +60,7 @@ evas_object_inform_call_image_preloaded(Evas_Object *eo_obj)
|
|||
EINA_SAFETY_ON_NULL_RETURN(obj);
|
||||
|
||||
if (!_evas_object_image_preloading_get(eo_obj)) return;
|
||||
_evas_image_load_post_update(eo_obj, obj);
|
||||
_evas_object_image_preloading_check(eo_obj);
|
||||
_evas_object_image_preloading_set(eo_obj, 0);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ struct ext_loader_s
|
|||
};
|
||||
|
||||
#define MATCHING(Ext, Module) \
|
||||
{ sizeof (Ext), Ext, Module }
|
||||
{ sizeof (Ext), Ext, Module }
|
||||
|
||||
static const struct ext_loader_s loaders[] =
|
||||
{ /* map extensions to loaders to use for good first-guess tries */
|
||||
|
@ -181,7 +181,7 @@ _evas_image_file_header(Evas_Module *em, Image_Entry *ie, int *error)
|
|||
{
|
||||
Evas_Image_Load_Func *evas_image_load_func = NULL;
|
||||
Eina_Bool r = EINA_TRUE;
|
||||
|
||||
|
||||
if (!evas_module_load(em)) goto load_error;
|
||||
evas_image_load_func = em->functions;
|
||||
evas_module_use(em);
|
||||
|
@ -196,24 +196,19 @@ _evas_image_file_header(Evas_Module *em, Image_Entry *ie, int *error)
|
|||
ie->f = eina_file_open(ie->file, EINA_FALSE);
|
||||
file = ie->file;
|
||||
}
|
||||
else
|
||||
{
|
||||
file = eina_file_filename_get(ie->f);
|
||||
}
|
||||
else file = eina_file_filename_get(ie->f);
|
||||
|
||||
if (!ie->f)
|
||||
{
|
||||
*error = EVAS_LOAD_ERROR_DOES_NOT_EXIST;
|
||||
goto load_error;
|
||||
}
|
||||
|
||||
ie->loader_data = evas_image_load_func->file_open(ie->f, ie->key,
|
||||
&ie->load_opts,
|
||||
&ie->animated,
|
||||
error);
|
||||
if (!ie->loader_data)
|
||||
{
|
||||
goto load_error;
|
||||
}
|
||||
ie->loader_data = evas_image_load_func->file_open(ie->f, ie->key,
|
||||
&ie->load_opts,
|
||||
&ie->animated,
|
||||
error);
|
||||
if (!ie->loader_data) goto load_error;
|
||||
|
||||
memset(&property, 0, sizeof (property));
|
||||
if (evas_image_load_func->file_head(ie->loader_data, &property,
|
||||
|
@ -231,8 +226,7 @@ _evas_image_file_header(Evas_Module *em, Image_Entry *ie, int *error)
|
|||
ie->borders.b = property.borders.b;
|
||||
ie->scale = property.scale;
|
||||
ie->flags.alpha = property.alpha;
|
||||
if (property.cspaces)
|
||||
ie->cspaces = property.cspaces;
|
||||
if (property.cspaces) ie->cspaces = property.cspaces;
|
||||
ie->flags.rotated = property.rotated;
|
||||
ie->flags.flipped = property.flipped;
|
||||
r = EINA_FALSE;
|
||||
|
@ -249,11 +243,10 @@ _evas_image_file_header(Evas_Module *em, Image_Entry *ie, int *error)
|
|||
}
|
||||
else
|
||||
{
|
||||
load_error:
|
||||
load_error:
|
||||
evas_module_unload(em);
|
||||
WRN("failed to load module '%s'.", em->definition->name);
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -266,9 +259,7 @@ _evas_image_foreach_loader(const Eina_Hash *hash EINA_UNUSED, const void *key EI
|
|||
Eina_Bool r;
|
||||
|
||||
r = _evas_image_file_header(em, ie, d->error);
|
||||
|
||||
if (!r)
|
||||
d->em = em;
|
||||
if (!r) d->em = em;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -281,12 +272,14 @@ evas_common_load_rgba_image_module_from_file(Image_Entry *ie)
|
|||
unsigned int i;
|
||||
int len, ret = EVAS_LOAD_ERROR_NONE;
|
||||
struct evas_image_foreach_loader_data fdata;
|
||||
Eina_Bool skip;
|
||||
|
||||
#ifdef EVAS_CSERVE2
|
||||
if (evas_cserve2_use_get() && evas_cache2_image_cached(ie))
|
||||
CRI("This function shouldn't be called anymore!");
|
||||
#endif
|
||||
|
||||
skip = ie->load_opts.skip_head;
|
||||
if (ie->f)
|
||||
{
|
||||
len = strlen(eina_file_filename_get(ie->f));
|
||||
|
@ -295,14 +288,16 @@ evas_common_load_rgba_image_module_from_file(Image_Entry *ie)
|
|||
}
|
||||
else
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
if (stat(ie->file, &st) != 0 || S_ISDIR(st.st_mode))
|
||||
if (!skip)
|
||||
{
|
||||
DBG("trying to open directory '%s' !", ie->file);
|
||||
return EVAS_LOAD_ERROR_DOES_NOT_EXIST;
|
||||
}
|
||||
struct stat st;
|
||||
|
||||
if (stat(ie->file, &st) != 0 || S_ISDIR(st.st_mode))
|
||||
{
|
||||
DBG("trying to open directory '%s' !", ie->file);
|
||||
return EVAS_LOAD_ERROR_DOES_NOT_EXIST;
|
||||
}
|
||||
}
|
||||
len = strlen(ie->file);
|
||||
end = ie->file + len;
|
||||
file = ie->file;
|
||||
|
@ -323,15 +318,19 @@ evas_common_load_rgba_image_module_from_file(Image_Entry *ie)
|
|||
|
||||
if (loader)
|
||||
{
|
||||
em = evas_module_find_type(EVAS_MODULE_TYPE_IMAGE_LOADER, loader);
|
||||
if (em)
|
||||
{
|
||||
DBG("found image loader '%s' (%p)", loader, em);
|
||||
if (!_evas_image_file_header(em, ie, &ret))
|
||||
goto end;
|
||||
}
|
||||
else
|
||||
INF("image loader '%s' is not enabled or missing!", loader);
|
||||
em = evas_module_find_type(EVAS_MODULE_TYPE_IMAGE_LOADER, loader);
|
||||
if (em)
|
||||
{
|
||||
if (!((Evas_Image_Load_Func *)em->functions)->threadable)
|
||||
skip = EINA_FALSE;
|
||||
DBG("found image loader '%s' (%p)", loader, em);
|
||||
if (!skip)
|
||||
{
|
||||
if (!_evas_image_file_header(em, ie, &ret)) goto end;
|
||||
}
|
||||
}
|
||||
else INF("image loader '%s' is not enabled or missing!", loader);
|
||||
if (skip) goto end;
|
||||
}
|
||||
|
||||
fdata.ie = ie;
|
||||
|
@ -346,38 +345,37 @@ evas_common_load_rgba_image_module_from_file(Image_Entry *ie)
|
|||
/* FIXME: We could use eina recursive module search ability. */
|
||||
for (i = 0; i < sizeof (loaders_name) / sizeof (char *); i++)
|
||||
{
|
||||
em = evas_module_find_type(EVAS_MODULE_TYPE_IMAGE_LOADER, loaders_name[i]);
|
||||
if (em)
|
||||
{
|
||||
if (!_evas_image_file_header(em, ie, &ret))
|
||||
goto end;
|
||||
}
|
||||
else
|
||||
DBG("could not find module '%s'", loaders_name[i]);
|
||||
em = evas_module_find_type(EVAS_MODULE_TYPE_IMAGE_LOADER, loaders_name[i]);
|
||||
if (em)
|
||||
{
|
||||
if (!ie->load_opts.skip_head)
|
||||
{
|
||||
if (!_evas_image_file_header(em, ie, &ret)) goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
DBG("could not find module '%s'", loaders_name[i]);
|
||||
}
|
||||
|
||||
INF("exhausted all means to load image '%s'", file);
|
||||
return EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
|
||||
|
||||
end:
|
||||
|
||||
if (ret != EVAS_LOAD_ERROR_NONE)
|
||||
{
|
||||
const char *modname = NULL;
|
||||
int modversion = -1;
|
||||
if (em && em->definition)
|
||||
{
|
||||
modname = em->definition->name;
|
||||
modversion = em->definition->version;
|
||||
}
|
||||
WRN("loader '%s' (version %d) "
|
||||
"handled file '%s', key '%s' with errors: %s",
|
||||
modname ? modname : "<UNKNOWN>", modversion,
|
||||
file, ie->key ? ie->key : "",
|
||||
evas_load_error_str(ret));
|
||||
goto end;
|
||||
}
|
||||
const char *modname = NULL;
|
||||
int modversion = -1;
|
||||
|
||||
if (em && em->definition)
|
||||
{
|
||||
modname = em->definition->name;
|
||||
modversion = em->definition->version;
|
||||
}
|
||||
WRN("loader '%s' (version %d) "
|
||||
"handled file '%s', key '%s' with errors: %s",
|
||||
modname ? modname : "<UNKNOWN>", modversion,
|
||||
file, ie->key ? ie->key : "",
|
||||
evas_load_error_str(ret));
|
||||
}
|
||||
end:
|
||||
DBG("loader '%s' used for file %s",
|
||||
(em && em->definition && em->definition->name) ?
|
||||
em->definition->name : "<UNKNOWN>",
|
||||
|
@ -389,6 +387,21 @@ evas_common_load_rgba_image_module_from_file(Image_Entry *ie)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
_timestamp_build(Image_Timestamp *tstamp, struct stat *st)
|
||||
{
|
||||
tstamp->mtime = st->st_mtime;
|
||||
tstamp->size = st->st_size;
|
||||
tstamp->ino = st->st_ino;
|
||||
#ifdef _STAT_VER_LINUX
|
||||
# if (defined __USE_MISC && defined st_mtime)
|
||||
tstamp->mtime_nsec = (unsigned long int)st->st_mtim.tv_nsec;
|
||||
# else
|
||||
tstamp->mtime_nsec = (unsigned long int)st->st_mtimensec;
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
EAPI int
|
||||
evas_common_load_rgba_image_data_from_file(Image_Entry *ie)
|
||||
{
|
||||
|
@ -396,6 +409,8 @@ evas_common_load_rgba_image_data_from_file(Image_Entry *ie)
|
|||
Evas_Image_Load_Func *evas_image_load_func = NULL;
|
||||
Evas_Image_Property property;
|
||||
int ret = EVAS_LOAD_ERROR_NONE;
|
||||
struct stat st;
|
||||
unsigned int i;
|
||||
|
||||
if ((ie->flags.loaded) && (!ie->animated.animated)) return EVAS_LOAD_ERROR_GENERIC;
|
||||
|
||||
|
@ -406,12 +421,44 @@ evas_common_load_rgba_image_data_from_file(Image_Entry *ie)
|
|||
|
||||
if (!ie->info.module) return EVAS_LOAD_ERROR_GENERIC;
|
||||
|
||||
// printf("load data [%p] %s %s\n", ie, ie->file, ie->key);
|
||||
evas_image_load_func = ie->info.loader;
|
||||
evas_module_use(ie->info.module);
|
||||
|
||||
if (!ie->f)
|
||||
{
|
||||
Evas_Module *em = ie->info.module;
|
||||
|
||||
if (_evas_image_file_header(em, ie, &ret))
|
||||
{
|
||||
em = NULL;
|
||||
for (i = 0; i < sizeof(loaders_name) / sizeof (char *); i++)
|
||||
{
|
||||
em = evas_module_find_type(EVAS_MODULE_TYPE_IMAGE_LOADER,
|
||||
loaders_name[i]);
|
||||
if (em)
|
||||
{
|
||||
if (!ie->load_opts.skip_head)
|
||||
{
|
||||
if (!_evas_image_file_header(em, ie, &ret))
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else DBG("could not find module '%s'", loaders_name[i]);
|
||||
em = NULL;
|
||||
}
|
||||
}
|
||||
end:
|
||||
if (ie->info.module != em)
|
||||
{
|
||||
evas_module_ref(em);
|
||||
evas_module_unref(ie->info.module);
|
||||
ie->info.module = em;
|
||||
}
|
||||
}
|
||||
if (!ie->f) return EVAS_LOAD_ERROR_DOES_NOT_EXIST;
|
||||
|
||||
if (stat(ie->file, &st) == 0) _timestamp_build(&(ie->tstamp), &st);
|
||||
|
||||
memset(&property, 0, sizeof (property));
|
||||
property.w = ie->w;
|
||||
property.h = ie->h;
|
||||
|
@ -429,17 +476,13 @@ evas_common_load_rgba_image_data_from_file(Image_Entry *ie)
|
|||
property.borders.b = ie->borders.b;
|
||||
|
||||
pixels = evas_cache_image_pixels(ie);
|
||||
if (!pixels)
|
||||
return EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
|
||||
if (!pixels) return EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
|
||||
|
||||
evas_image_load_func->file_data(ie->loader_data, &property, pixels, &ret);
|
||||
|
||||
ie->flags.alpha_sparse = property.alpha_sparse;
|
||||
|
||||
if (property.premul)
|
||||
evas_common_image_premul(ie);
|
||||
// evas_module_unref(ie->info.module);
|
||||
// ie->info.module = NULL;
|
||||
if (property.premul) evas_common_image_premul(ie);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -456,7 +499,6 @@ evas_common_load_rgba_image_frame_duration_from_file(Image_Entry *ie, const int
|
|||
if (evas_image_load_func->frame_duration)
|
||||
{
|
||||
if (!ie->f) return -1;
|
||||
|
||||
return evas_image_load_func->frame_duration(ie->loader_data, start, frame_num);
|
||||
}
|
||||
return -1;
|
||||
|
@ -478,6 +520,5 @@ evas_common_extension_can_load_get(const char *file)
|
|||
if (!strcasecmp(loaders[i].extension, file + length - loaders[i].length))
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
|
|
@ -27,19 +27,22 @@
|
|||
typedef Eina_Bool (*Op_Callback)(void *data, const void *msg, int size);
|
||||
|
||||
static const Evas_Image_Load_Opts empty_lo = {
|
||||
{ 0, 0, 0, 0 },
|
||||
{
|
||||
0, 0, 0, 0,
|
||||
0, 0,
|
||||
0,
|
||||
0
|
||||
},
|
||||
0.0,
|
||||
0, 0,
|
||||
0,
|
||||
0,
|
||||
{
|
||||
{ 0, 0, 0, 0 },
|
||||
{
|
||||
0, 0, 0, 0,
|
||||
0, 0,
|
||||
0,
|
||||
0
|
||||
},
|
||||
0.0,
|
||||
0, 0,
|
||||
0,
|
||||
0,
|
||||
|
||||
EINA_FALSE
|
||||
EINA_FALSE
|
||||
},
|
||||
EINA_FALSE
|
||||
};
|
||||
|
||||
struct _File_Entry {
|
||||
|
@ -921,16 +924,16 @@ _evas_image_load_opts_empty(Evas_Image_Load_Opts *lo)
|
|||
{
|
||||
if (!lo) return EINA_TRUE;
|
||||
|
||||
return ((lo->scale_down_by == 0)
|
||||
&& (EINA_DBL_CMP(lo->dpi, 0.0))
|
||||
&& (lo->w == 0) && (lo->h == 0)
|
||||
&& (lo->region.x == 0) && (lo->region.y == 0)
|
||||
&& (lo->region.w == 0) && (lo->region.h == 0)
|
||||
&& (lo->orientation == 0)
|
||||
&& (lo->scale_load.src_x == 0) && (lo->scale_load.src_y == 0)
|
||||
&& (lo->scale_load.src_w == 0) && (lo->scale_load.src_h == 0)
|
||||
&& (lo->scale_load.dst_w == 0) && (lo->scale_load.dst_h == 0)
|
||||
&& (lo->scale_load.scale_hint == 0)); // Skip smooth
|
||||
return ((lo->emile.scale_down_by == 0)
|
||||
&& (EINA_DBL_CMP(lo->emile.dpi, 0.0))
|
||||
&& (lo->emile.w == 0) && (lo->emile.h == 0)
|
||||
&& (lo->emile.region.x == 0) && (lo->emile.region.y == 0)
|
||||
&& (lo->emile.region.w == 0) && (lo->emile.region.h == 0)
|
||||
&& (lo->emile.orientation == 0)
|
||||
&& (lo->emile.scale_load.src_x == 0) && (lo->emile.scale_load.src_y == 0)
|
||||
&& (lo->emile.scale_load.src_w == 0) && (lo->emile.scale_load.src_h == 0)
|
||||
&& (lo->emile.scale_load.dst_w == 0) && (lo->emile.scale_load.dst_h == 0)
|
||||
&& (lo->emile.scale_load.scale_hint == 0)); // Skip smooth
|
||||
}
|
||||
|
||||
// Valgrind complains about uninitialized memory, because the load_opts
|
||||
|
@ -942,24 +945,24 @@ static Eina_Bool
|
|||
_evas_image_load_opts_equal(const Evas_Image_Load_Opts *lo1,
|
||||
const Evas_Image_Load_Opts *lo2)
|
||||
{
|
||||
return ((lo1->scale_down_by == lo2->scale_down_by)
|
||||
&& (EINA_DBL_CMP(lo1->dpi, lo2->dpi))
|
||||
&& (lo1->w == lo2->w)
|
||||
&& (lo1->h == lo2->h)
|
||||
&& (lo1->region.x == lo2->region.x)
|
||||
&& (lo1->region.y == lo2->region.y)
|
||||
&& (lo1->region.w == lo2->region.w)
|
||||
&& (lo1->region.h == lo2->region.h)
|
||||
&& (lo1->scale_load.src_x == lo2->scale_load.src_x)
|
||||
&& (lo1->scale_load.src_y == lo2->scale_load.src_y)
|
||||
&& (lo1->scale_load.src_w == lo2->scale_load.src_w)
|
||||
&& (lo1->scale_load.src_h == lo2->scale_load.src_h)
|
||||
&& (lo1->scale_load.dst_w == lo2->scale_load.dst_w)
|
||||
&& (lo1->scale_load.dst_h == lo2->scale_load.dst_h)
|
||||
&& (lo1->scale_load.smooth == lo2->scale_load.smooth)
|
||||
&& (lo1->scale_load.scale_hint == lo2->scale_load.scale_hint)
|
||||
&& (lo1->orientation == lo2->orientation)
|
||||
&& (lo1->degree == lo2->degree));
|
||||
return ((lo1->emile.scale_down_by == lo2->emile.scale_down_by)
|
||||
&& (EINA_DBL_CMP(lo1->emile.dpi, lo2->emile.dpi))
|
||||
&& (lo1->emile.w == lo2->emile.w)
|
||||
&& (lo1->emile.h == lo2->emile.h)
|
||||
&& (lo1->emile.region.x == lo2->emile.region.x)
|
||||
&& (lo1->emile.region.y == lo2->emile.region.y)
|
||||
&& (lo1->emile.region.w == lo2->emile.region.w)
|
||||
&& (lo1->emile.region.h == lo2->emile.region.h)
|
||||
&& (lo1->emile.scale_load.src_x == lo2->emile.scale_load.src_x)
|
||||
&& (lo1->emile.scale_load.src_y == lo2->emile.scale_load.src_y)
|
||||
&& (lo1->emile.scale_load.src_w == lo2->emile.scale_load.src_w)
|
||||
&& (lo1->emile.scale_load.src_h == lo2->emile.scale_load.src_h)
|
||||
&& (lo1->emile.scale_load.dst_w == lo2->emile.scale_load.dst_w)
|
||||
&& (lo1->emile.scale_load.dst_h == lo2->emile.scale_load.dst_h)
|
||||
&& (lo1->emile.scale_load.smooth == lo2->emile.scale_load.smooth)
|
||||
&& (lo1->emile.scale_load.scale_hint == lo2->emile.scale_load.scale_hint)
|
||||
&& (lo1->emile.orientation == lo2->emile.orientation)
|
||||
&& (lo1->emile.degree == lo2->emile.degree));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -967,24 +970,24 @@ _evas_image_load_opts_set(Evas_Image_Load_Opts *lo1,
|
|||
const Evas_Image_Load_Opts *lo2)
|
||||
{
|
||||
memset(lo1, 0, sizeof(Evas_Image_Load_Opts));
|
||||
lo1->scale_down_by = lo2->scale_down_by;
|
||||
lo1->dpi = lo2->dpi;
|
||||
lo1->w = lo2->w;
|
||||
lo1->h = lo2->h;
|
||||
lo1->region.x = lo2->region.x;
|
||||
lo1->region.y = lo2->region.y;
|
||||
lo1->region.w = lo2->region.w;
|
||||
lo1->region.h = lo2->region.h;
|
||||
lo1->scale_load.src_x = lo2->scale_load.src_x;
|
||||
lo1->scale_load.src_y = lo2->scale_load.src_y;
|
||||
lo1->scale_load.src_w = lo2->scale_load.src_w;
|
||||
lo1->scale_load.src_h = lo2->scale_load.src_h;
|
||||
lo1->scale_load.dst_w = lo2->scale_load.dst_w;
|
||||
lo1->scale_load.dst_h = lo2->scale_load.dst_h;
|
||||
lo1->scale_load.smooth = lo2->scale_load.smooth;
|
||||
lo1->scale_load.scale_hint = lo2->scale_load.scale_hint;
|
||||
lo1->orientation = lo2->orientation;
|
||||
lo1->degree = lo2->degree;
|
||||
lo1->emile.scale_down_by = lo2->emile.scale_down_by;
|
||||
lo1->emile.dpi = lo2->emile.dpi;
|
||||
lo1->emile.w = lo2->emile.w;
|
||||
lo1->emile.h = lo2->emile.h;
|
||||
lo1->emile.region.x = lo2->emile.region.x;
|
||||
lo1->emile.region.y = lo2->emile.region.y;
|
||||
lo1->emile.region.w = lo2->emile.region.w;
|
||||
lo1->emile.region.h = lo2->emile.region.h;
|
||||
lo1->emile.scale_load.src_x = lo2->emile.scale_load.src_x;
|
||||
lo1->emile.scale_load.src_y = lo2->emile.scale_load.src_y;
|
||||
lo1->emile.scale_load.src_w = lo2->emile.scale_load.src_w;
|
||||
lo1->emile.scale_load.src_h = lo2->emile.scale_load.src_h;
|
||||
lo1->emile.scale_load.dst_w = lo2->emile.scale_load.dst_w;
|
||||
lo1->emile.scale_load.dst_h = lo2->emile.scale_load.dst_h;
|
||||
lo1->emile.scale_load.smooth = lo2->emile.scale_load.smooth;
|
||||
lo1->emile.scale_load.scale_hint = lo2->emile.scale_load.scale_hint;
|
||||
lo1->emile.orientation = lo2->emile.orientation;
|
||||
lo1->emile.degree = lo2->emile.degree;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -999,17 +1002,17 @@ _file_hkey_get(char *buf, size_t sz, const char *path, const char *key,
|
|||
snprintf(buf, sz, "%s:%s", path, key);
|
||||
else
|
||||
{
|
||||
if (lo->orientation)
|
||||
if (lo->emile.orientation)
|
||||
{
|
||||
snprintf(buf, sz, "%s:%s//@/%d/%f/%dx%d/%d+%d.%dx%d",
|
||||
path, key, lo->scale_down_by, lo->dpi, lo->w, lo->h,
|
||||
lo->region.x, lo->region.y, lo->region.w, lo->region.h);
|
||||
path, key, lo->emile.scale_down_by, lo->emile.dpi, lo->emile.w, lo->emile.h,
|
||||
lo->emile.region.x, lo->emile.region.y, lo->emile.region.w, lo->emile.region.h);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(buf, sz, "%s:%s//@/%d/%f/%dx%d/%d+%d.%dx%d/o",
|
||||
path, key, lo->scale_down_by, lo->dpi, lo->w, lo->h,
|
||||
lo->region.x, lo->region.y, lo->region.w, lo->region.h);
|
||||
path, key, lo->emile.scale_down_by, lo->emile.dpi, lo->emile.w, lo->emile.h,
|
||||
lo->emile.region.x, lo->emile.region.y, lo->emile.region.w, lo->emile.region.h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2754,15 +2757,15 @@ _shared_image_entry_file_data_find(Image_Entry *ie)
|
|||
continue;
|
||||
}
|
||||
|
||||
lo.region.x = fd->lo.region.x;
|
||||
lo.region.y = fd->lo.region.y;
|
||||
lo.region.w = fd->lo.region.w;
|
||||
lo.region.h = fd->lo.region.h;
|
||||
lo.dpi = fd->lo.dpi;
|
||||
lo.w = fd->lo.w;
|
||||
lo.h = fd->lo.h;
|
||||
lo.scale_down_by = fd->lo.scale_down_by;
|
||||
lo.orientation = fd->lo.orientation;
|
||||
lo.emile.region.x = fd->lo.region.x;
|
||||
lo.emile.region.y = fd->lo.region.y;
|
||||
lo.emile.region.w = fd->lo.region.w;
|
||||
lo.emile.region.h = fd->lo.region.h;
|
||||
lo.emile.dpi = fd->lo.dpi;
|
||||
lo.emile.w = fd->lo.w;
|
||||
lo.emile.h = fd->lo.h;
|
||||
lo.emile.scale_down_by = fd->lo.scale_down_by;
|
||||
lo.emile.orientation = fd->lo.orientation;
|
||||
|
||||
_file_hkey_get(fd_hkey, sizeof(fd_hkey), file, key, &lo);
|
||||
|
||||
|
|
|
@ -588,9 +588,12 @@ struct _Image_Entry_Frame
|
|||
|
||||
struct _Evas_Cache_Target
|
||||
{
|
||||
EINA_INLIST;
|
||||
const Eo *target;
|
||||
void *data;
|
||||
EINA_INLIST;
|
||||
const Eo *target;
|
||||
void *data;
|
||||
void (*simple_cb) (void *data);
|
||||
void *simple_data;
|
||||
Eina_Bool delete_me;
|
||||
};
|
||||
|
||||
struct _Image_Timestamp
|
||||
|
|
|
@ -678,6 +678,8 @@ Evas_GL_Image *evas_gl_common_image_mmap(Evas_Engine_GL_Context *gc, Eina_Fil
|
|||
Evas_GL_Image *evas_gl_common_image_new_from_copied_data(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, DATA32 *data, int alpha, Evas_Colorspace cspace);
|
||||
Evas_GL_Image *evas_gl_common_image_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, Evas_Colorspace cspace);
|
||||
Evas_GL_Image *evas_gl_common_image_new_from_rgbaimage(Evas_Engine_GL_Context *gc, RGBA_Image *im, Evas_Image_Load_Opts *lo, int *error);
|
||||
void evas_gl_common_image_preload_watch(Evas_GL_Image *im);
|
||||
void evas_gl_common_image_preload_unwatch(Evas_GL_Image *im);
|
||||
Evas_GL_Image *evas_gl_common_image_alpha_set(Evas_GL_Image *im, int alpha);
|
||||
void evas_gl_common_image_scale_hint_set(Evas_GL_Image *im, int hint);
|
||||
void evas_gl_common_image_content_hint_set(Evas_GL_Image *im, int hint);
|
||||
|
|
|
@ -14,8 +14,8 @@ evas_gl_common_image_alloc_ensure(Evas_GL_Image *im)
|
|||
im->w, im->h);
|
||||
else
|
||||
#endif
|
||||
im->im = (RGBA_Image *)evas_cache_image_size_set(&im->im->cache_entry,
|
||||
im->w, im->h);
|
||||
im->im = (RGBA_Image *)evas_cache_image_size_set(&im->im->cache_entry,
|
||||
im->w, im->h);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -150,6 +150,84 @@ _evas_gl_cspace_list_fill(Evas_Engine_GL_Context *gc)
|
|||
CS_APPEND(EVAS_COLORSPACE_ARGB8888);
|
||||
}
|
||||
|
||||
static void
|
||||
preload_done(void *data)
|
||||
{
|
||||
Evas_GL_Image *im = data;
|
||||
|
||||
if (im->im)
|
||||
{
|
||||
Evas_Colorspace cspace = EVAS_COLORSPACE_ARGB8888;
|
||||
|
||||
if (im->im->cache_entry.cspaces)
|
||||
{
|
||||
Evas_Colorspace cs;
|
||||
unsigned int i;
|
||||
Eina_List *l2;
|
||||
void *ldata;
|
||||
|
||||
cspace = EVAS_COLORSPACE_ARGB8888;
|
||||
for (i = 0;
|
||||
im->im->cache_entry.cspaces[i] != EVAS_COLORSPACE_ARGB8888;
|
||||
i++)
|
||||
{
|
||||
EINA_LIST_FOREACH(im->gc->shared->info.cspaces, l2, ldata)
|
||||
{
|
||||
cs = (Evas_Colorspace) (intptr_t) ldata;
|
||||
if (cs == im->im->cache_entry.cspaces[i])
|
||||
{
|
||||
cspace = cs;
|
||||
goto found_cspace;
|
||||
}
|
||||
}
|
||||
}
|
||||
found_cspace:
|
||||
if (cspace == EVAS_COLORSPACE_ETC1 && im->gc->shared->info.etc2)
|
||||
cspace = EVAS_COLORSPACE_RGB8_ETC2;
|
||||
im->im->cache_entry.space = cspace;
|
||||
}
|
||||
im->cs.space = cspace;
|
||||
im->orient = EVAS_IMAGE_ORIENT_NONE;
|
||||
im->alpha = im->im->cache_entry.flags.alpha;
|
||||
im->w = im->im->cache_entry.w;
|
||||
im->h = im->im->cache_entry.h;
|
||||
}
|
||||
evas_gl_common_image_preload_unwatch(im);
|
||||
}
|
||||
|
||||
void
|
||||
evas_gl_common_image_preload_watch(Evas_GL_Image *im)
|
||||
{
|
||||
Evas_Cache_Target *tg;
|
||||
|
||||
if (!im->im) return;
|
||||
tg = calloc(1, sizeof(Evas_Cache_Target));
|
||||
if (tg)
|
||||
{
|
||||
tg->simple_cb = preload_done;
|
||||
tg->simple_data = im;
|
||||
im->im->cache_entry.targets = (Evas_Cache_Target *)
|
||||
eina_inlist_append(EINA_INLIST_GET(im->im->cache_entry.targets),
|
||||
EINA_INLIST_GET(tg));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
evas_gl_common_image_preload_unwatch(Evas_GL_Image *im)
|
||||
{
|
||||
Eina_Inlist *l2;
|
||||
Evas_Cache_Target *tg;
|
||||
|
||||
if (!im->im) return;
|
||||
EINA_INLIST_FOREACH_SAFE(im->im->cache_entry.targets, l2, tg)
|
||||
{
|
||||
if ((tg->simple_cb != preload_done) || (tg->simple_data != im))
|
||||
continue;
|
||||
tg->delete_me = EINA_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Evas_GL_Image *
|
||||
evas_gl_common_image_new_from_rgbaimage(Evas_Engine_GL_Context *gc, RGBA_Image *im_im,
|
||||
Evas_Image_Load_Opts *lo, int *error)
|
||||
|
@ -690,6 +768,8 @@ evas_gl_common_image_free(Evas_GL_Image *im)
|
|||
if (im->references > 0) return;
|
||||
evas_gl_common_context_flush(im->gc);
|
||||
|
||||
evas_gl_common_image_preload_unwatch(im);
|
||||
|
||||
if (im->scaled.origin)
|
||||
{
|
||||
evas_gl_common_image_free(im->scaled.origin);
|
||||
|
@ -791,11 +871,16 @@ evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im)
|
|||
{
|
||||
Image_Entry *ie;
|
||||
if (!im->im) return;
|
||||
evas_gl_common_image_alloc_ensure(im);
|
||||
|
||||
// alloc ensure can change im->im, so only get the local variable later.
|
||||
ie = &im->im->cache_entry;
|
||||
|
||||
if (!im->tex)
|
||||
{
|
||||
if (ie->preload) return;
|
||||
im->w = ie->w;
|
||||
im->h = ie->h;
|
||||
}
|
||||
evas_gl_common_image_alloc_ensure(im);
|
||||
/*
|
||||
if ((im->cs.space == EVAS_COLORSPACE_YCBCR422P601_PL) ||
|
||||
(im->cs.space == EVAS_COLORSPACE_YCBCR422P709_PL))
|
||||
|
|
|
@ -582,13 +582,13 @@ eng_image_size_get(void *data EINA_UNUSED, void *image, int *w, int *h)
|
|||
im->orient == EVAS_IMAGE_FLIP_TRANSPOSE ||
|
||||
im->orient == EVAS_IMAGE_FLIP_TRANSVERSE)
|
||||
{
|
||||
if (w) *w = ((Evas_GL_Image *)image)->h;
|
||||
if (h) *h = ((Evas_GL_Image *)image)->w;
|
||||
if (w) *w = im->h;
|
||||
if (h) *h = im->w;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (w) *w = ((Evas_GL_Image *)image)->w;
|
||||
if (h) *h = ((Evas_GL_Image *)image)->h;
|
||||
if (w) *w = im->w;
|
||||
if (h) *h = im->h;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1081,7 +1081,7 @@ static void
|
|||
eng_image_data_preload_request(void *data, void *image, const Eo *target)
|
||||
{
|
||||
Evas_GL_Image *gim = image;
|
||||
Render_Engine_GL_Generic *re = data;
|
||||
// Render_Engine_GL_Generic *re = data;
|
||||
RGBA_Image *im;
|
||||
|
||||
if (!gim) return;
|
||||
|
@ -1089,12 +1089,14 @@ eng_image_data_preload_request(void *data, void *image, const Eo *target)
|
|||
im = (RGBA_Image *)gim->im;
|
||||
if (!im) return;
|
||||
|
||||
evas_gl_common_image_preload_watch(gim);
|
||||
#ifdef EVAS_CSERVE2
|
||||
if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->cache_entry))
|
||||
evas_cache2_image_preload_data(&im->cache_entry, target);
|
||||
else
|
||||
#endif
|
||||
evas_cache_image_preload_data(&im->cache_entry, target, NULL, NULL, NULL);
|
||||
/*
|
||||
if (!gim->tex)
|
||||
{
|
||||
Evas_Engine_GL_Context *gl_context;
|
||||
|
@ -1107,6 +1109,7 @@ eng_image_data_preload_request(void *data, void *image, const Eo *target)
|
|||
im->cache_entry.flags.updated_data = 1;
|
||||
}
|
||||
evas_gl_preload_target_register(gim->tex, (Eo*) target);
|
||||
*/
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1120,13 +1123,14 @@ eng_image_data_preload_cancel(void *data EINA_UNUSED, void *image, const Eo *tar
|
|||
im = (RGBA_Image *)gim->im;
|
||||
if (!im) return;
|
||||
|
||||
evas_gl_common_image_preload_unwatch(gim);
|
||||
#ifdef EVAS_CSERVE2
|
||||
if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->cache_entry))
|
||||
evas_cache2_image_preload_cancel(&im->cache_entry, target);
|
||||
else
|
||||
#endif
|
||||
evas_cache_image_preload_cancel(&im->cache_entry, target);
|
||||
evas_gl_preload_target_unregister(gim->tex, (Eo*) target);
|
||||
// if (gim->tex) evas_gl_preload_target_unregister(gim->tex, (Eo*) target);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
|
|
|
@ -369,24 +369,24 @@ evas_image_load_file_head_bmp(void *loader_data,
|
|||
goto close_file;
|
||||
}
|
||||
|
||||
if (load_opts->region.w > 0 && load_opts->region.h > 0)
|
||||
if (load_opts->emile.region.w > 0 && load_opts->emile.region.h > 0)
|
||||
{
|
||||
if ((load_opts->region.w + load_opts->region.x > header.width) ||
|
||||
(load_opts->region.h + load_opts->region.y > header.height))
|
||||
if ((load_opts->emile.region.w + load_opts->emile.region.x > header.width) ||
|
||||
(load_opts->emile.region.h + load_opts->emile.region.y > header.height))
|
||||
{
|
||||
*error = EVAS_LOAD_ERROR_GENERIC;
|
||||
goto close_file;
|
||||
}
|
||||
header.width = load_opts->region.w;
|
||||
header.height = load_opts->region.h;
|
||||
header.width = load_opts->emile.region.w;
|
||||
header.height = load_opts->emile.region.h;
|
||||
}
|
||||
|
||||
/* It is not bad idea that bmp loader support scale down decoding
|
||||
* because of memory issue in mobile world.*/
|
||||
if (load_opts->scale_down_by > 1)
|
||||
if (load_opts->emile.scale_down_by > 1)
|
||||
{
|
||||
header.width /= load_opts->scale_down_by;
|
||||
header.height /= load_opts->scale_down_by;
|
||||
header.width /= load_opts->emile.scale_down_by;
|
||||
header.height /= load_opts->emile.scale_down_by;
|
||||
}
|
||||
|
||||
if (header.bit_count < 16)
|
||||
|
@ -517,27 +517,27 @@ evas_image_load_file_data_bmp(void *loader_data,
|
|||
image_w = region_w = header.width;
|
||||
image_h = region_h = header.height;
|
||||
|
||||
if (opts->region.w > 0 && opts->region.h > 0)
|
||||
if (opts->emile.region.w > 0 && opts->emile.region.h > 0)
|
||||
{
|
||||
if ((opts->region.w + opts->region.x > header.width) ||
|
||||
(opts->region.h + opts->region.y > header.height))
|
||||
if ((opts->emile.region.w + opts->emile.region.x > header.width) ||
|
||||
(opts->emile.region.h + opts->emile.region.y > header.height))
|
||||
{
|
||||
*error = EVAS_LOAD_ERROR_GENERIC;
|
||||
goto close_file;
|
||||
}
|
||||
region_set = 1;
|
||||
region_x = opts->region.x;
|
||||
region_y = image_h - (opts->region.h + opts->region.y);
|
||||
region_w = opts->region.w;
|
||||
region_h = opts->region.h;
|
||||
region_x = opts->emile.region.x;
|
||||
region_y = image_h - (opts->emile.region.h + opts->emile.region.y);
|
||||
region_w = opts->emile.region.w;
|
||||
region_h = opts->emile.region.h;
|
||||
|
||||
header.width = opts->region.w;
|
||||
header.height = opts->region.h;
|
||||
header.width = opts->emile.region.w;
|
||||
header.height = opts->emile.region.h;
|
||||
}
|
||||
/* It is not bad idea that bmp loader support scale down decoding
|
||||
* because of memory issue in mobile world. */
|
||||
if (opts->scale_down_by > 1)
|
||||
scale_ratio = opts->scale_down_by;
|
||||
if (opts->emile.scale_down_by > 1)
|
||||
scale_ratio = opts->emile.scale_down_by;
|
||||
|
||||
if (scale_ratio > 1)
|
||||
{
|
||||
|
|
|
@ -217,23 +217,23 @@ _load(Eina_File *ef, const char *key,
|
|||
len = strlen(cmd);
|
||||
escape_copy(key, cmd + len);
|
||||
}
|
||||
if (opts->scale_down_by > 1)
|
||||
if (opts->emile.scale_down_by > 1)
|
||||
{
|
||||
strcat(cmd, " -opt-scale-down-by ");
|
||||
snprintf(buf, sizeof(buf), "%i", opts->scale_down_by);
|
||||
snprintf(buf, sizeof(buf), "%i", opts->emile.scale_down_by);
|
||||
strcat(cmd, buf);
|
||||
}
|
||||
if (opts->dpi > 0.0)
|
||||
if (opts->emile.dpi > 0.0)
|
||||
{
|
||||
strcat(cmd, " -opt-dpi ");
|
||||
snprintf(buf, sizeof(buf), "%i", (int)(opts->dpi * 1000.0));
|
||||
snprintf(buf, sizeof(buf), "%i", (int)(opts->emile.dpi * 1000.0));
|
||||
strcat(cmd, buf);
|
||||
}
|
||||
if ((opts->w > 0) &&
|
||||
(opts->h > 0))
|
||||
if ((opts->emile.w > 0) &&
|
||||
(opts->emile.h > 0))
|
||||
{
|
||||
strcat(cmd, " -opt-size ");
|
||||
snprintf(buf, sizeof(buf), "%i %i", opts->w, opts->h);
|
||||
snprintf(buf, sizeof(buf), "%i %i", opts->emile.w, opts->emile.h);
|
||||
strcat(cmd, buf);
|
||||
}
|
||||
f = popen(cmd, "r");
|
||||
|
|
|
@ -164,10 +164,10 @@ evas_image_load_file_head_ico(void *loader_data,
|
|||
// more ?
|
||||
|
||||
search = BIGGEST;
|
||||
if ((opts->w > 0) && (opts->h > 0))
|
||||
if ((opts->emile.w > 0) && (opts->emile.h > 0))
|
||||
{
|
||||
wanted_w = opts->w;
|
||||
wanted_h = opts->h;
|
||||
wanted_w = opts->emile.w;
|
||||
wanted_h = opts->emile.h;
|
||||
search = SMALLER;
|
||||
}
|
||||
|
||||
|
@ -396,10 +396,10 @@ evas_image_load_file_data_ico(void *loader_data,
|
|||
// more ?
|
||||
|
||||
search = BIGGEST;
|
||||
if ((opts->w > 0) && (opts->h > 0))
|
||||
if ((opts->emile.w > 0) && (opts->emile.h > 0))
|
||||
{
|
||||
wanted_w = opts->w;
|
||||
wanted_h = opts->h;
|
||||
wanted_w = opts->emile.w;
|
||||
wanted_h = opts->emile.h;
|
||||
search = SMALLER;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,8 @@ evas_image_load_file_open_jpeg(Eina_File *f, Eina_Stringshare *key EINA_UNUSED,
|
|||
Emile_Image *image;
|
||||
Emile_Image_Load_Error image_error;
|
||||
|
||||
image = emile_image_jpeg_file_open(f, opts, NULL, &image_error);
|
||||
image = emile_image_jpeg_file_open(f, opts ? &(opts->emile) : NULL,
|
||||
NULL, &image_error);
|
||||
if (!image)
|
||||
{
|
||||
*error = image_error;
|
||||
|
@ -39,13 +40,13 @@ evas_image_load_file_open_jpeg(Eina_File *f, Eina_Stringshare *key EINA_UNUSED,
|
|||
}
|
||||
|
||||
loader->image = image;
|
||||
if (opts && (opts->region.w > 0) && (opts->region.h > 0))
|
||||
if (opts && (opts->emile.region.w > 0) && (opts->emile.region.h > 0))
|
||||
{
|
||||
EINA_RECTANGLE_SET(&loader->region,
|
||||
opts->region.x,
|
||||
opts->region.y,
|
||||
opts->region.w,
|
||||
opts->region.h);
|
||||
opts->emile.region.x,
|
||||
opts->emile.region.y,
|
||||
opts->emile.region.w,
|
||||
opts->emile.region.h);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -157,29 +157,29 @@ evas_image_load_file_head_png(void *loader_data,
|
|||
goto close_file;
|
||||
}
|
||||
|
||||
if (opts->region.w > 0 && opts->region.h > 0)
|
||||
if (opts->emile.region.w > 0 && opts->emile.region.h > 0)
|
||||
{
|
||||
if (((int) w32 < opts->region.x + opts->region.w) ||
|
||||
((int) h32 < opts->region.y + opts->region.h))
|
||||
if (((int) w32 < opts->emile.region.x + opts->emile.region.w) ||
|
||||
((int) h32 < opts->emile.region.y + opts->emile.region.h))
|
||||
{
|
||||
*error = EVAS_LOAD_ERROR_GENERIC;
|
||||
goto close_file;
|
||||
}
|
||||
if(opts->scale_down_by > 1)
|
||||
if(opts->emile.scale_down_by > 1)
|
||||
{
|
||||
prop->w = opts->region.w / opts->scale_down_by;
|
||||
prop->h = opts->region.h / opts->scale_down_by;
|
||||
prop->w = opts->emile.region.w / opts->emile.scale_down_by;
|
||||
prop->h = opts->emile.region.h / opts->emile.scale_down_by;
|
||||
}
|
||||
else
|
||||
{
|
||||
prop->w = opts->region.w;
|
||||
prop->h = opts->region.h;
|
||||
prop->w = opts->emile.region.w;
|
||||
prop->h = opts->emile.region.h;
|
||||
}
|
||||
}
|
||||
else if (opts->scale_down_by > 1)
|
||||
else if (opts->emile.scale_down_by > 1)
|
||||
{
|
||||
prop->w = (int) w32 / opts->scale_down_by;
|
||||
prop->h = (int) h32 / opts->scale_down_by;
|
||||
prop->w = (int) w32 / opts->emile.scale_down_by;
|
||||
prop->h = (int) h32 / opts->emile.scale_down_by;
|
||||
if ((prop->w < 1) || (prop->h < 1))
|
||||
{
|
||||
*error = EVAS_LOAD_ERROR_GENERIC;
|
||||
|
@ -302,18 +302,18 @@ evas_image_load_file_data_png(void *loader_data,
|
|||
&interlace_type, NULL, NULL);
|
||||
image_w = w32;
|
||||
image_h = h32;
|
||||
if (opts->scale_down_by > 1)
|
||||
if (opts->emile.scale_down_by > 1)
|
||||
{
|
||||
scale_ratio = opts->scale_down_by;
|
||||
scale_ratio = opts->emile.scale_down_by;
|
||||
w32 /= scale_ratio;
|
||||
h32 /= scale_ratio;
|
||||
}
|
||||
|
||||
if ((opts->region.w > 0 && opts->region.h > 0) &&
|
||||
(opts->region.w != image_w || opts->region.h != image_h))
|
||||
if ((opts->emile.region.w > 0 && opts->emile.region.h > 0) &&
|
||||
(opts->emile.region.w != image_w || opts->emile.region.h != image_h))
|
||||
{
|
||||
w32 = opts->region.w / scale_ratio;
|
||||
h32 = opts->region.h / scale_ratio;
|
||||
w32 = opts->emile.region.w / scale_ratio;
|
||||
h32 = opts->emile.region.h / scale_ratio;
|
||||
region_set = 1;
|
||||
}
|
||||
|
||||
|
@ -401,8 +401,8 @@ evas_image_load_file_data_png(void *loader_data,
|
|||
|
||||
if (region_set)
|
||||
{
|
||||
region_x = opts->region.x;
|
||||
region_y = opts->region.y;
|
||||
region_x = opts->emile.region.x;
|
||||
region_y = opts->emile.region.y;
|
||||
}
|
||||
|
||||
if (passes == 1)
|
||||
|
|
|
@ -24,7 +24,8 @@ evas_image_load_file_open_tgv(Eina_File *f, Eina_Stringshare *key EINA_UNUSED,
|
|||
Emile_Image *image;
|
||||
Emile_Image_Load_Error image_error;
|
||||
|
||||
image = emile_image_tgv_file_open(f, opts, NULL, &image_error);
|
||||
image = emile_image_tgv_file_open(f, opts ? &(opts->emile) : NULL,
|
||||
NULL, &image_error);
|
||||
if (!image)
|
||||
{
|
||||
*error = image_error;
|
||||
|
@ -39,13 +40,13 @@ evas_image_load_file_open_tgv(Eina_File *f, Eina_Stringshare *key EINA_UNUSED,
|
|||
}
|
||||
|
||||
loader->image = image;
|
||||
if (opts && (opts->region.w > 0) && (opts->region.h > 0))
|
||||
if (opts && (opts->emile.region.w > 0) && (opts->emile.region.h > 0))
|
||||
{
|
||||
EINA_RECTANGLE_SET(&loader->region,
|
||||
opts->region.x,
|
||||
opts->region.y,
|
||||
opts->region.w,
|
||||
opts->region.h);
|
||||
opts->emile.region.x,
|
||||
opts->emile.region.y,
|
||||
opts->emile.region.w,
|
||||
opts->emile.region.h);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue