evas: fix jpeg loader rotation by metadata (exif)
authorwonguk.jeong <wonguk.jeong@samsung.com>
Sun, 29 Jun 2014 13:04:03 +0000 (15:04 +0200)
committerCedric Bail <cedric.bail@free.fr>
Sun, 29 Jun 2014 13:04:21 +0000 (15:04 +0200)
Summary:
90 or 270 degree rotation is not working properly
width should be regarded as height, and vice versa.

if this patch and D1082 were commited, rotation from metadata will be working properly by using evas_object_image_load_orientation_set()

@fix

Test Plan: add image object and invoke evas_object_image_load_orientation_set() -> load file with orientation metadata -> check whether image is rotated properly or not

Reviewers: raster, cedric, jpeg

CC: seoz, cedric
Differential Revision: https://phab.enlightenment.org/D1084

Signed-off-by: Cedric Bail <cedric.bail@free.fr>
src/modules/evas/loaders/jpeg/evas_image_load_jpeg.c

index e2fd97c..0ec2c85 100644 (file)
@@ -1076,8 +1076,8 @@ done:
 
    if (prop->rotated)
      {
-        DATA32             *data1, *data2,  *to, *from;
-        int                 lx, ly, lw, lh,  hw;
+        DATA32 *data1, *data2, *to, *from;
+        int lx, ly, lw, lh, hw;
 
         lw = w;
         lh = h;
@@ -1107,26 +1107,26 @@ done:
 
              if (degree == 90)
                {
-                  to = data1 + lw - 1;
+                  to = data1 + lh - 1;
                   hw = -hw - 1;
                }
              else if (degree == 270)
                {
-                  to = data1 + hw - lw;
-                  lw = -lw;
+                  to = data1 + hw - lh;
+                  lh = -lh;
                   hw = hw + 1;
                }
 
              if (to)
                {
                   from = data2;
-                  for (lx = w; --lx >= 0;)
+                  for (lx = h; --lx >= 0;)
                     {
-                       for (ly = h; --ly >= 0;)
+                       for (ly = w; --ly >= 0;)
                          {
                             *to = *from;
                             from++;
-                            to += lw;
+                            to += lh;
                          }
                        to += hw;
                     }