mi: Create miPolylines as a general-purpose line drawing function

Instead of requiring all drivers to figure out which mi function to
call for each of the four cases, create a single wrapper in mi that
handles them correctly. Now drivers can simply use miPolylines in all
cases.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Keith Packard 2014-05-07 09:56:39 -07:00 committed by Eric Anholt
parent 14d82a2bc3
commit bf1429b203
2 changed files with 26 additions and 0 deletions

View File

@ -452,6 +452,12 @@ extern _X_EXPORT void miWideDash(DrawablePtr /*pDrawable */ ,
DDXPointPtr /*pPts */
);
extern _X_EXPORT void miPolylines(DrawablePtr pDrawable,
GCPtr pGC,
int mode,
int npt,
DDXPointPtr pPts);
/* miwindow.c */
extern _X_EXPORT void miClearToBackground(WindowPtr /*pWin */ ,

View File

@ -1979,3 +1979,23 @@ miWideDash(DrawablePtr pDrawable, GCPtr pGC,
if (spanData)
miCleanupSpanData(pDrawable, pGC, spanData);
}
void
miPolylines(DrawablePtr drawable,
GCPtr gc,
int mode,
int n,
DDXPointPtr points)
{
if (gc->lineWidth == 0) {
if (gc->lineStyle == LineSolid)
miZeroLine(drawable, gc, mode, n, points);
else
miZeroDashLine(drawable, gc, mode, n, points);
} else {
if (gc->lineStyle == LineSolid)
miWideLine(drawable, gc, mode, n, points);
else
miWideDash(drawable, gc, mode, n, points);
}
}