evas/common - more elaborated compuatation in interpolation.

we should not +1 in divide but only do it when the quotient is zero.
This commit is contained in:
ChunEon Park 2013-12-31 18:19:41 +09:00
parent 6a5c7dc7a3
commit 0d33d30acc
1 changed files with 4 additions and 2 deletions

View File

@ -38,9 +38,10 @@ _interp(int x1, int x2, int p, FPc u1, FPc u2)
FPc u;
x2 -= x1;
if (x2 == 0) x2 = 1;
p -= x1;
u = u2 - u1;
u = (u * p) / (x2 + 1);
u = ((u * p) / x2);
// FIXME: do z persp
return u1 + u;
}
@ -49,8 +50,9 @@ static inline DATA32
_interp_col(int x1, int x2, int p, DATA32 col1, DATA32 col2)
{
x2 -= x1;
if (x2 == 0) x2 = 1;
p -= x1;
p = (p << 8) / (x2 + 1);
p = ((p << 8) / x2);
// FIXME: do z persp
return INTERP_256(p, col2, col1);
}