photocam: Fix region load + scale down options 63/90963/2
authorjiin.moon <jiin.moon@samsung.com>
Tue, 4 Oct 2016 08:05:51 +0000 (17:05 +0900)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Wed, 5 Oct 2016 09:55:40 +0000 (02:55 -0700)
patch from upstream (commit 3bdefaf31fde9801ce6702f850aac24bc2157842 by jp)

 I have no idea how photocam even worked before. @jiin.moon
 exposed a major issue in photocam by fixing how the jpg loader
 scale down + region load combination works.

 @fix

Change-Id: I7abd56d3a5b7e17e927d0e437237629c3b159879

src/lib/elm_photocam.c

index b3cd504..888a1fe 100644 (file)
@@ -535,21 +535,22 @@ _grid_create(Evas_Object *obj)
              int tn;
 
              tn = (y * g->gw) + x;
-             g->grid[tn].src.x = x * g->tsize;
+             g->grid[tn].out.x = x * g->tsize;
              if (x == (g->gw - 1))
-               g->grid[tn].src.w = g->w - ((g->gw - 1) * g->tsize);
+               g->grid[tn].out.w = g->w - ((g->gw - 1) * g->tsize);
              else
-               g->grid[tn].src.w = g->tsize;
-             g->grid[tn].src.y = y * g->tsize;
+               g->grid[tn].out.w = g->tsize;
+             g->grid[tn].out.y = y * g->tsize;
              if (y == (g->gh - 1))
-               g->grid[tn].src.h = g->h - ((g->gh - 1) * g->tsize);
+               g->grid[tn].out.h = g->h - ((g->gh - 1) * g->tsize);
              else
-               g->grid[tn].src.h = g->tsize;
+               g->grid[tn].out.h = g->tsize;
 
-             g->grid[tn].out.x = g->grid[tn].src.x;
-             g->grid[tn].out.y = g->grid[tn].src.y;
-             g->grid[tn].out.w = g->grid[tn].src.w;
-             g->grid[tn].out.h = g->grid[tn].src.h;
+             if (g->zoom <= 0) g->zoom = 1;
+             g->grid[tn].src.x = g->grid[tn].out.x * g->zoom;
+             g->grid[tn].src.y = g->grid[tn].out.y * g->zoom;
+             g->grid[tn].src.w = g->grid[tn].out.w * g->zoom;
+             g->grid[tn].src.h = g->grid[tn].out.h * g->zoom;
 
              g->grid[tn].obj = obj;
              g->grid[tn].grid = g;