Enlightenment CVS committal Author : barbieri Project : e17 Module : libs/epsilon
Dir : e17/libs/epsilon/src/lib Modified Files: Epsilon.c Log Message: Fix size calculation, width and height were exchanged. Width and height were exchanged, providing wrong thumbnail size. This was harder to notice because usually width and height are equal. This also removes the need of float-point usage for size calculation, going with unsigned long should be enough to fit the precision we need. Patch by: Leonardo Sobral Cunha <[EMAIL PROTECTED]> =================================================================== RCS file: /cvs/e/e17/libs/epsilon/src/lib/Epsilon.c,v retrieving revision 1.45 retrieving revision 1.46 diff -u -3 -r1.45 -r1.46 --- Epsilon.c 28 Nov 2007 03:52:53 -0000 1.45 +++ Epsilon.c 10 May 2008 04:53:20 -0000 1.46 @@ -577,13 +577,13 @@ epeg_size_get (im, &iw, &ih); if (iw > ih) { - th = e->th * ((double) ih / (double) iw); - if (th < 1) th = 1; + th = ((unsigned long) e->tw * ih) / iw; + if (th < 1) th = 1; } else { - tw = e->tw * ((double) iw / (double) ih); - if (tw < 1) tw = 1; + tw = ((unsigned long) e->th * iw) / ih; + if (tw < 1) tw = 1; } epeg_decode_size_set (im, tw, th); epeg_quality_set (im, 100); @@ -699,13 +699,13 @@ ih = imlib_image_get_height (); if (iw > ih) { - th = e->th * ((double) ih / (double) iw); - if (th < 1) th = 1; + th = ((unsigned long) e->tw * ih) / iw; + if (th < 1) th = 1; } else { - tw = e->tw * ((double) iw / (double) ih); - if (tw < 1) tw = 1; + tw = ((unsigned long) e->th * iw) / ih; + if (tw < 1) tw = 1; } imlib_context_set_cliprect (0, 0, tw, th); if ((src = imlib_create_cropped_scaled_image (0, 0, iw, ih, tw, th))) ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs