image: fix clipped image issue if x or y is less than zero
authorjiin.moon <jiin.moon@samsung.com>
Wed, 24 Dec 2014 05:07:32 +0000 (14:07 +0900)
committerChunEon Park <hermet@hermet.pe.kr>
Wed, 24 Dec 2014 05:10:05 +0000 (14:10 +0900)
Summary:
After applying clipping patch about image on outside,
the width or height of the image be decreased
if x or y of an image is less than zero.
The way to calculate width/height has changed.

This fixes a side effect added in 2839881f37ea85b3469d8fd37cfaa4f9d67458fa

Reviewers: Hermet

Differential Revision: https://phab.enlightenment.org/D1810

AUTHORS
src/lib/elm_image.c

diff --git a/AUTHORS b/AUTHORS
index 34e5d98..0a80fa5 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -161,3 +161,4 @@ yinsc <shouchen.yin@samsung.com>
 Woochan Lee <wc0917.lee@samsung.com>
 Vitalii Vorobiov <vi.vorobiov@samsung.com>
 Jee-Yong Um <conr2d@gmail.com>
+Ji-In Moon <jiin.moon@samsung.com> 
index 9bc14ac..a3eb116 100644 (file)
@@ -131,8 +131,7 @@ _elm_image_internal_sizing_eval(Evas_Object *obj, Elm_Image_Data *sd)
    else
      {
         double alignh = 0.5, alignv = 0.5;
-        int iw = 0, ih = 0;
-
+        int iw = 0, ih = 0, offset_w = 0, offset_h = 0;
         evas_object_image_size_get(sd->img, &iw, &ih);
 
         iw = ((double)iw) * sd->scale;
@@ -178,14 +177,17 @@ _elm_image_internal_sizing_eval(Evas_Object *obj, Elm_Image_Data *sd)
         if (alignh == EVAS_HINT_FILL) alignh = 0.5;
         if (alignv == EVAS_HINT_FILL) alignv = 0.5;
 
-        x = sd->img_x + ((sd->img_w - w) * alignh);
-        y = sd->img_y + ((sd->img_h - h) * alignv);
+        offset_w = ((sd->img_w - w) * alignh);
+        offset_h = ((sd->img_h - h) * alignv);
+
+        x = sd->img_x + offset_w;
+        y = sd->img_y + offset_h;
 
         evas_object_move(sd->img, x, y);
         evas_object_image_fill_set(sd->img, 0, 0, w, h);
 
-        if (x < 0) w += x;
-        if (y < 0) h += y;
+        if (offset_w < 0) w += offset_w;
+        if (offset_h < 0) h += offset_h;
 
         evas_object_resize(sd->img, w, h);
      }