Changeset 1174


Ignore:
Timestamp:
Oct 1, 2006, 2:23:30 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • Better precision in cucul_fill_triangle().
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/cucul/triangle.c

    r1173 r1174  
    106106
    107107    /* Compute slopes and promote precision */
    108     sl21 = (y2 == y1) ? 0 : (x2 - x1) * 0x1000 / (y2 - y1);
    109     sl31 = (y3 == y1) ? 0 : (x3 - x1) * 0x1000 / (y3 - y1);
    110     sl32 = (y3 == y2) ? 0 : (x3 - x2) * 0x1000 / (y3 - y2);
     108    sl21 = (y2 == y1) ? 0 : (x2 - x1) * 0x10000 / (y2 - y1);
     109    sl31 = (y3 == y1) ? 0 : (x3 - x1) * 0x10000 / (y3 - y1);
     110    sl32 = (y3 == y2) ? 0 : (x3 - x2) * 0x10000 / (y3 - y2);
    111111
    112     x1 *= 0x1000;
    113     x2 *= 0x1000;
    114     x3 *= 0x1000;
     112    x1 *= 0x10000;
     113    x2 *= 0x10000;
     114    x3 *= 0x10000;
    115115
    116116    ymin = y1 < 0 ? 0 : y1;
     
    139139        if(xa < xb)
    140140        {
    141             xx1 = (xa + 0x800) / 0x1000;
    142             xx2 = (xb + 0x801) / 0x1000;
     141            xx1 = (xa + 0x800) / 0x10000;
     142            xx2 = (xb + 0x801) / 0x10000;
    143143        }
    144144        else
    145145        {
    146             xx1 = (xb + 0x800) / 0x1000;
    147             xx2 = (xa + 0x801) / 0x1000;
     146            xx1 = (xb + 0x800) / 0x10000;
     147            xx2 = (xa + 0x801) / 0x10000;
    148148        }
    149149
Note: See TracChangeset for help on using the changeset viewer.