On Mon, 10 Oct 2011, Enlightenment SVN wrote:
> Log: > use lround() for map coord rounding to avoid silly things like > 15.999999999999999998 rounding down to 15... whihc leads to > sometimes... odd off-by-1 expected results. lround is C99 compliant and does not exist on Windows. why not using the macro #define round(x) (x<0?ceil((x)-0.5):floor((x)+0.5)) ? Vincent > > > > Author: raster > Date: 2011-10-10 23:06:11 -0700 (Mon, 10 Oct 2011) > New Revision: 63978 > Trac: http://trac.enlightenment.org/e/changeset/63978 > > Modified: > trunk/evas/src/lib/canvas/evas_map.c > trunk/evas/src/lib/canvas/evas_object_image.c > trunk/evas/src/lib/canvas/evas_render.c > > Modified: trunk/evas/src/lib/canvas/evas_map.c > =================================================================== > --- trunk/evas/src/lib/canvas/evas_map.c 2011-10-11 05:12:06 UTC (rev > 63977) > +++ trunk/evas/src/lib/canvas/evas_map.c 2011-10-11 06:06:11 UTC (rev > 63978) > @@ -81,10 +81,10 @@ > > p = obj->cur.map->points; > p_end = p + obj->cur.map->count; > - x1 = p->x; > - x2 = p->x; > - y1 = p->y; > - y2 = p->y; > + x1 = lround(p->x); > + x2 = lround(p->x); > + y1 = lround(p->y); > + y2 = lround(p->y); > p++; > for (; p < p_end; p++) > { > > Modified: trunk/evas/src/lib/canvas/evas_object_image.c > =================================================================== > --- trunk/evas/src/lib/canvas/evas_object_image.c 2011-10-11 05:12:06 UTC > (rev 63977) > +++ trunk/evas/src/lib/canvas/evas_object_image.c 2011-10-11 06:06:11 UTC > (rev 63978) > @@ -2,6 +2,7 @@ > #include <unistd.h> > #include <stdlib.h> > #include <sys/mman.h> > +#include <math.h> > > #include "evas_common.h" > #include "evas_private.h" > @@ -2887,14 +2888,14 @@ > // draw geom +x +y > for (; p < p_end; p++, pt++) > { > - pt->x = (p->x + (double)x) * FP1; > - pt->y = (p->y + (double)y) * FP1; > - pt->z = (p->z) * FP1; > + pt->x = (lround(p->x) + x) * FP1; > + pt->y = (lround(p->y) + y) * FP1; > + pt->z = (lround(p->z) ) * FP1; > pt->fx = p->px; > pt->fy = p->py; > pt->fz = p->z; > - pt->u = ((p->u * imagew) / uvw) * FP1; > - pt->v = ((p->v * imageh) / uvh) * FP1; > + pt->u = ((lround(p->u) * imagew) / uvw) * FP1; > + pt->v = ((lround(p->v) * imageh) / uvh) * FP1; > if (pt->u < 0) pt->u = 0; > else if (pt->u > (imagew * FP1)) pt->u = (imagew * FP1); > if (pt->v < 0) pt->v = 0; > > Modified: trunk/evas/src/lib/canvas/evas_render.c > =================================================================== > --- trunk/evas/src/lib/canvas/evas_render.c 2011-10-11 05:12:06 UTC (rev > 63977) > +++ trunk/evas/src/lib/canvas/evas_render.c 2011-10-11 06:06:11 UTC (rev > 63978) > @@ -1,5 +1,6 @@ > #include "evas_common.h" > #include "evas_private.h" > +#include <math.h> > > // debug rendering > /* #define REND_DGB 1 */ > @@ -911,14 +912,14 @@ > pt = pts; > for (; p < p_end; p++, pt++) > { > - pt->x = (p->x + (double)off_x) * FP1; > - pt->y = (p->y + (double)off_y) * FP1; > - pt->z = (p->z) * FP1; > + pt->x = (lround(p->x) + off_x) * FP1; > + pt->y = (lround(p->y) + off_y) * FP1; > + pt->z = (lround(p->z) ) * FP1; > pt->fx = p->px; > pt->fy = p->py; > pt->fz = p->z; > - pt->u = p->u * FP1; > - pt->v = p->v * FP1; > + pt->u = lround(p->u) * FP1; > + pt->v = lround(p->v) * FP1; > if (pt->u < 0) pt->u = 0; > else if (pt->u > (sw * FP1)) pt->u = (sw * FP1); > if (pt->v < 0) pt->v = 0; > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2d-oct > _______________________________________________ > enlightenment-svn mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/enlightenment-svn > > ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct _______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
