Enlightenment CVS committal Author : raster Project : e17 Module : libs/edje
Dir : e17/libs/edje/src/lib Modified Files: edje_calc.c Log Message: fix up aspect calcs for both axes controlling =================================================================== RCS file: /cvs/e/e17/libs/edje/src/lib/edje_calc.c,v retrieving revision 1.83 retrieving revision 1.84 diff -u -3 -r1.83 -r1.84 --- edje_calc.c 23 Jul 2006 19:33:27 -0000 1.83 +++ edje_calc.c 23 Jul 2006 21:18:28 -0000 1.84 @@ -309,7 +309,7 @@ { int apref; double aspect, amax, amin; - double new_w, new_h, want_x, want_y, want_w, want_h; + double new_w = 0, new_h = 0, want_x, want_y, want_w, want_h; want_x = params->x; want_w = new_w = params->w; @@ -317,12 +317,6 @@ want_y = params->y; want_h = new_h = params->h; - if ((maxw >= 0) && (new_w > maxw)) new_w = maxw; - if (new_w < minw) new_w = minw; - - if ((maxh >= 0) && (new_h > maxh)) new_h = maxh; - if (new_h < minh) new_h = minh; - aspect = (double)params->w / (double)params->h; apref = desc->aspect.prefer; amax = desc->aspect.max; @@ -400,15 +394,48 @@ new_h = (params->w / amin); } } + + if ((maxw >= 0) && (new_w > maxw)) new_w = maxw; + if (new_w < minw) new_w = minw; + + if ((maxh >= 0) && (new_h > maxh)) new_h = maxh; + if (new_h < minh) new_h = minh; + /* do real adjustment */ if (apref == EDJE_ASPECT_PREFER_BOTH) { - /* fix h and vary w */ - if (new_w > params->w) - params->w = new_w; - /* fix w and vary h */ - else - params->h = new_h; + if (amin == 0.0) amin = amax; + if (amin != 0.0) + { + /* fix h and vary w */ + if (new_w > params->w) + { +// params->w = new_w; +// EXCEEDS BOUNDS in W + new_h = (params->w / amin); + new_w = params->w; + if (new_h > params->h) + { + new_h = params->h; + new_w = (params->h * amin); + } + } + /* fix w and vary h */ + else + { +// params->h = new_h; +// EXCEEDS BOUNDS in H + new_h = params->h; + new_w = (params->h * amin); + if (new_w > params->w) + { + new_h = (params->w / amin); + new_w = params->w; + } + } + params->w = new_w; + params->h = new_h; + } } else { ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs