cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=ae5a5b3b966a159e2716258c24a921a68335e8c2

commit ae5a5b3b966a159e2716258c24a921a68335e8c2
Author: wonguk.jeong <wonguk.je...@samsung.com>
Date:   Tue Jul 8 14:31:02 2014 +0200

    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.b...@partner.samsung.com>
---
 src/lib/ethumb/ethumb.c | 62 ++++++-------------------------------------------
 1 file changed, 7 insertions(+), 55 deletions(-)

diff --git a/src/lib/ethumb/ethumb.c b/src/lib/ethumb/ethumb.c
index 76538e9..20b7b7d 100644
--- a/src/lib/ethumb/ethumb.c
+++ b/src/lib/ethumb/ethumb.c
@@ -53,10 +53,6 @@
 # define PATH_MAX 4096
 #endif
 
-#ifdef HAVE_LIBEXIF
-  #include <libexif/exif-data.h>
-#endif
-
 #ifdef HAVE_EVIL
 # include <Evil.h>
 #endif
@@ -1542,7 +1538,6 @@ _ethumb_image_load(Ethumb *e)
    int error;
    Evas_Coord w, h, ww, hh, fx, fy, fw, fh;
    Evas_Object *img;
-   int orientation = ETHUMB_THUMB_ORIENT_NONE;
 
    img = e->img;
 
@@ -1552,6 +1547,10 @@ _ethumb_image_load(Ethumb *e)
      evas_object_hide(img);
    evas_object_image_file_set(img, NULL, NULL);
    evas_object_image_load_size_set(img, e->tw, e->th);
+
+   if (e->orientation == ETHUMB_THUMB_ORIENT_ORIGINAL)
+     evas_object_image_load_orientation_set(img, EINA_TRUE);
+
    evas_object_image_file_set(img, e->src_path, e->src_key);
 
    if (e->frame)
@@ -1566,56 +1565,9 @@ _ethumb_image_load(Ethumb *e)
         return 0;
      }
 
-   if (e->orientation == ETHUMB_THUMB_ORIENT_ORIGINAL)
-     {
-        /* TODO: rewrite to not need libexif just to get this */
-#ifdef HAVE_LIBEXIF
-        ExifData  *exif = exif_data_new_from_file(e->src_path);
-        ExifEntry *entry = NULL;
-        ExifByteOrder bo;
-        int o = 0;
-
-        if (exif)
-          {
-             entry = exif_data_get_entry(exif, EXIF_TAG_ORIENTATION);
-             if (entry)
-               {
-                  bo = exif_data_get_byte_order(exif);
-                  o = exif_get_short(entry->data, bo);
-               }
-             exif_data_free(exif);
-             switch (o)
-               {
-                case 2:
-                   orientation = ETHUMB_THUMB_FLIP_HORIZONTAL;
-                   break;
-                case 3:
-                   orientation = ETHUMB_THUMB_ROTATE_180;
-                   break;
-                case 4:
-                   orientation = ETHUMB_THUMB_FLIP_VERTICAL;
-                   break;
-                case 5:
-                   orientation = ETHUMB_THUMB_FLIP_TRANSPOSE;
-                   break;
-                case 6:
-                   orientation = ETHUMB_THUMB_ROTATE_90_CW;
-                   break;
-                case 7:
-                   orientation = ETHUMB_THUMB_FLIP_TRANSVERSE;
-                   break;
-                case 8:
-                   orientation = ETHUMB_THUMB_ROTATE_90_CCW;
-                   break;
-               }
-          }
-#endif
-     }
-   else
-     orientation = e->orientation;
-
-   if (orientation != ETHUMB_THUMB_ORIENT_NONE)
-     _ethumb_image_orient(e, orientation);
+   if (e->orientation != ETHUMB_THUMB_ORIENT_NONE &&
+       e->orientation != ETHUMB_THUMB_ORIENT_ORIGINAL)
+     _ethumb_image_orient(e, e->orientation);
 
    evas_object_image_size_get(img, &w, &h);
    if ((w <= 0) || (h <= 0))

-- 


Reply via email to