[PATCH 12/13] mi: Fill all spans for PolyFillArc at once

Eric Anholt eric at anholt.net
Tue May 6 12:27:17 PDT 2014


Keith Packard <keithp at keithp.com> writes:

> This allocates span data for all of the provided arcs and draws the
> whole set in one call, rather than doing them one at a time. For
> modern hardware, this is a significant performance improvement.
>
> Signed-off-by: Keith Packard <keithp at keithp.com>
> ---
>  mi/mifillarc.c | 98 ++++++++++++++++++++--------------------------------------
>  1 file changed, 34 insertions(+), 64 deletions(-)
>
> diff --git a/mi/mifillarc.c b/mi/mifillarc.c
> index 337343d..1695121 100644
> --- a/mi/mifillarc.c
> +++ b/mi/mifillarc.c

>  /* MIPOLYFILLARC -- The public entry for the PolyFillArc request.
> @@ -692,21 +644,39 @@ miPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
>  {
>      int i;
>      xArc *arc;
> +    int nspans = 0;
> +    DDXPointPtr pts, points;
> +    int *wids, *widths;
> +    int n;
> +
> +    for (i = narcs, arc = parcs; --i >= 0; arc++)
> +        nspans += arc->height;
> +
> +    pts = points = malloc (sizeof (DDXPointRec) * nspans + sizeof(int) * nspans);
> +    if (!points)
> +        return;
> +    wids = widths = (int *) (points + nspans);

Can you give me some justification of what prevents integer overflow
here?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20140506/34f97f48/attachment.sig>


More information about the xorg-devel mailing list