aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/evas/canvas/evas_object_grid.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-02-02 08:50:11 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-02-02 08:50:49 +0900
commit3cb947d1a5202d4ca6f56d1d38b0d3a2cda05ce8 (patch)
treef554a29f1d6c52cdf9fba56d0591f717988e3f17 /src/lib/evas/canvas/evas_object_grid.c
parentecore_wl2: Make www events opt-in (diff)
downloadefl-3cb947d1a5202d4ca6f56d1d38b0d3a2cda05ce8.tar.gz
evas grid smart - fix divide by 0
if object happens to be 0x0 then we can get a divide by 0... fix! @fix
Diffstat (limited to 'src/lib/evas/canvas/evas_object_grid.c')
-rw-r--r--src/lib/evas/canvas/evas_object_grid.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/lib/evas/canvas/evas_object_grid.c b/src/lib/evas/canvas/evas_object_grid.c
index 12e5b472b8..9d44aa6fe0 100644
--- a/src/lib/evas/canvas/evas_object_grid.c
+++ b/src/lib/evas/canvas/evas_object_grid.c
@@ -229,18 +229,34 @@ _evas_object_grid_smart_calculate(Evas_Object *o)
{
long long x1, y1, x2, y2;
- if (!mirror)
+ if (vwl > 0)
{
- x1 = xl + ((wl * (long long)opt->x) / vwl);
- x2 = xl + ((wl * (long long)(opt->x + opt->w)) / vwl);
+ if (!mirror)
+ {
+ x1 = xl + ((wl * (long long)opt->x) / vwl);
+ x2 = xl + ((wl * (long long)(opt->x + opt->w)) / vwl);
+ }
+ else
+ {
+ x1 = xl + ((wl * (vwl - (long long)(opt->x + opt->w))) / vwl);
+ x2 = xl + ((wl * (vwl - (long long)opt->x)) / vwl);
+ }
}
else
{
- x1 = xl + ((wl * (vwl - (long long)(opt->x + opt->w))) / vwl);
- x2 = xl + ((wl * (vwl - (long long)opt->x)) / vwl);
+ x1 = xl;
+ x2 = xl;
+ }
+ if (vhl > 0)
+ {
+ y1 = yl + ((hl * (long long)opt->y) / vhl);
+ y2 = yl + ((hl * (long long)(opt->y + opt->h)) / vhl);
+ }
+ else
+ {
+ y1 = yl;
+ y2 = yl;
}
- y1 = yl + ((hl * (long long)opt->y) / vhl);
- y2 = yl + ((hl * (long long)(opt->y + opt->h)) / vhl);
evas_object_move(opt->obj, x1, y1);
evas_object_resize(opt->obj, x2 - x1, y2 - y1);
}