evas/common - more elaborated compuatation in interpolation.
authorChunEon Park <hermet@hermet.pe.kr>
Tue, 31 Dec 2013 09:19:41 +0000 (18:19 +0900)
committerChunEon Park <hermet@hermet.pe.kr>
Tue, 31 Dec 2013 09:19:41 +0000 (18:19 +0900)
we should not +1 in divide but only do it when the quotient is zero.

src/lib/evas/common/evas_map_image.c

index c3f3e37..793abf3 100644 (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);
 }