add "region" load opt. no loader handles it... yet
SVN revision: 42494
This commit is contained in:
parent
7fe73280d6
commit
f780cc2c8f
|
@ -34,6 +34,9 @@ struct _Lopt
|
|||
int scale_down_by; // if > 1 then use this
|
||||
double dpi; // if > 0.0 use this
|
||||
int w, h; // if > 0 use this
|
||||
struct {
|
||||
int x, y, w, h;
|
||||
} region;
|
||||
};
|
||||
|
||||
struct _Img
|
||||
|
@ -957,7 +960,7 @@ message(void *fdata, Server *s, Client *c, int opcode, int size, unsigned char *
|
|||
Op_Load *rep;
|
||||
Op_Load_Reply msg;
|
||||
Img *img;
|
||||
RGBA_Image_Loadopts lopt = {0, 0.0, 0, 0};
|
||||
RGBA_Image_Loadopts lopt = {0, 0.0, 0, 0, 0, 0, 0, 0};
|
||||
char *file = NULL, *key = NULL;
|
||||
|
||||
D("OP_LOAD %i", c->pid);
|
||||
|
@ -969,11 +972,16 @@ message(void *fdata, Server *s, Client *c, int opcode, int size, unsigned char *
|
|||
lopt.dpi = rep->lopt.dpi;
|
||||
lopt.w = rep->lopt.w;
|
||||
lopt.h = rep->lopt.h;
|
||||
lopt.region.x = rep->lopt.region.x;
|
||||
lopt.region.y = rep->lopt.region.y;
|
||||
lopt.region.w = rep->lopt.region.w;
|
||||
lopt.region.h = rep->lopt.region.h;
|
||||
D("... img_load '%s'", file);
|
||||
if (key) D("'%s'", key);
|
||||
else D(" '%s'", NULL);
|
||||
D(" lopt { %i %1.1f %i %i}",
|
||||
lopt.scale_down_by, lopt.dpi, lopt.w, lopt.h);
|
||||
D(" lopt { %i %1.1f %i %i { %i %i %i %i}}",
|
||||
lopt.scale_down_by, lopt.dpi, lopt.w, lopt.h,
|
||||
lopt.region.x, lopt.region.y, lopt.region.w, lopt.region.h);
|
||||
img = img_load(file, key, &lopt);
|
||||
D("... img_load = %p", img);
|
||||
if (img)
|
||||
|
|
|
@ -595,6 +595,9 @@ extern "C" {
|
|||
EAPI void evas_object_image_load_size_get (const Evas_Object *obj, int *w, int *h) EINA_ARG_NONNULL(1);
|
||||
EAPI void evas_object_image_load_scale_down_set (Evas_Object *obj, int scale_down) EINA_ARG_NONNULL(1);
|
||||
EAPI int evas_object_image_load_scale_down_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
|
||||
EAPI void evas_object_image_load_region_set (Evas_Object *obj, int x, int y, int w, int h) EINA_ARG_NONNULL(1);
|
||||
EAPI void evas_object_image_load_region_get (const Evas_Object *obj, int *x, int *y, int *w, int *h) EINA_ARG_NONNULL(1);
|
||||
|
||||
EAPI void evas_object_image_colorspace_set (Evas_Object *obj, Evas_Colorspace cspace) EINA_ARG_NONNULL(1);
|
||||
EAPI Evas_Colorspace evas_object_image_colorspace_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
|
||||
EAPI void evas_object_image_native_surface_set (Evas_Object *obj, Evas_Native_Surface *surf) EINA_ARG_NONNULL(1, 2);
|
||||
|
|
|
@ -239,6 +239,10 @@ _evas_cache_image_entry_new(Evas_Cache_Image *cache,
|
|||
ie->load_opts.dpi = 0;
|
||||
ie->load_opts.w = 0;
|
||||
ie->load_opts.h = 0;
|
||||
ie->load_opts.region.x = 0;
|
||||
ie->load_opts.region.y = 0;
|
||||
ie->load_opts.region.w = 0;
|
||||
ie->load_opts.region.h = 0;
|
||||
ie->scale = 1;
|
||||
|
||||
#ifdef BUILD_ASYNC_PRELOAD
|
||||
|
@ -603,7 +607,7 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *
|
|||
const char *format;
|
||||
char *hkey;
|
||||
Image_Entry *im;
|
||||
Evas_Image_Load_Opts prevent = { 0, 0, 0, 0 };
|
||||
Evas_Image_Load_Opts prevent = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
int size;
|
||||
int stat_done = 0;
|
||||
int file_length;
|
||||
|
@ -1255,7 +1259,6 @@ _evas_cache_background_load(void *data)
|
|||
|
||||
pthread_mutex_unlock(&mutex);
|
||||
|
||||
printf("load loop!\n");
|
||||
if (current)
|
||||
{
|
||||
Evas_Cache_Image *cache;
|
||||
|
@ -1290,7 +1293,6 @@ _evas_cache_background_load(void *data)
|
|||
_evas_cache_image_async_call(current);
|
||||
current = NULL;
|
||||
}
|
||||
printf("---\n");
|
||||
|
||||
pthread_cond_signal(&cond_done);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ struct _Evas_Object_Image
|
|||
int spread;
|
||||
Evas_Coord_Rectangle fill;
|
||||
struct {
|
||||
short w, h, stride;
|
||||
short w, h, stride;
|
||||
} image;
|
||||
struct {
|
||||
short l, r, t, b;
|
||||
|
@ -46,6 +46,9 @@ struct _Evas_Object_Image
|
|||
unsigned char scale_down_by;
|
||||
double dpi;
|
||||
short w, h;
|
||||
struct {
|
||||
short x, y, w, h;
|
||||
} region;
|
||||
} load_opts;
|
||||
|
||||
struct {
|
||||
|
@ -292,6 +295,10 @@ evas_object_image_file_set(Evas_Object *obj, const char *file, const char *key)
|
|||
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;
|
||||
o->engine_data = obj->layer->evas->engine.func->image_load(obj->layer->evas->engine.data.output,
|
||||
o->cur.file,
|
||||
o->cur.key,
|
||||
|
@ -1718,6 +1725,57 @@ evas_object_image_load_scale_down_get(const Evas_Object *obj)
|
|||
return o->load_opts.scale_down_by;
|
||||
}
|
||||
|
||||
/**
|
||||
* To be documented.
|
||||
*
|
||||
* FIXME: To be fixed.
|
||||
*
|
||||
*/
|
||||
EAPI void
|
||||
evas_object_image_load_region_set(Evas_Object *obj, int x, int y, int w, int h)
|
||||
{
|
||||
Evas_Object_Image *o;
|
||||
|
||||
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
||||
return;
|
||||
MAGIC_CHECK_END();
|
||||
o = (Evas_Object_Image *)(obj->object_data);
|
||||
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
||||
return;
|
||||
MAGIC_CHECK_END();
|
||||
if ((o->load_opts.region.x == x) && (o->load_opts.region.y == y) &&
|
||||
(o->load_opts.region.w == w) && (o->load_opts.region.h == h)) return;
|
||||
o->load_opts.region.x = x;
|
||||
o->load_opts.region.y = y;
|
||||
o->load_opts.region.w = w;
|
||||
o->load_opts.region.h = h;
|
||||
if (o->cur.file)
|
||||
{
|
||||
evas_object_image_unload(obj, 0);
|
||||
evas_object_image_load(obj);
|
||||
o->changed = 1;
|
||||
evas_object_change(obj);
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_object_image_load_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
|
||||
{
|
||||
Evas_Object_Image *o;
|
||||
|
||||
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
||||
return;
|
||||
MAGIC_CHECK_END();
|
||||
o = (Evas_Object_Image *)(obj->object_data);
|
||||
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
||||
return;
|
||||
MAGIC_CHECK_END();
|
||||
if (x) *x = o->load_opts.region.x;
|
||||
if (y) *y = o->load_opts.region.y;
|
||||
if (w) *w = o->load_opts.region.w;
|
||||
if (h) *h = o->load_opts.region.h;
|
||||
}
|
||||
|
||||
/**
|
||||
* To be documented.
|
||||
*
|
||||
|
@ -1994,6 +2052,10 @@ evas_object_image_load(Evas_Object *obj)
|
|||
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;
|
||||
o->engine_data = obj->layer->evas->engine.func->image_load(obj->layer->evas->engine.data.output,
|
||||
o->cur.file,
|
||||
o->cur.key,
|
||||
|
|
|
@ -134,6 +134,9 @@ typedef struct
|
|||
int scale_down_by;
|
||||
double dpi;
|
||||
int w, h;
|
||||
struct {
|
||||
int x, y, w, h;
|
||||
} region;
|
||||
} lopt;
|
||||
} Op_Load; // +"file""key"
|
||||
typedef struct
|
||||
|
|
|
@ -298,6 +298,10 @@ evas_cserve_image_load(Image_Entry *ie, const char *file, const char *key, RGBA_
|
|||
msg.lopt.dpi = lopt->dpi;
|
||||
msg.lopt.w = lopt->w;
|
||||
msg.lopt.h = lopt->h;
|
||||
msg.lopt.region.x = lopt->region.x;
|
||||
msg.lopt.region.y = lopt->region.y;
|
||||
msg.lopt.region.w = lopt->region.w;
|
||||
msg.lopt.region.h = lopt->region.h;
|
||||
if (file[0] != '/')
|
||||
{
|
||||
if (getcwd(wdb, sizeof(wdb)))
|
||||
|
|
|
@ -409,6 +409,9 @@ struct _RGBA_Image_Loadopts
|
|||
int scale_down_by; // if > 1 then use this
|
||||
double dpi; // if > 0.0 use this
|
||||
int w, h; // if > 0 use this
|
||||
struct {
|
||||
int x, y, w, h;
|
||||
} region;
|
||||
};
|
||||
|
||||
struct _Image_Entry_Flags
|
||||
|
|
|
@ -104,6 +104,12 @@ evas_image_load_file_head_jpeg_internal(Image_Entry *ie, FILE *f)
|
|||
/* head decoding */
|
||||
w = cinfo.output_width;
|
||||
h = cinfo.output_height;
|
||||
if ((ie->load_opts.region.w > 0) && (ie->load_opts.region.h > 0))
|
||||
{
|
||||
RECTS_CLIP_TO_RECT(ie->load_opts.region.x, ie->load_opts.region.y,
|
||||
ie->load_opts.region.w, ie->load_opts.region.h,
|
||||
0, 0, w, h);
|
||||
}
|
||||
if ((w < 1) || (h < 1) || (w > IMG_MAX_SIZE) || (h > IMG_MAX_SIZE))
|
||||
{
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
|
@ -176,6 +182,7 @@ evas_image_load_file_head_jpeg_internal(Image_Entry *ie, FILE *f)
|
|||
jpeg_start_decompress(&cinfo);
|
||||
}
|
||||
|
||||
// FIXME: handle region if specified
|
||||
ie->w = cinfo.output_width;
|
||||
ie->h = cinfo.output_height;
|
||||
/* end head decoding */
|
||||
|
|
Loading…
Reference in New Issue