summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjiin.moon <jiin.moon@samsung.com>2014-12-24 14:07:32 +0900
committerChunEon Park <hermet@hermet.pe.kr>2014-12-24 14:10:05 +0900
commit2e213f0270f217949a11141f45fef12cfeadaf0b (patch)
tree4714824acd9e38e563563e2650fb25d93f843ed8
parent9c0116e2392fef9cf7e29f5bba0a122fbee0b238 (diff)
downloadelementary-2e213f0270f217949a11141f45fef12cfeadaf0b.tar.gz
image: fix clipped image issue if x or y is less than zero
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
-rw-r--r--AUTHORS1
-rw-r--r--src/lib/elm_image.c14
2 files changed, 9 insertions, 6 deletions
diff --git a/AUTHORS b/AUTHORS
index 34e5d98ac..0a80fa502 100644
--- 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>
diff --git a/src/lib/elm_image.c b/src/lib/elm_image.c
index 9bc14ac93..a3eb116a9 100644
--- a/src/lib/elm_image.c
+++ b/src/lib/elm_image.c
@@ -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);
}