forked from enlightenment/efl
evas/cserve2: simplify more
Remove Image_Load_Opts and use Evas_Image_Load_Opts for cs2 master to slave communication. 2 things to note: - The struct size is bigger (but at the same time we removed a memcpy) - The scale_load field is not passed to the slave
This commit is contained in:
parent
46b7baa379
commit
7c7c231015
|
@ -59,16 +59,6 @@ struct _Client {
|
|||
|
||||
typedef struct _Client Client;
|
||||
|
||||
struct _Image_Load_Opts {
|
||||
unsigned int w, h;
|
||||
unsigned int rx, ry, rw, rh;
|
||||
unsigned int scale_down_by;
|
||||
double dpi;
|
||||
Eina_Bool orientation;
|
||||
};
|
||||
|
||||
typedef struct _Image_Load_Opts Image_Load_Opts;
|
||||
|
||||
typedef enum {
|
||||
IMAGE_OPEN,
|
||||
IMAGE_LOAD,
|
||||
|
@ -100,7 +90,7 @@ struct _Slave_Msg_Image_Opened {
|
|||
|
||||
struct _Slave_Msg_Image_Load {
|
||||
int w, h;
|
||||
Image_Load_Opts opts;
|
||||
Evas_Image_Load_Opts opts;
|
||||
struct {
|
||||
int mmap_offset;
|
||||
int image_offset;
|
||||
|
|
|
@ -447,12 +447,11 @@ _load_request_build(Image_Data *i, int *bufsize)
|
|||
msg.w = i->file->w;
|
||||
msg.h = i->file->h;
|
||||
msg.alpha = i->file->alpha;
|
||||
|
||||
// NOTE: Not passing scale_load options
|
||||
msg.opts.w = i->opts.w;
|
||||
msg.opts.h = i->opts.h;
|
||||
msg.opts.rx = i->opts.region.x;
|
||||
msg.opts.ry = i->opts.region.y;
|
||||
msg.opts.rw = i->opts.region.w;
|
||||
msg.opts.rh = i->opts.region.h;
|
||||
msg.opts.region = i->opts.region;
|
||||
msg.opts.scale_down_by = i->opts.scale_down_by;
|
||||
msg.opts.dpi = i->opts.dpi;
|
||||
msg.opts.orientation = i->opts.orientation;
|
||||
|
|
|
@ -239,25 +239,6 @@ _cserve2_shm_unmap(void *map, size_t length)
|
|||
munmap(map, length);
|
||||
}
|
||||
|
||||
static void
|
||||
_image_load_opts_copy(Evas_Image_Load_Opts *load_opts, Image_Load_Opts *opts)
|
||||
{
|
||||
memset(load_opts, 0, sizeof (Evas_Image_Load_Opts));
|
||||
if (opts)
|
||||
{
|
||||
load_opts->w = opts->w;
|
||||
load_opts->h = opts->h;
|
||||
load_opts->dpi = opts->dpi;
|
||||
load_opts->region.x = opts->rx;
|
||||
load_opts->region.y = opts->ry;
|
||||
load_opts->region.w = opts->rw;
|
||||
load_opts->region.h = opts->rh;
|
||||
load_opts->orientation = opts->orientation;
|
||||
load_opts->scale_down_by = opts->scale_down_by;
|
||||
}
|
||||
// Not set here: struct load_opts.scale_load
|
||||
}
|
||||
|
||||
static void *
|
||||
_image_file_open(Eina_File *fd, Eina_Stringshare *key, Evas_Image_Load_Opts *load_opts,
|
||||
Evas_Module *module, Evas_Image_Property *property,
|
||||
|
@ -423,8 +404,7 @@ image_load(const char *file, const char *key, const char *shmfile,
|
|||
Evas_Module *module;
|
||||
Eina_File *fd;
|
||||
Evas_Image_Load_Func *funcs = NULL;
|
||||
Image_Load_Opts *opts = ¶ms->opts;
|
||||
Evas_Image_Load_Opts load_opts;
|
||||
Evas_Image_Load_Opts *opts = ¶ms->opts;
|
||||
Evas_Image_Property property;
|
||||
Evas_Image_Animated animated;
|
||||
Error_Type ret = CSERVE2_GENERIC;
|
||||
|
@ -460,8 +440,7 @@ image_load(const char *file, const char *key, const char *shmfile,
|
|||
property.h = params->h;
|
||||
|
||||
skey = eina_stringshare_add(key);
|
||||
_image_load_opts_copy(&load_opts, opts);
|
||||
loader_data = _image_file_open(fd, skey, &load_opts, module, &property, &animated, &funcs);
|
||||
loader_data = _image_file_open(fd, skey, opts, module, &property, &animated, &funcs);
|
||||
if (!loader_data)
|
||||
{
|
||||
printf("LOAD failed at %s:%d: could not open image %s:%s\n",
|
||||
|
|
Loading…
Reference in New Issue