summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-05-07 09:56:39 -0700
committerKeith Packard <keithp@keithp.com>2014-05-22 18:35:14 -0700
commitafe8d637dbb1c0e35c10c41ca08b02c8be8f9b1d (patch)
tree5eec9a5ffe2c4d364d4d4697653ef93858182c71
parent7c68165f84bcf38f8101eedb5c17220405c472bf (diff)
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>
-rw-r--r--mi/mi.h6
-rw-r--r--mi/miwideline.c20
2 files changed, 26 insertions, 0 deletions
diff --git a/mi/mi.h b/mi/mi.h
index 1209a16c4..b8a4f0568 100644
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -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 */ ,
diff --git a/mi/miwideline.c b/mi/miwideline.c
index b76e7a818..29ba12c69 100644
--- a/mi/miwideline.c
+++ b/mi/miwideline.c
@@ -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);
+ }
+}