summaryrefslogtreecommitdiff
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
parent5097ba893bc6c643c5e705c4c3ae5ecf2a343ba5 (diff)
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 12e5b47..9d44aa6 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)
229 { 229 {
230 long long x1, y1, x2, y2; 230 long long x1, y1, x2, y2;
231 231
232 if (!mirror) 232 if (vwl > 0)
233 { 233 {
234 x1 = xl + ((wl * (long long)opt->x) / vwl); 234 if (!mirror)
235 x2 = xl + ((wl * (long long)(opt->x + opt->w)) / vwl); 235 {
236 x1 = xl + ((wl * (long long)opt->x) / vwl);
237 x2 = xl + ((wl * (long long)(opt->x + opt->w)) / vwl);
238 }
239 else
240 {
241 x1 = xl + ((wl * (vwl - (long long)(opt->x + opt->w))) / vwl);
242 x2 = xl + ((wl * (vwl - (long long)opt->x)) / vwl);
243 }
236 } 244 }
237 else 245 else
238 { 246 {
239 x1 = xl + ((wl * (vwl - (long long)(opt->x + opt->w))) / vwl); 247 x1 = xl;
240 x2 = xl + ((wl * (vwl - (long long)opt->x)) / vwl); 248 x2 = xl;
249 }
250 if (vhl > 0)
251 {
252 y1 = yl + ((hl * (long long)opt->y) / vhl);
253 y2 = yl + ((hl * (long long)(opt->y + opt->h)) / vhl);
254 }
255 else
256 {
257 y1 = yl;
258 y2 = yl;
241 } 259 }
242 y1 = yl + ((hl * (long long)opt->y) / vhl);
243 y2 = yl + ((hl * (long long)(opt->y + opt->h)) / vhl);
244 evas_object_move(opt->obj, x1, y1); 260 evas_object_move(opt->obj, x1, y1);
245 evas_object_resize(opt->obj, x2 - x1, y2 - y1); 261 evas_object_resize(opt->obj, x2 - x1, y2 - y1);
246 } 262 }