summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-04-25 22:50:38 -0700
committerKeith Packard <keithp@keithp.com>2014-05-22 18:35:14 -0700
commitcb9daabb95cba2067f06c6d68f9e39c015f6e044 (patch)
tree38bf204297f555caf3aee821886331d7dd73c992
parent1063d6117dfa53841d8d840afc7acf49dd14ce49 (diff)
mi: Draw all points/spans for miZeroPolyArc at once if possible
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@keithp.com>
-rw-r--r--mi/mizerarc.c40
1 files changed, 34 insertions, 6 deletions
diff --git a/mi/mizerarc.c b/mi/mizerarc.c
index b216cf43d..97ebfa697 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);
if (!widths)
return;
maxw = 0;
@@ -687,7 +699,7 @@ miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
(unsigned char *) pGC->dash, (int) pGC->numInDashList,
&dinfo.dashOffsetInit);
}
- points = malloc(sizeof(DDXPointRec) * numPts);
+ points_base = points = malloc(sizeof(DDXPointRec) * numPts * mul_points);
if (!points) {
if (dospans) {
free(widths);
@@ -707,9 +719,12 @@ miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
dinfo.skipStart = TRUE;
}
n = pts - points;
- if (!dospans)
- (*pGC->ops->PolyPoint) (pDraw, pGC, CoordModeOrigin, n, points);
- else {
+ if (!dospans) {
+ if (gather_points)
+ points += n;
+ else
+ (*pGC->ops->PolyPoint) (pDraw, pGC, CoordModeOrigin, n, points);
+ } else {
if (n > maxw) {
while (maxw < n)
widths[maxw++] = 1;
@@ -720,7 +735,11 @@ miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
pt->y += pDraw->y;
}
}
- (*pGC->ops->FillSpans) (pDraw, pGC, n, points, widths, FALSE);
+ if (gather_points) {
+ points += n;
+ widths += n;
+ } else
+ (*pGC->ops->FillSpans) (pDraw, pGC, n, points, widths, FALSE);
}
if (pGC->lineStyle != LineDoubleDash)
continue;
@@ -760,6 +779,15 @@ miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
}
}
}
+ if (gather_points) {
+ if (!dospans)
+ (*pGC->ops->PolyPoint) (pDraw, pGC, CoordModeOrigin, points - points_base, points_base);
+ else {
+ (*pGC->ops->FillSpans) (pDraw, pGC, points - points_base, points_base, widths_base, FALSE);
+ widths = widths_base;
+ }
+ points = points_base;
+ }
free(points);
if (dospans) {
free(widths);