diff options
author | Keith Packard <keithp@keithp.com> | 2014-05-07 10:31:16 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2014-06-15 22:02:40 +0100 |
commit | 3ac481c9dac591ffc33812ab047fc793d8a43d4f (patch) | |
tree | 0123469e8f578a6547f545885ad03e5e03d89c9d | |
parent | ea678a73c5688f73071d5581b6406808b7a0230f (diff) |
mi: Draw multiple lines in one FillSpans call in miZeroLine
miZeroLine allocates enough space to draw a line spanning the entire
width/height of the target drawable. When drawing multiple shorter
lines, this leaves most of the space in that buffer unfilled. Let
multiple lines be drawn into the buffer if there is plenty of space.
Speeds up glamor fallback zero-width lines:
Before
6000000 trep @ 0.0020 msec (508000.0/sec): 1-pixel line
6000000 trep @ 0.0020 msec (492000.0/sec): 10-pixel line
6000000 trep @ 0.0023 msec (427000.0/sec): 100-pixel line
4000000 trep @ 0.0035 msec (282000.0/sec): 500-pixel line
After:
600000000 trep @ 0.0000 msec (43400000.0/sec): 1-pixel line
140000000 trep @ 0.0001 msec (13000000.0/sec): 10-pixel line
16000000 trep @ 0.0008 msec (1300000.0/sec): 100-pixel line
4000000 trep @ 0.0038 msec (261000.0/sec): 500-pixel line
(500 pixel lines do not change in performance because the buffer can
only one one of them.)
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
-rw-r--r-- | mi/mizerline.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/mi/mizerline.c b/mi/mizerline.c index 90798dbdf..f30e01239 100644 --- a/mi/mizerline.c +++ b/mi/mizerline.c @@ -179,14 +179,6 @@ miZeroLine(DrawablePtr pDraw, GCPtr pGC, int mode, /* Origin or Previous */ MIOUTCODES(oc2, x2, y2, xleft, ytop, xright, ybottom); while (--npt > 0) { - if (Nspans > 0) - (*pGC->ops->FillSpans) (pDraw, pGC, Nspans, pspanInit, - pwidthInit, FALSE); - Nspans = 0; - new_span = TRUE; - spans = pspanInit - 1; - widths = pwidthInit - 1; - x1 = x2; y1 = y2; oc1 = oc2; @@ -208,6 +200,14 @@ miZeroLine(DrawablePtr pDraw, GCPtr pGC, int mode, /* Origin or Previous */ CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant); + if (ady + 1 > (list_len - Nspans)) { + (*pGC->ops->FillSpans) (pDraw, pGC, Nspans, pspanInit, + pwidthInit, FALSE); + Nspans = 0; + spans = pspanInit - 1; + widths = pwidthInit - 1; + } + new_span = TRUE; if (adx > ady) { e1 = ady << 1; e2 = e1 - (adx << 1); |