From: Eduardo Felipe <eduardofelipe87@gmail.com>

Subject: [E-devel] [PATCH] Fix ethumbd FDO and orientation support

Add-orientation-support-to-ethumbd



SVN revision: 57042
This commit is contained in:
Eduardo Felipe 2011-02-15 09:29:58 +00:00 committed by Carsten Haitzler
parent bd9d4c5019
commit e5cb523f07
3 changed files with 46 additions and 0 deletions

View File

@ -68,6 +68,7 @@ struct _Ethumb_Setup
Eina_Bool size : 1;
Eina_Bool format : 1;
Eina_Bool aspect : 1;
Eina_Bool orientation: 1;
Eina_Bool crop : 1;
Eina_Bool quality : 1;
Eina_Bool compress : 1;
@ -85,6 +86,7 @@ struct _Ethumb_Setup
int tw, th;
int format;
int aspect;
int orientation;
float cx, cy;
int quality;
int compress;
@ -515,6 +517,7 @@ _ethumbd_pipe_write_setup(struct _Ethumbd *ed, int type, const void *data)
case ETHUMBD_FDO:
case ETHUMBD_FORMAT:
case ETHUMBD_ASPECT:
case ETHUMBD_ORIENTATION:
case ETHUMBD_QUALITY:
case ETHUMBD_COMPRESS:
case ETHUMBD_SIZE_W:
@ -569,6 +572,8 @@ _process_setup(struct _Ethumbd *ed)
_ethumbd_pipe_write_setup(ed, ETHUMBD_FORMAT, &setup->format);
if (setup->flags.aspect)
_ethumbd_pipe_write_setup(ed, ETHUMBD_ASPECT, &setup->aspect);
if (setup->flags.orientation)
_ethumbd_pipe_write_setup(ed, ETHUMBD_ORIENTATION, &setup->orientation);
if (setup->flags.crop)
{
_ethumbd_pipe_write_setup(ed, ETHUMBD_CROP_X, &setup->cx);
@ -1239,6 +1244,27 @@ _ethumb_dbus_aspect_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIt
return 1;
}
static int
_ethumb_dbus_orientation_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request)
{
int type;
dbus_int32_t orientation;
type = dbus_message_iter_get_arg_type(iter);
if (type != DBUS_TYPE_INT32)
{
ERR("invalid param for orientation_set.");
return 0;
}
dbus_message_iter_get_basic(iter, &orientation);
DBG("setting orientation to: %d", orientation);
request->setup.flags.orientation = 1;
request->setup.orientation = orientation;
return 1;
}
static int
_ethumb_dbus_crop_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request)
{
@ -1514,6 +1540,7 @@ static struct
{"size", _ethumb_dbus_size_set},
{"format", _ethumb_dbus_format_set},
{"aspect", _ethumb_dbus_aspect_set},
{"orientation", _ethumb_dbus_orientation_set},
{"crop", _ethumb_dbus_crop_set},
{"quality", _ethumb_dbus_quality_set},
{"compress", _ethumb_dbus_compress_set},

View File

@ -348,6 +348,21 @@ _ec_aspect_set(struct _Ethumbd_Child *ec, Ethumb *e)
return 1;
}
static int
_ec_orientation_set(struct _Ethumbd_Child *ec, Ethumb *e)
{
int r;
int value;
r = _ec_read_safe(STDIN_FILENO, &value, sizeof(value));
if (!r)
return 0;
ethumb_thumb_orientation_set(e, value);
DBG("orientation = %d", value);
return 1;
}
static int
_ec_crop_set(struct _Ethumbd_Child *ec, Ethumb *e)
{
@ -574,6 +589,9 @@ _ec_setup_process(struct _Ethumbd_Child *ec, int index, int type)
case ETHUMBD_ASPECT:
_ec_aspect_set(ec, e);
break;
case ETHUMBD_ORIENTATION:
_ec_orientation_set(ec, e);
break;
case ETHUMBD_CROP_X:
_ec_crop_set(ec, e);
break;

View File

@ -17,6 +17,7 @@ enum Ethubmd_Setup_Option
ETHUMBD_SIZE_H,
ETHUMBD_FORMAT,
ETHUMBD_ASPECT,
ETHUMBD_ORIENTATION,
ETHUMBD_CROP_X,
ETHUMBD_CROP_Y,
ETHUMBD_QUALITY,