From: Keith Packard Date: Mon, 27 Feb 2023 02:48:54 +0000 (-0800) Subject: altos/draw: Inline span fill for polygons X-Git-Tag: 1.9.16~1^2~28 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=cd5b0ac6f2b0c709fe3d419c4c090aa5638d09e1 altos/draw: Inline span fill for polygons Instead of calling ao_rect, do the clipping by hand and call ao_solid instead. Signed-off-by: Keith Packard --- diff --git a/src/draw/ao_poly.c b/src/draw/ao_poly.c index 994f0a36..a546e043 100644 --- a/src/draw/ao_poly.c +++ b/src/draw/ao_poly.c @@ -145,7 +145,16 @@ ao_span(const struct ao_bitmap *dst, int16_t ix1 = (int16_t) floorf(x1 + 0.5f); int16_t ix2 = (int16_t) floorf(x2 + 0.5f); int16_t iy = (int16_t) y; - ao_rect(dst, ix1, iy, ix2 - ix1, 1, fill, rop); + + ao_clip(ix1, 0, dst->width); + ao_clip(ix2, 0, dst->width); + ao_solid(ao_and(rop, fill), + ao_xor(rop, fill), + dst->base + iy * dst->stride, + dst->stride, + ix1, + ix2 - ix1, + 1); } /* @@ -198,6 +207,9 @@ ao_poly(const struct ao_bitmap *dst, y_min = floorf(y_min); y_max = ceilf(y_max); + ao_clip(y_min, 0, dst->height); + ao_clip(y_max, 0, dst->height); + /* * Walk each scanline in the range and fill included spans */