X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fdraw%2Fao_line.c;h=38314542386f42f503a42699765743bd6785ce47;hb=6f7d530b9ca06272354d1b7c05813a2523b24887;hp=10c071eb4bdbc3cd77931231e937ff3dde39f0d4;hpb=bc17e4ed423c75624115ee3921aee2111ec1139b;p=fw%2Faltos diff --git a/src/draw/ao_line.c b/src/draw/ao_line.c index 10c071eb..38314542 100644 --- a/src/draw/ao_line.c +++ b/src/draw/ao_line.c @@ -12,8 +12,8 @@ * General Public License for more details. */ -#include "ao_draw.h" -#include "ao_draw_int.h" +#include +#include #define ao_mask(x,w) (ao_right(AO_ALLONES,(x) & AO_MASK) & \ ao_left(AO_ALLONES,(FB_UNIT - ((x)+(w))) & AO_MASK)) @@ -209,26 +209,25 @@ ao_clip_line(struct ao_cc *c, struct ao_cbox *b) * isn't symmetrical when the line passes exactly between * two pixels, we have to pick which one gets drawn */ - int32_t adj_min; - if (c->e3) { + int32_t adj_min; + if (!c->first) adj_min = div_ceil(c->e + adjust_major * c->e1, -c->e3); else adj_min = div_floor_plus_one(c->e + adjust_major * c->e1, -c->e3); - } - if (adj_min < adjust_minor) { - if (c->e1) { - if (c->first) - adjust_major = div_ceil(c->e - adjust_minor * c->e3, c->e1); - else - adjust_major = div_floor_plus_one(c->e - adjust_minor * c->e3, c->e1); + if (adj_min < adjust_minor) { + if (c->e1) { + if (c->first) + adjust_major = div_ceil(c->e - adjust_minor * c->e3, c->e1); + else + adjust_major = div_floor_plus_one(c->e - adjust_minor * c->e3, c->e1); + } + } else { + adjust_minor = adj_min; } - } else { - adjust_minor = adj_min; } - c->e = (int16_t) (c->e + adjust_major * c->e1 + adjust_minor * c->e3); c->major = (int16_t) (c->major + c->sign_major * adjust_major); @@ -239,7 +238,7 @@ ao_clip_line(struct ao_cc *c, struct ao_cbox *b) } void -ao_line(const struct ao_bitmap *dst, +ao_line(struct ao_bitmap *dst, int16_t x1, int16_t y1, int16_t x2, @@ -325,10 +324,17 @@ ao_line(const struct ao_bitmap *dst, if (adx > ady) { x1 = clip_1.major; y1 = clip_1.minor; + x2 = clip_2.major; + y2 = clip_2.minor; } else { x1 = clip_1.minor; y1 = clip_1.major; + x2 = clip_2.minor; + y2 = clip_2.major; } + + ao_damage(dst, ao_min16(x1, x2), ao_max16(x1, x2), ao_min16(y1, y2), ao_max16(y1, y2)); + ao_bres(dst, signdx, signdy,