[PATCH 13/13] mi: Draw all points/spans for miZeroPolyArc at once if possible

Eric Anholt eric at anholt.net
Thu Jun 12 22:39:12 PDT 2014


Keith Packard <keithp at keithp.com> writes:

> Drawing all of the spans in one driver call is a considerable
> performance improvement, which we can do unless the arcs are
> double-dashed, in which case overlapping dashes should draw the latter
> arc contents.
>
> Signed-off-by: Keith Packard <keithp at keithp.com>
> ---
>  mi/mizerarc.c | 40 ++++++++++++++++++++++++++++++++++------
>  1 file changed, 34 insertions(+), 6 deletions(-)
>
> diff --git a/mi/mizerarc.c b/mi/mizerarc.c
> index 9dac180..e39cd82 100644
> --- a/mi/mizerarc.c
> +++ b/mi/mizerarc.c
> @@ -653,6 +653,10 @@ miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
>      int *widths = NULL;
>      XID fgPixel = pGC->fgPixel;
>      DashInfo dinfo;
> +    Bool gather_points;
> +    int mul_points;
> +    DDXPointPtr points_base;
> +    int *widths_base = NULL;
>  
>      for (arc = parcs, i = narcs; --i >= 0; arc++) {
>          if (!miCanZeroArc(arc))
> @@ -669,9 +673,17 @@ miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
>      if (!maxPts)
>          return;
>      numPts = maxPts << 2;
> +
> +    gather_points = FALSE;
> +    mul_points = 1;
> +    if (pGC->lineStyle != LineDoubleDash) {
> +        gather_points = TRUE;
> +        mul_points = narcs;
> +    }
> +
>      dospans = (pGC->fillStyle != FillSolid);
>      if (dospans) {
> -        widths = malloc(sizeof(int) * numPts);
> +        widths_base = widths = malloc(sizeof(int) * numPts * mul_points);

Doesn't this have the an even worse overflow problem (width * height *
narcs) than other patch you fixed up did?
-------------- 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/20140612/8d0ee88a/attachment.sig>


More information about the xorg-devel mailing list