forked from enlightenment/efl
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. SVN revision: 63978
This commit is contained in:
parent
0bfb70e48e
commit
914a08e206
|
@ -81,10 +81,10 @@ _evas_map_calc_map_geometry(Evas_Object *obj)
|
||||||
|
|
||||||
p = obj->cur.map->points;
|
p = obj->cur.map->points;
|
||||||
p_end = p + obj->cur.map->count;
|
p_end = p + obj->cur.map->count;
|
||||||
x1 = p->x;
|
x1 = lround(p->x);
|
||||||
x2 = p->x;
|
x2 = lround(p->x);
|
||||||
y1 = p->y;
|
y1 = lround(p->y);
|
||||||
y2 = p->y;
|
y2 = lround(p->y);
|
||||||
p++;
|
p++;
|
||||||
for (; p < p_end; p++)
|
for (; p < p_end; p++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#include "evas_common.h"
|
#include "evas_common.h"
|
||||||
#include "evas_private.h"
|
#include "evas_private.h"
|
||||||
|
@ -2887,14 +2888,14 @@ evas_object_image_render(Evas_Object *obj, void *output, void *context, void *su
|
||||||
// draw geom +x +y
|
// draw geom +x +y
|
||||||
for (; p < p_end; p++, pt++)
|
for (; p < p_end; p++, pt++)
|
||||||
{
|
{
|
||||||
pt->x = (p->x + (double)x) * FP1;
|
pt->x = (lround(p->x) + x) * FP1;
|
||||||
pt->y = (p->y + (double)y) * FP1;
|
pt->y = (lround(p->y) + y) * FP1;
|
||||||
pt->z = (p->z) * FP1;
|
pt->z = (lround(p->z) ) * FP1;
|
||||||
pt->fx = p->px;
|
pt->fx = p->px;
|
||||||
pt->fy = p->py;
|
pt->fy = p->py;
|
||||||
pt->fz = p->z;
|
pt->fz = p->z;
|
||||||
pt->u = ((p->u * imagew) / uvw) * FP1;
|
pt->u = ((lround(p->u) * imagew) / uvw) * FP1;
|
||||||
pt->v = ((p->v * imageh) / uvh) * FP1;
|
pt->v = ((lround(p->v) * imageh) / uvh) * FP1;
|
||||||
if (pt->u < 0) pt->u = 0;
|
if (pt->u < 0) pt->u = 0;
|
||||||
else if (pt->u > (imagew * FP1)) pt->u = (imagew * FP1);
|
else if (pt->u > (imagew * FP1)) pt->u = (imagew * FP1);
|
||||||
if (pt->v < 0) pt->v = 0;
|
if (pt->v < 0) pt->v = 0;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "evas_common.h"
|
#include "evas_common.h"
|
||||||
#include "evas_private.h"
|
#include "evas_private.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
// debug rendering
|
// debug rendering
|
||||||
/* #define REND_DGB 1 */
|
/* #define REND_DGB 1 */
|
||||||
|
@ -911,14 +912,14 @@ evas_render_mapped(Evas *e, Evas_Object *obj, void *context, void *surface,
|
||||||
pt = pts;
|
pt = pts;
|
||||||
for (; p < p_end; p++, pt++)
|
for (; p < p_end; p++, pt++)
|
||||||
{
|
{
|
||||||
pt->x = (p->x + (double)off_x) * FP1;
|
pt->x = (lround(p->x) + off_x) * FP1;
|
||||||
pt->y = (p->y + (double)off_y) * FP1;
|
pt->y = (lround(p->y) + off_y) * FP1;
|
||||||
pt->z = (p->z) * FP1;
|
pt->z = (lround(p->z) ) * FP1;
|
||||||
pt->fx = p->px;
|
pt->fx = p->px;
|
||||||
pt->fy = p->py;
|
pt->fy = p->py;
|
||||||
pt->fz = p->z;
|
pt->fz = p->z;
|
||||||
pt->u = p->u * FP1;
|
pt->u = lround(p->u) * FP1;
|
||||||
pt->v = p->v * FP1;
|
pt->v = lround(p->v) * FP1;
|
||||||
if (pt->u < 0) pt->u = 0;
|
if (pt->u < 0) pt->u = 0;
|
||||||
else if (pt->u > (sw * FP1)) pt->u = (sw * FP1);
|
else if (pt->u > (sw * FP1)) pt->u = (sw * FP1);
|
||||||
if (pt->v < 0) pt->v = 0;
|
if (pt->v < 0) pt->v = 0;
|
||||||
|
|
Loading…
Reference in New Issue