aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/mi
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-07-19 15:12:53 +0200
committermarha <marha@users.sourceforge.net>2014-07-19 15:12:53 +0200
commit61c36feba19d918885022042ea62d068a698c83d (patch)
treefd351953eb2193fe548e7d0e2dca06b34b7c4f4d /xorg-server/mi
parent3865d60ef607cbb00c819e905e40d3628b8eca29 (diff)
parentd0c30e7945e76ac119f6d867e27137c8a76f7e15 (diff)
downloadvcxsrv-61c36feba19d918885022042ea62d068a698c83d.tar.gz
vcxsrv-61c36feba19d918885022042ea62d068a698c83d.tar.bz2
vcxsrv-61c36feba19d918885022042ea62d068a698c83d.zip
Merge remote-tracking branch 'origin/released'
Conflicts: mesalib/src/glsl/ir.cpp xorg-server/config/config.c xorg-server/include/callback.h xorg-server/include/colormap.h xorg-server/include/cursor.h xorg-server/include/dix.h xorg-server/include/dixfont.h xorg-server/include/dixgrabs.h xorg-server/include/gc.h xorg-server/include/gcstruct.h xorg-server/include/input.h xorg-server/include/os.h xorg-server/include/pixmap.h xorg-server/include/property.h xorg-server/include/resource.h xorg-server/include/scrnintstr.h xorg-server/include/window.h xorg-server/include/xkbsrv.h xorg-server/mi/mi.h
Diffstat (limited to 'xorg-server/mi')
-rwxr-xr-x[-rw-r--r--]xorg-server/mi/mi.h85
-rw-r--r--xorg-server/mi/miarc.c11
-rw-r--r--xorg-server/mi/mifillarc.c146
-rw-r--r--xorg-server/mi/misprite.c4
-rw-r--r--xorg-server/mi/miwideline.c20
-rw-r--r--xorg-server/mi/mizerarc.c2
-rw-r--r--xorg-server/mi/mizerline.c16
7 files changed, 156 insertions, 128 deletions
diff --git a/xorg-server/mi/mi.h b/xorg-server/mi/mi.h
index 788f5dd54..feba5cb0c 100644..100755
--- a/xorg-server/mi/mi.h
+++ b/xorg-server/mi/mi.h
@@ -67,6 +67,11 @@ typedef struct _miDash *miDashPtr;
/* miarc.c */
+extern _X_EXPORT void miWideArc(DrawablePtr pDraw,
+ GCPtr pGC,
+ int narcs,
+ xArc * parcs);
+
extern _X_EXPORT void miPolyArc(DrawablePtr /*pDraw */ ,
GCPtr /*pGC */ ,
int /*narcs */ ,
@@ -265,22 +270,22 @@ extern _X_EXPORT void miPolyFillRect(DrawablePtr /*pDrawable */ ,
/* miglblt.c */
-extern _X_EXPORT void miPolyGlyphBlt(DrawablePtr /*pDrawable */ ,
- GCPtr /*pGC */ ,
- int /*x */ ,
- int /*y */ ,
- unsigned int /*nglyph */ ,
- CharInfoPtr * /*ppci */ ,
- void * /*pglyphBase */
+extern _X_EXPORT void miPolyGlyphBlt(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ void *pglyphBase
);
-extern _X_EXPORT void miImageGlyphBlt(DrawablePtr /*pDrawable */ ,
- GCPtr /*pGC */ ,
- int /*x */ ,
- int /*y */ ,
- unsigned int /*nglyph */ ,
- CharInfoPtr * /*ppci */ ,
- void * /*pglyphBase */
+extern _X_EXPORT void miImageGlyphBlt(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ void *pglyphBase
);
/* mipoly.c */
@@ -381,36 +386,36 @@ extern _X_EXPORT void miPushPixels(GCPtr /*pGC */ ,
/* miscrinit.c */
-extern _X_EXPORT Bool miModifyPixmapHeader(PixmapPtr /*pPixmap */ ,
- int /*width */ ,
- int /*height */ ,
- int /*depth */ ,
- int /*bitsPerPixel */ ,
- int /*devKind */ ,
- void * /*pPixData */
+extern _X_EXPORT Bool miModifyPixmapHeader(PixmapPtr pPixmap,
+ int width,
+ int height,
+ int depth,
+ int bitsPerPixel,
+ int devKind,
+ void *pPixData
);
extern _X_EXPORT Bool miCreateScreenResources(ScreenPtr /*pScreen */
);
-extern _X_EXPORT Bool miScreenDevPrivateInit(ScreenPtr /*pScreen */ ,
- int /*width */ ,
- void * /*pbits */
+extern _X_EXPORT Bool miScreenDevPrivateInit(ScreenPtr pScreen,
+ int width,
+ void *pbits
);
-extern _X_EXPORT Bool miScreenInit(ScreenPtr /*pScreen */ ,
- void * /*pbits */ ,
- int /*xsize */ ,
- int /*ysize */ ,
- int /*dpix */ ,
- int /*dpiy */ ,
- int /*width */ ,
- int /*rootDepth */ ,
- int /*numDepths */ ,
- DepthPtr /*depths */ ,
- VisualID /*rootVisual */ ,
- int /*numVisuals */ ,
- VisualPtr /*visuals */
+extern _X_EXPORT Bool miScreenInit(ScreenPtr pScreen,
+ void *pbits,
+ int xsize,
+ int ysize,
+ int dpix,
+ int dpiy,
+ int width,
+ int rootDepth,
+ int numDepths,
+ DepthPtr depths,
+ VisualID rootVisual,
+ int numVisuals,
+ VisualPtr visuals
);
/* mivaltree.c */
@@ -452,6 +457,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/xorg-server/mi/miarc.c b/xorg-server/mi/miarc.c
index 4dcdd42a1..e0f09d243 100644
--- a/xorg-server/mi/miarc.c
+++ b/xorg-server/mi/miarc.c
@@ -891,7 +891,7 @@ miFillWideEllipse(DrawablePtr pDraw, GCPtr pGC, xArc * parc)
*/
void
-miPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
+miWideArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
{
int i;
xArc *parc;
@@ -3401,3 +3401,12 @@ drawQuadrant(struct arc_def *def,
y--;
}
}
+
+void
+miPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
+{
+ if (pGC->lineWidth == 0)
+ miZeroPolyArc(pDraw, pGC, narcs, parcs);
+ else
+ miWideArc(pDraw, pGC, narcs, parcs);
+}
diff --git a/xorg-server/mi/mifillarc.c b/xorg-server/mi/mifillarc.c
index 337343dd1..08484d703 100644
--- a/xorg-server/mi/mifillarc.c
+++ b/xorg-server/mi/mifillarc.c
@@ -476,26 +476,16 @@ miFillArcSliceSetup(xArc * arc, miArcSliceRec * slice, GCPtr pGC)
*wids++ = slw; \
}
-static void
-miFillEllipseI(DrawablePtr pDraw, GCPtr pGC, xArc * arc)
+static int
+miFillEllipseI(DrawablePtr pDraw, GCPtr pGC, xArc * arc, DDXPointPtr points, int *widths)
{
int x, y, e;
int yk, xk, ym, xm, dx, dy, xorg, yorg;
int slw;
miFillArcRec info;
- DDXPointPtr points;
DDXPointPtr pts;
- int *widths;
int *wids;
- points = malloc(sizeof(DDXPointRec) * arc->height);
- if (!points)
- return;
- widths = malloc(sizeof(int) * arc->height);
- if (!widths) {
- free(points);
- return;
- }
miFillArcSetup(arc, &info);
MIFILLARCSETUP();
if (pGC->miTranslate) {
@@ -508,31 +498,19 @@ miFillEllipseI(DrawablePtr pDraw, GCPtr pGC, xArc * arc)
MIFILLARCSTEP(slw);
ADDSPANS();
}
- (*pGC->ops->FillSpans) (pDraw, pGC, pts - points, points, widths, FALSE);
- free(widths);
- free(points);
+ return pts - points;
}
-static void
-miFillEllipseD(DrawablePtr pDraw, GCPtr pGC, xArc * arc)
+static int
+miFillEllipseD(DrawablePtr pDraw, GCPtr pGC, xArc * arc, DDXPointPtr points, int *widths)
{
int x, y;
int xorg, yorg, dx, dy, slw;
double e, yk, xk, ym, xm;
miFillArcDRec info;
- DDXPointPtr points;
DDXPointPtr pts;
- int *widths;
int *wids;
- points = malloc(sizeof(DDXPointRec) * arc->height);
- if (!points)
- return;
- widths = malloc(sizeof(int) * arc->height);
- if (!widths) {
- free(points);
- return;
- }
miFillArcDSetup(arc, &info);
MIFILLARCSETUP();
if (pGC->miTranslate) {
@@ -545,9 +523,7 @@ miFillEllipseD(DrawablePtr pDraw, GCPtr pGC, xArc * arc)
MIFILLARCSTEP(slw);
ADDSPANS();
}
- (*pGC->ops->FillSpans) (pDraw, pGC, pts - points, points, widths, FALSE);
- free(widths);
- free(points);
+ return pts - points;
}
#define ADDSPAN(l,r) \
@@ -572,17 +548,15 @@ miFillEllipseD(DrawablePtr pDraw, GCPtr pGC, xArc * arc)
ADDSPAN(xl, xc); \
}
-static void
-miFillArcSliceI(DrawablePtr pDraw, GCPtr pGC, xArc * arc)
+static int
+miFillArcSliceI(DrawablePtr pDraw, GCPtr pGC, xArc * arc, DDXPointPtr points, int *widths)
{
int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
int x, y, e;
miFillArcRec info;
miArcSliceRec slice;
int ya, xl, xr, xc;
- DDXPointPtr points;
DDXPointPtr pts;
- int *widths;
int *wids;
miFillArcSetup(arc, &info);
@@ -591,14 +565,6 @@ miFillArcSliceI(DrawablePtr pDraw, GCPtr pGC, xArc * arc)
slw = arc->height;
if (slice.flip_top || slice.flip_bot)
slw += (arc->height >> 1) + 1;
- points = malloc(sizeof(DDXPointRec) * slw);
- if (!points)
- return;
- widths = malloc(sizeof(int) * slw);
- if (!widths) {
- free(points);
- return;
- }
if (pGC->miTranslate) {
xorg += pDraw->x;
yorg += pDraw->y;
@@ -622,13 +588,11 @@ miFillArcSliceI(DrawablePtr pDraw, GCPtr pGC, xArc * arc)
ADDSLICESPANS(slice.flip_bot);
}
}
- (*pGC->ops->FillSpans) (pDraw, pGC, pts - points, points, widths, FALSE);
- free(widths);
- free(points);
+ return pts - points;
}
-static void
-miFillArcSliceD(DrawablePtr pDraw, GCPtr pGC, xArc * arc)
+static int
+miFillArcSliceD(DrawablePtr pDraw, GCPtr pGC, xArc * arc, DDXPointPtr points, int *widths)
{
int x, y;
int dx, dy, xorg, yorg, slw;
@@ -636,9 +600,7 @@ miFillArcSliceD(DrawablePtr pDraw, GCPtr pGC, xArc * arc)
miFillArcDRec info;
miArcSliceRec slice;
int ya, xl, xr, xc;
- DDXPointPtr points;
DDXPointPtr pts;
- int *widths;
int *wids;
miFillArcDSetup(arc, &info);
@@ -647,14 +609,6 @@ miFillArcSliceD(DrawablePtr pDraw, GCPtr pGC, xArc * arc)
slw = arc->height;
if (slice.flip_top || slice.flip_bot)
slw += (arc->height >> 1) + 1;
- points = malloc(sizeof(DDXPointRec) * slw);
- if (!points)
- return;
- widths = malloc(sizeof(int) * slw);
- if (!widths) {
- free(points);
- return;
- }
if (pGC->miTranslate) {
xorg += pDraw->x;
yorg += pDraw->y;
@@ -678,35 +632,69 @@ miFillArcSliceD(DrawablePtr pDraw, GCPtr pGC, xArc * arc)
ADDSLICESPANS(slice.flip_bot);
}
}
- (*pGC->ops->FillSpans) (pDraw, pGC, pts - points, points, widths, FALSE);
- free(widths);
- free(points);
+ return pts - points;
}
/* MIPOLYFILLARC -- The public entry for the PolyFillArc request.
* Since we don't have to worry about overlapping segments, we can just
* fill each arc as it comes.
*/
+
+/* Limit the number of spans in a single draw request to avoid integer
+ * overflow in the computation of the span buffer size.
+ */
+#define MAX_SPANS_PER_LOOP (4 * 1024 * 1024)
+
void
-miPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
+miPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs_all, xArc * parcs)
{
- int i;
- xArc *arc;
-
- for (i = narcs, arc = parcs; --i >= 0; arc++) {
- if (miFillArcEmpty(arc))
- continue;
- if ((arc->angle2 >= FULLCIRCLE) || (arc->angle2 <= -FULLCIRCLE)) {
- if (miCanFillArc(arc))
- miFillEllipseI(pDraw, pGC, arc);
- else
- miFillEllipseD(pDraw, pGC, arc);
- }
- else {
- if (miCanFillArc(arc))
- miFillArcSliceI(pDraw, pGC, arc);
- else
- miFillArcSliceD(pDraw, pGC, arc);
- }
+ while (narcs_all > 0) {
+ int narcs;
+ int i;
+ xArc *arc;
+ int nspans = 0;
+ DDXPointPtr pts, points;
+ int *wids, *widths;
+ int n;
+
+ for (narcs = 0, arc = parcs; narcs < narcs_all; narcs++, arc++) {
+ if (narcs && nspans + arc->height > MAX_SPANS_PER_LOOP)
+ break;
+ nspans += arc->height;
+ }
+
+ pts = points = malloc (sizeof (DDXPointRec) * nspans +
+ sizeof(int) * nspans);
+ if (points) {
+ wids = widths = (int *) (points + nspans);
+
+ for (i = 0, arc = parcs; i < narcs; arc++, i++) {
+ if (miFillArcEmpty(arc))
+ continue;
+ if ((arc->angle2 >= FULLCIRCLE) || (arc->angle2 <= -FULLCIRCLE))
+ {
+ if (miCanFillArc(arc))
+ n = miFillEllipseI(pDraw, pGC, arc, pts, wids);
+ else
+ n = miFillEllipseD(pDraw, pGC, arc, pts, wids);
+ }
+ else
+ {
+ if (miCanFillArc(arc))
+ n = miFillArcSliceI(pDraw, pGC, arc, pts, wids);
+ else
+ n = miFillArcSliceD(pDraw, pGC, arc, pts, wids);
+ }
+ pts += n;
+ wids += n;
+ }
+ nspans = pts - points;
+ if (nspans)
+ (*pGC->ops->FillSpans) (pDraw, pGC, nspans, points,
+ widths, FALSE);
+ free (points);
+ }
+ parcs += narcs;
+ narcs_all -= narcs;
}
}
diff --git a/xorg-server/mi/misprite.c b/xorg-server/mi/misprite.c
index 5bc2f62f2..f8ef795fd 100644
--- a/xorg-server/mi/misprite.c
+++ b/xorg-server/mi/misprite.c
@@ -520,6 +520,8 @@ miSpriteBlockHandler(ScreenPtr pScreen, void *pTimeout,
miCursorInfoPtr pCursorInfo;
Bool WorkToDo = FALSE;
+ SCREEN_PROLOGUE(pPriv, pScreen, BlockHandler);
+
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
if (DevHasCursor(pDev)) {
pCursorInfo = MISPRITE(pDev);
@@ -543,8 +545,6 @@ miSpriteBlockHandler(ScreenPtr pScreen, void *pTimeout,
}
}
- SCREEN_PROLOGUE(pPriv, pScreen, BlockHandler);
-
(*pScreen->BlockHandler) (pScreen, pTimeout, pReadmask);
if (WorkToDo)
diff --git a/xorg-server/mi/miwideline.c b/xorg-server/mi/miwideline.c
index ff64ab5d4..333b8cd3f 100644
--- a/xorg-server/mi/miwideline.c
+++ b/xorg-server/mi/miwideline.c
@@ -1983,3 +1983,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);
+ }
+}
diff --git a/xorg-server/mi/mizerarc.c b/xorg-server/mi/mizerarc.c
index 9dac180d1..b216cf43d 100644
--- a/xorg-server/mi/mizerarc.c
+++ b/xorg-server/mi/mizerarc.c
@@ -656,7 +656,7 @@ miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
for (arc = parcs, i = narcs; --i >= 0; arc++) {
if (!miCanZeroArc(arc))
- miPolyArc(pDraw, pGC, 1, arc);
+ miWideArc(pDraw, pGC, 1, arc);
else {
if (arc->width > arc->height)
n = arc->width + (arc->height >> 1);
diff --git a/xorg-server/mi/mizerline.c b/xorg-server/mi/mizerline.c
index 90798dbdf..f30e01239 100644
--- a/xorg-server/mi/mizerline.c
+++ b/xorg-server/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);