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:
parent
14d82a2bc3
commit
bf1429b203
6
mi/mi.h
6
mi/mi.h
|
@ -452,6 +452,12 @@ extern _X_EXPORT void miWideDash(DrawablePtr /*pDrawable */ ,
|
||||||
DDXPointPtr /*pPts */
|
DDXPointPtr /*pPts */
|
||||||
);
|
);
|
||||||
|
|
||||||
|
extern _X_EXPORT void miPolylines(DrawablePtr pDrawable,
|
||||||
|
GCPtr pGC,
|
||||||
|
int mode,
|
||||||
|
int npt,
|
||||||
|
DDXPointPtr pPts);
|
||||||
|
|
||||||
/* miwindow.c */
|
/* miwindow.c */
|
||||||
|
|
||||||
extern _X_EXPORT void miClearToBackground(WindowPtr /*pWin */ ,
|
extern _X_EXPORT void miClearToBackground(WindowPtr /*pWin */ ,
|
||||||
|
|
|
@ -1979,3 +1979,23 @@ miWideDash(DrawablePtr pDrawable, GCPtr pGC,
|
||||||
if (spanData)
|
if (spanData)
|
||||||
miCleanupSpanData(pDrawable, pGC, 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue