summaryrefslogtreecommitdiff
path: root/src/lib/ethumb
diff options
context:
space:
mode:
authorwonguk.jeong <wonguk.jeong@samsung.com>2014-07-08 14:31:02 +0200
committerCedric BAIL <c.bail@partner.samsung.com>2014-07-08 14:50:44 +0200
commitae5a5b3b966a159e2716258c24a921a68335e8c2 (patch)
tree7ff2961bda9a0efff1a25d0a67c52333178b221b /src/lib/ethumb
parent826f85675c74c3886d98b45e0b31cc155c77781c (diff)
ethumb: support ETHUMB_THUMB_ORIENT_ORIGINAL without libexif
Summary: Since there is infra to support EXIF orientation in the loaders, we don't need to use libexif explicitely. (Currently jpeg loader support EXIF orientaion fully.) @fix Test Plan: generate thumbnail of "Light_exif_*.jpg" in efl/src/tests/evas/image/ -> check whether the image is rotated properly or not Reviewers: raster, cedric CC: seoz, cedric Differential Revision: https://phab.enlightenment.org/D1142 Signed-off-by: Cedric BAIL <c.bail@partner.samsung.com>
Diffstat (limited to 'src/lib/ethumb')
-rw-r--r--src/lib/ethumb/ethumb.c62
1 files changed, 7 insertions, 55 deletions
diff --git a/src/lib/ethumb/ethumb.c b/src/lib/ethumb/ethumb.c
index 76538e958f..20b7b7d5e7 100644
--- a/src/lib/ethumb/ethumb.c
+++ b/src/lib/ethumb/ethumb.c
@@ -53,10 +53,6 @@
53# define PATH_MAX 4096 53# define PATH_MAX 4096
54#endif 54#endif
55 55
56#ifdef HAVE_LIBEXIF
57 #include <libexif/exif-data.h>
58#endif
59
60#ifdef HAVE_EVIL 56#ifdef HAVE_EVIL
61# include <Evil.h> 57# include <Evil.h>
62#endif 58#endif
@@ -1542,7 +1538,6 @@ _ethumb_image_load(Ethumb *e)
1542 int error; 1538 int error;
1543 Evas_Coord w, h, ww, hh, fx, fy, fw, fh; 1539 Evas_Coord w, h, ww, hh, fx, fy, fw, fh;
1544 Evas_Object *img; 1540 Evas_Object *img;
1545 int orientation = ETHUMB_THUMB_ORIENT_NONE;
1546 1541
1547 img = e->img; 1542 img = e->img;
1548 1543
@@ -1552,6 +1547,10 @@ _ethumb_image_load(Ethumb *e)
1552 evas_object_hide(img); 1547 evas_object_hide(img);
1553 evas_object_image_file_set(img, NULL, NULL); 1548 evas_object_image_file_set(img, NULL, NULL);
1554 evas_object_image_load_size_set(img, e->tw, e->th); 1549 evas_object_image_load_size_set(img, e->tw, e->th);
1550
1551 if (e->orientation == ETHUMB_THUMB_ORIENT_ORIGINAL)
1552 evas_object_image_load_orientation_set(img, EINA_TRUE);
1553
1555 evas_object_image_file_set(img, e->src_path, e->src_key); 1554 evas_object_image_file_set(img, e->src_path, e->src_key);
1556 1555
1557 if (e->frame) 1556 if (e->frame)
@@ -1566,56 +1565,9 @@ _ethumb_image_load(Ethumb *e)
1566 return 0; 1565 return 0;
1567 } 1566 }
1568 1567
1569 if (e->orientation == ETHUMB_THUMB_ORIENT_ORIGINAL) 1568 if (e->orientation != ETHUMB_THUMB_ORIENT_NONE &&
1570 { 1569 e->orientation != ETHUMB_THUMB_ORIENT_ORIGINAL)
1571 /* TODO: rewrite to not need libexif just to get this */ 1570 _ethumb_image_orient(e, e->orientation);
1572#ifdef HAVE_LIBEXIF
1573 ExifData *exif = exif_data_new_from_file(e->src_path);
1574 ExifEntry *entry = NULL;
1575 ExifByteOrder bo;
1576 int o = 0;
1577
1578 if (exif)
1579 {
1580 entry = exif_data_get_entry(exif, EXIF_TAG_ORIENTATION);
1581 if (entry)
1582 {
1583 bo = exif_data_get_byte_order(exif);
1584 o = exif_get_short(entry->data, bo);
1585 }
1586 exif_data_free(exif);
1587 switch (o)
1588 {
1589 case 2:
1590 orientation = ETHUMB_THUMB_FLIP_HORIZONTAL;
1591 break;
1592 case 3:
1593 orientation = ETHUMB_THUMB_ROTATE_180;
1594 break;
1595 case 4:
1596 orientation = ETHUMB_THUMB_FLIP_VERTICAL;
1597 break;
1598 case 5:
1599 orientation = ETHUMB_THUMB_FLIP_TRANSPOSE;
1600 break;
1601 case 6:
1602 orientation = ETHUMB_THUMB_ROTATE_90_CW;
1603 break;
1604 case 7:
1605 orientation = ETHUMB_THUMB_FLIP_TRANSVERSE;
1606 break;
1607 case 8:
1608 orientation = ETHUMB_THUMB_ROTATE_90_CCW;
1609 break;
1610 }
1611 }
1612#endif
1613 }
1614 else
1615 orientation = e->orientation;
1616
1617 if (orientation != ETHUMB_THUMB_ORIENT_NONE)
1618 _ethumb_image_orient(e, orientation);
1619 1571
1620 evas_object_image_size_get(img, &w, &h); 1572 evas_object_image_size_get(img, &w, &h);
1621 if ((w <= 0) || (h <= 0)) 1573 if ((w <= 0) || (h <= 0))