summaryrefslogtreecommitdiff
path: root/legacy/ethumb
diff options
context:
space:
mode:
authorEduardo Felipe <eduardofelipe87@gmail.com>2011-02-15 09:29:58 +0000
committerCarsten Haitzler <raster@rasterman.com>2011-02-15 09:29:58 +0000
commite5cb523f071b7a1314692dc154c280cf4f067560 (patch)
tree0bda47b7525c0620559de3b5d8bb5a98f267a452 /legacy/ethumb
parentbd9d4c5019649f8162f66c18169da82f0a831a85 (diff)
From: Eduardo Felipe <eduardofelipe87@gmail.com>
Subject: [E-devel] [PATCH] Fix ethumbd FDO and orientation support Add-orientation-support-to-ethumbd SVN revision: 57042
Diffstat (limited to '')
-rw-r--r--legacy/ethumb/src/bin/ethumbd.c27
-rw-r--r--legacy/ethumb/src/bin/ethumbd_child.c18
-rw-r--r--legacy/ethumb/src/bin/ethumbd_private.h1
3 files changed, 46 insertions, 0 deletions
diff --git a/legacy/ethumb/src/bin/ethumbd.c b/legacy/ethumb/src/bin/ethumbd.c
index 0de7ed5731..ec7ebe4115 100644
--- a/legacy/ethumb/src/bin/ethumbd.c
+++ b/legacy/ethumb/src/bin/ethumbd.c
@@ -68,6 +68,7 @@ struct _Ethumb_Setup
68 Eina_Bool size : 1; 68 Eina_Bool size : 1;
69 Eina_Bool format : 1; 69 Eina_Bool format : 1;
70 Eina_Bool aspect : 1; 70 Eina_Bool aspect : 1;
71 Eina_Bool orientation: 1;
71 Eina_Bool crop : 1; 72 Eina_Bool crop : 1;
72 Eina_Bool quality : 1; 73 Eina_Bool quality : 1;
73 Eina_Bool compress : 1; 74 Eina_Bool compress : 1;
@@ -85,6 +86,7 @@ struct _Ethumb_Setup
85 int tw, th; 86 int tw, th;
86 int format; 87 int format;
87 int aspect; 88 int aspect;
89 int orientation;
88 float cx, cy; 90 float cx, cy;
89 int quality; 91 int quality;
90 int compress; 92 int compress;
@@ -515,6 +517,7 @@ _ethumbd_pipe_write_setup(struct _Ethumbd *ed, int type, const void *data)
515 case ETHUMBD_FDO: 517 case ETHUMBD_FDO:
516 case ETHUMBD_FORMAT: 518 case ETHUMBD_FORMAT:
517 case ETHUMBD_ASPECT: 519 case ETHUMBD_ASPECT:
520 case ETHUMBD_ORIENTATION:
518 case ETHUMBD_QUALITY: 521 case ETHUMBD_QUALITY:
519 case ETHUMBD_COMPRESS: 522 case ETHUMBD_COMPRESS:
520 case ETHUMBD_SIZE_W: 523 case ETHUMBD_SIZE_W:
@@ -569,6 +572,8 @@ _process_setup(struct _Ethumbd *ed)
569 _ethumbd_pipe_write_setup(ed, ETHUMBD_FORMAT, &setup->format); 572 _ethumbd_pipe_write_setup(ed, ETHUMBD_FORMAT, &setup->format);
570 if (setup->flags.aspect) 573 if (setup->flags.aspect)
571 _ethumbd_pipe_write_setup(ed, ETHUMBD_ASPECT, &setup->aspect); 574 _ethumbd_pipe_write_setup(ed, ETHUMBD_ASPECT, &setup->aspect);
575 if (setup->flags.orientation)
576 _ethumbd_pipe_write_setup(ed, ETHUMBD_ORIENTATION, &setup->orientation);
572 if (setup->flags.crop) 577 if (setup->flags.crop)
573 { 578 {
574 _ethumbd_pipe_write_setup(ed, ETHUMBD_CROP_X, &setup->cx); 579 _ethumbd_pipe_write_setup(ed, ETHUMBD_CROP_X, &setup->cx);
@@ -1240,6 +1245,27 @@ _ethumb_dbus_aspect_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIt
1240} 1245}
1241 1246
1242static int 1247static int
1248_ethumb_dbus_orientation_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request)
1249{
1250 int type;
1251 dbus_int32_t orientation;
1252
1253 type = dbus_message_iter_get_arg_type(iter);
1254 if (type != DBUS_TYPE_INT32)
1255 {
1256 ERR("invalid param for orientation_set.");
1257 return 0;
1258 }
1259
1260 dbus_message_iter_get_basic(iter, &orientation);
1261 DBG("setting orientation to: %d", orientation);
1262 request->setup.flags.orientation = 1;
1263 request->setup.orientation = orientation;
1264
1265 return 1;
1266}
1267
1268static int
1243_ethumb_dbus_crop_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request) 1269_ethumb_dbus_crop_set(struct _Ethumb_Object *eobject __UNUSED__, DBusMessageIter *iter, struct _Ethumb_Request *request)
1244{ 1270{
1245 DBusMessageIter oiter; 1271 DBusMessageIter oiter;
@@ -1514,6 +1540,7 @@ static struct
1514 {"size", _ethumb_dbus_size_set}, 1540 {"size", _ethumb_dbus_size_set},
1515 {"format", _ethumb_dbus_format_set}, 1541 {"format", _ethumb_dbus_format_set},
1516 {"aspect", _ethumb_dbus_aspect_set}, 1542 {"aspect", _ethumb_dbus_aspect_set},
1543 {"orientation", _ethumb_dbus_orientation_set},
1517 {"crop", _ethumb_dbus_crop_set}, 1544 {"crop", _ethumb_dbus_crop_set},
1518 {"quality", _ethumb_dbus_quality_set}, 1545 {"quality", _ethumb_dbus_quality_set},
1519 {"compress", _ethumb_dbus_compress_set}, 1546 {"compress", _ethumb_dbus_compress_set},
diff --git a/legacy/ethumb/src/bin/ethumbd_child.c b/legacy/ethumb/src/bin/ethumbd_child.c
index 66ded383a2..38b155d0d6 100644
--- a/legacy/ethumb/src/bin/ethumbd_child.c
+++ b/legacy/ethumb/src/bin/ethumbd_child.c
@@ -349,6 +349,21 @@ _ec_aspect_set(struct _Ethumbd_Child *ec, Ethumb *e)
349} 349}
350 350
351static int 351static int
352_ec_orientation_set(struct _Ethumbd_Child *ec, Ethumb *e)
353{
354 int r;
355 int value;
356
357 r = _ec_read_safe(STDIN_FILENO, &value, sizeof(value));
358 if (!r)
359 return 0;
360 ethumb_thumb_orientation_set(e, value);
361 DBG("orientation = %d", value);
362
363 return 1;
364}
365
366static int
352_ec_crop_set(struct _Ethumbd_Child *ec, Ethumb *e) 367_ec_crop_set(struct _Ethumbd_Child *ec, Ethumb *e)
353{ 368{
354 int r; 369 int r;
@@ -574,6 +589,9 @@ _ec_setup_process(struct _Ethumbd_Child *ec, int index, int type)
574 case ETHUMBD_ASPECT: 589 case ETHUMBD_ASPECT:
575 _ec_aspect_set(ec, e); 590 _ec_aspect_set(ec, e);
576 break; 591 break;
592 case ETHUMBD_ORIENTATION:
593 _ec_orientation_set(ec, e);
594 break;
577 case ETHUMBD_CROP_X: 595 case ETHUMBD_CROP_X:
578 _ec_crop_set(ec, e); 596 _ec_crop_set(ec, e);
579 break; 597 break;
diff --git a/legacy/ethumb/src/bin/ethumbd_private.h b/legacy/ethumb/src/bin/ethumbd_private.h
index c8ac4d0f8d..688eaddd6b 100644
--- a/legacy/ethumb/src/bin/ethumbd_private.h
+++ b/legacy/ethumb/src/bin/ethumbd_private.h
@@ -17,6 +17,7 @@ enum Ethubmd_Setup_Option
17 ETHUMBD_SIZE_H, 17 ETHUMBD_SIZE_H,
18 ETHUMBD_FORMAT, 18 ETHUMBD_FORMAT,
19 ETHUMBD_ASPECT, 19 ETHUMBD_ASPECT,
20 ETHUMBD_ORIENTATION,
20 ETHUMBD_CROP_X, 21 ETHUMBD_CROP_X,
21 ETHUMBD_CROP_Y, 22 ETHUMBD_CROP_Y,
22 ETHUMBD_QUALITY, 23 ETHUMBD_QUALITY,