summaryrefslogtreecommitdiff
path: root/mi
diff options
context:
space:
mode:
authorKaleb Keithley <kaleb@freedesktop.org>2003-11-14 16:49:22 +0000
committerKaleb Keithley <kaleb@freedesktop.org>2003-11-14 16:49:22 +0000
commitd568221710959cf7d783e6ff0fb80fb43a231124 (patch)
tree8d6f039393294c6ffac8533639afdebe5d68bfc1 /mi
parent9508a382f8a9f241dab097d921b6d290c1c3a776 (diff)
Diffstat (limited to 'mi')
-rw-r--r--mi/cbrt.c17
-rw-r--r--mi/mi.h177
-rw-r--r--mi/miarc.c562
-rw-r--r--mi/mibitblt.c61
-rw-r--r--mi/mibstore.c266
-rw-r--r--mi/mibstore.h42
-rw-r--r--mi/mibstorest.h6
-rw-r--r--mi/miclipn.c21
-rw-r--r--mi/micursor.c2
-rw-r--r--mi/midash.c11
-rw-r--r--mi/midispcur.c262
-rw-r--r--mi/mieq.c7
-rw-r--r--mi/miexpose.c56
-rw-r--r--mi/mifillarc.c57
-rw-r--r--mi/mifillarc.h17
-rw-r--r--mi/mifillrct.c3
-rw-r--r--mi/mifpoly.h11
-rw-r--r--mi/mifpolycon.c25
-rw-r--r--mi/migc.c82
-rw-r--r--mi/migc.h41
-rw-r--r--mi/miglblt.c13
-rw-r--r--mi/miinitext.c385
-rw-r--r--mi/miline.h15
-rw-r--r--mi/mipointer.c77
-rw-r--r--mi/mipointer.h98
-rw-r--r--mi/mipointrst.h6
-rw-r--r--mi/mipoly.h13
-rw-r--r--mi/mipolycon.c41
-rw-r--r--mi/mipolygen.c2
-rw-r--r--mi/mipolypnt.c2
-rw-r--r--mi/mipolyrect.c2
-rw-r--r--mi/mipolyseg.c2
-rw-r--r--mi/mipolytext.c2
-rw-r--r--mi/mipolyutil.c5
-rw-r--r--mi/mipushpxl.c90
-rw-r--r--mi/miregion.c323
-rw-r--r--mi/miscrinit.c149
-rw-r--r--mi/mispans.c31
-rw-r--r--mi/mispans.h17
-rw-r--r--mi/misprite.c415
-rw-r--r--mi/misprite.h17
-rw-r--r--mi/mispritest.h8
-rw-r--r--mi/mivaltree.c124
-rw-r--r--mi/miwideline.c217
-rw-r--r--mi/miwideline.h40
-rw-r--r--mi/miwindow.c88
-rw-r--r--mi/mizerarc.c21
-rw-r--r--mi/mizerarc.h5
-rw-r--r--mi/mizerline.c590
49 files changed, 2580 insertions, 1944 deletions
diff --git a/mi/cbrt.c b/mi/cbrt.c
index 44a017ad5..44c836e43 100644
--- a/mi/cbrt.c
+++ b/mi/cbrt.c
@@ -26,14 +26,23 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/cbrt.c,v 3.4 2001/12/14 20:00:19 dawes Exp $ */
/* simple cbrt, in case your math library doesn't have a good one */
-double pow();
+/*
+ * Would normally include <math.h> for this, but for the sake of compiler
+ * warnings, we don't want to get duplicate declarations for cbrt().
+ */
+
+double pow(double, double);
+double cbrt(double);
double
-cbrt(x)
- double x;
+cbrt(double x)
{
- return pow(x, 1.0/3.0);
+ if (x > 0.0)
+ return pow(x, 1.0/3.0);
+ else
+ return -pow(-x, 1.0/3.0);
}
diff --git a/mi/mi.h b/mi/mi.h
index dd7dc94ed..fba57567d 100644
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -45,6 +45,8 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/mi/mi.h,v 3.10 2001/12/14 20:00:19 dawes Exp $ */
+
#ifndef MI_H
#define MI_H
#include "X11/X.h"
@@ -56,6 +58,8 @@ SOFTWARE.
#include "input.h"
#include "cursor.h"
+#define MiBits CARD32
+
typedef struct _miDash *miDashPtr;
#define EVEN_DASH 0
#define ODD_DASH ~0
@@ -63,18 +67,15 @@ typedef struct _miDash *miDashPtr;
/* miarc.c */
extern void miPolyArc(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*narcs*/,
xArc * /*parcs*/
-#endif
);
/* mibitblt.c */
extern RegionPtr miCopyArea(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrcDrawable*/,
DrawablePtr /*pDstDrawable*/,
GCPtr /*pGC*/,
@@ -84,25 +85,21 @@ extern RegionPtr miCopyArea(
int /*heightSrc*/,
int /*xOut*/,
int /*yOut*/
-#endif
);
extern void miOpqStipDrawable(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
RegionPtr /*prgnSrc*/,
- unsigned long * /*pbits*/,
+ MiBits * /*pbits*/,
int /*srcx*/,
int /*w*/,
int /*h*/,
int /*dstx*/,
int /*dsty*/
-#endif
);
extern RegionPtr miCopyPlane(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrcDrawable*/,
DrawablePtr /*pDstDrawable*/,
GCPtr /*pGC*/,
@@ -113,11 +110,9 @@ extern RegionPtr miCopyPlane(
int /*dstx*/,
int /*dsty*/,
unsigned long /*bitPlane*/
-#endif
);
extern void miGetImage(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
int /*sx*/,
int /*sy*/,
@@ -126,11 +121,9 @@ extern void miGetImage(
unsigned int /*format*/,
unsigned long /*planeMask*/,
char * /*pdstLine*/
-#endif
);
extern void miPutImage(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*depth*/,
@@ -141,48 +134,43 @@ extern void miPutImage(
int /*leftPad*/,
int /*format*/,
char * /*pImage*/
-#endif
);
/* miclipn.c */
extern void miClipNotify(
-#if NeedFunctionPrototypes
- void (* /*func*/)()
-#endif
+ void (* /*func*/)(
+ WindowPtr /* pWin */,
+ int /* dx */,
+ int /* dy */
+ )
);
/* micursor.c */
extern void miRecolorCursor(
-#if NeedFunctionPrototypes
ScreenPtr /*pScr*/,
CursorPtr /*pCurs*/,
Bool /*displayed*/
-#endif
);
/* midash.c */
extern miDashPtr miDashLine(
-#if NeedFunctionPrototypes
int /*npt*/,
DDXPointPtr /*ppt*/,
unsigned int /*nDash*/,
unsigned char * /*pDash*/,
unsigned int /*offset*/,
int * /*pnseg*/
-#endif
);
extern void miStepDash(
-#if NeedFunctionPrototypes
int /*dist*/,
int * /*pDashIndex*/,
unsigned char * /*pDash*/,
int /*numInDashList*/,
int * /*pDashOffset*/
-#endif
);
/* mieq.c */
@@ -193,35 +181,26 @@ typedef struct _DeviceRec *DevicePtr;
#endif
extern Bool mieqInit(
-#if NeedFunctionPrototypes
DevicePtr /*pKbd*/,
DevicePtr /*pPtr*/
-#endif
);
extern void mieqEnqueue(
-#if NeedFunctionPrototypes
xEventPtr /*e*/
-#endif
);
extern void mieqSwitchScreen(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
Bool /*fromDIX*/
-#endif
);
-extern int mieqProcessInputEvents(
-#if NeedFunctionPrototypes
+extern void mieqProcessInputEvents(
void
-#endif
);
/* miexpose.c */
extern RegionPtr miHandleExposures(
-#if NeedFunctionPrototypes
DrawablePtr /*pSrcDrawable*/,
DrawablePtr /*pDstDrawable*/,
GCPtr /*pGC*/,
@@ -232,66 +211,52 @@ extern RegionPtr miHandleExposures(
int /*dstx*/,
int /*dsty*/,
unsigned long /*plane*/
-#endif
);
extern void miSendGraphicsExpose(
-#if NeedFunctionPrototypes
ClientPtr /*client*/,
RegionPtr /*pRgn*/,
XID /*drawable*/,
int /*major*/,
int /*minor*/
-#endif
);
extern void miSendExposures(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
RegionPtr /*pRgn*/,
int /*dx*/,
int /*dy*/
-#endif
);
extern void miWindowExposures(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
RegionPtr /*prgn*/,
RegionPtr /*other_exposed*/
-#endif
);
extern void miPaintWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
RegionPtr /*prgn*/,
int /*what*/
-#endif
);
-extern int miClearDrawable(
-#if NeedFunctionPrototypes
+extern void miClearDrawable(
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/
-#endif
);
/* mifillrct.c */
extern void miPolyFillRect(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nrectFill*/,
xRectangle * /*prectInit*/
-#endif
);
/* miglblt.c */
extern void miPolyGlyphBlt(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*x*/,
@@ -299,11 +264,9 @@ extern void miPolyGlyphBlt(
unsigned int /*nglyph*/,
CharInfoPtr * /*ppci*/,
pointer /*pglyphBase*/
-#endif
);
extern void miImageGlyphBlt(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*x*/,
@@ -311,82 +274,68 @@ extern void miImageGlyphBlt(
unsigned int /*nglyph*/,
CharInfoPtr * /*ppci*/,
pointer /*pglyphBase*/
-#endif
);
/* mipoly.c */
extern void miFillPolygon(
-#if NeedFunctionPrototypes
DrawablePtr /*dst*/,
GCPtr /*pgc*/,
int /*shape*/,
int /*mode*/,
int /*count*/,
DDXPointPtr /*pPts*/
-#endif
);
/* mipolycon.c */
extern Bool miFillConvexPoly(
-#if NeedFunctionPrototypes
DrawablePtr /*dst*/,
GCPtr /*pgc*/,
int /*count*/,
DDXPointPtr /*ptsIn*/
-#endif
);
/* mipolygen.c */
extern Bool miFillGeneralPoly(
-#if NeedFunctionPrototypes
DrawablePtr /*dst*/,
GCPtr /*pgc*/,
int /*count*/,
DDXPointPtr /*ptsIn*/
-#endif
);
/* mipolypnt.c */
extern void miPolyPoint(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*mode*/,
int /*npt*/,
xPoint * /*pptInit*/
-#endif
);
/* mipolyrect.c */
extern void miPolyRectangle(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*nrects*/,
xRectangle * /*pRects*/
-#endif
);
/* mipolyseg.c */
extern void miPolySegment(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*nseg*/,
xSegment * /*pSegs*/
-#endif
);
/* mipolytext.c */
extern int miPolyText(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*x*/,
@@ -394,33 +343,27 @@ extern int miPolyText(
int /*count*/,
char * /*chars*/,
FontEncoding /*fontEncoding*/
-#endif
);
extern int miPolyText8(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*x*/,
int /*y*/,
int /*count*/,
char * /*chars*/
-#endif
);
extern int miPolyText16(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*x*/,
int /*y*/,
int /*count*/,
unsigned short * /*chars*/
-#endif
);
extern int miImageText(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*x*/,
@@ -428,35 +371,29 @@ extern int miImageText(
int /*count*/,
char * /*chars*/,
FontEncoding /*fontEncoding*/
-#endif
);
extern void miImageText8(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*x*/,
int /*y*/,
int /*count*/,
char * /*chars*/
-#endif
);
extern void miImageText16(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*x*/,
int /*y*/,
int /*count*/,
unsigned short * /*chars*/
-#endif
);
/* mipushpxl.c */
extern void miPushPixels(
-#if NeedFunctionPrototypes
GCPtr /*pGC*/,
PixmapPtr /*pBitMap*/,
DrawablePtr /*pDrawable*/,
@@ -464,7 +401,6 @@ extern void miPushPixels(
int /*dy*/,
int /*xOrg*/,
int /*yOrg*/
-#endif
);
/* miregion.c */
@@ -472,36 +408,30 @@ extern void miPushPixels(
/* see also region.h */
extern Bool miRectAlloc(
-#if NeedFunctionPrototypes
RegionPtr /*pRgn*/,
int /*n*/
-#endif
);
extern void miSetExtents(
-#if NeedFunctionPrototypes
RegionPtr /*pReg*/
-#endif
);
extern int miFindMaxBand(
-#if NeedFunctionPrototypes
RegionPtr /*prgn*/
-#endif
);
#ifdef DEBUG
extern Bool miValidRegion(
-#if NeedFunctionPrototypes
RegionPtr /*prgn*/
-#endif
);
#endif
+extern Bool miRegionDataCopy(RegionPtr dst, RegionPtr src);
+extern Bool miRegionBroken(RegionPtr pReg);
+
/* miscrinit.c */
extern Bool miModifyPixmapHeader(
-#if NeedFunctionPrototypes
PixmapPtr /*pPixmap*/,
int /*width*/,
int /*height*/,
@@ -509,37 +439,24 @@ extern Bool miModifyPixmapHeader(
int /*bitsPerPixel*/,
int /*devKind*/,
pointer /*pPixData*/
-#endif
);
extern Bool miCloseScreen(
-#if NeedFunctionPrototypes
int /*index*/,
ScreenPtr /*pScreen*/
-#endif
);
extern Bool miCreateScreenResources(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/
-#endif
);
extern Bool miScreenDevPrivateInit(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
int /*width*/,
pointer /*pbits*/
-#endif
);
-#ifndef _XTYPEDEF_MIBSFUNCPTR
-typedef struct _miBSFuncRec *miBSFuncPtr;
-#define _XTYPEDEF_MIBSFUNCPTR
-#endif
-
extern Bool miScreenInit(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
pointer /*pbits*/,
int /*xsize*/,
@@ -552,197 +469,167 @@ extern Bool miScreenInit(
DepthPtr /*depths*/,
VisualID /*rootVisual*/,
int /*numVisuals*/,
- VisualPtr /*visuals*/,
- miBSFuncPtr /*bsfuncs*/
-#endif
+ VisualPtr /*visuals*/
+);
+
+extern int miAllocateGCPrivateIndex(
+ void
+);
+
+extern PixmapPtr miGetScreenPixmap(
+ ScreenPtr pScreen
+);
+
+extern void miSetScreenPixmap(
+ PixmapPtr pPix
);
/* mivaltree.c */
extern int miShapedWindowIn(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
RegionPtr /*universe*/,
RegionPtr /*bounding*/,
BoxPtr /*rect*/,
int /*x*/,
int /*y*/
-#endif
);
extern int miValidateTree(
-#if NeedFunctionPrototypes
WindowPtr /*pParent*/,
WindowPtr /*pChild*/,
VTKind /*kind*/
-#endif
);
extern void miWideLine(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*mode*/,
int /*npt*/,
DDXPointPtr /*pPts*/
-#endif
);
extern void miWideDash(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*mode*/,
int /*npt*/,
DDXPointPtr /*pPts*/
-#endif
);
extern void miMiter(
-#if NeedFunctionPrototypes
void
-#endif
);
extern void miNotMiter(
-#if NeedFunctionPrototypes
void
-#endif
);
/* miwindow.c */
extern void miClearToBackground(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
int /*x*/,
int /*y*/,
int /*w*/,
int /*h*/,
Bool /*generateExposures*/
-#endif
);
extern Bool miChangeSaveUnder(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
WindowPtr /*first*/
-#endif
);
extern void miPostChangeSaveUnder(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
WindowPtr /*pFirst*/
-#endif
);
extern void miMarkWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/
-#endif
);
extern Bool miMarkOverlappedWindows(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
WindowPtr /*pFirst*/,
WindowPtr * /*ppLayerWin*/
-#endif
);
extern void miHandleValidateExposures(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/
-#endif
);
extern void miMoveWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
int /*x*/,
int /*y*/,
WindowPtr /*pNextSib*/,
VTKind /*kind*/
-#endif
);
extern void miSlideAndSizeWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
int /*x*/,
int /*y*/,
unsigned int /*w*/,
unsigned int /*h*/,
WindowPtr /*pSib*/
-#endif
);
extern WindowPtr miGetLayerWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/
-#endif
);
extern void miSetShape(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/
-#endif
);
extern void miChangeBorderWidth(
-#if NeedFunctionPrototypes
WindowPtr /*pWin*/,
unsigned int /*width*/
-#endif
);
extern void miMarkUnrealizedWindow(
-#if NeedFunctionPrototypes
WindowPtr /*pChild*/,
WindowPtr /*pWin*/,
Bool /*fromConfigure*/
-#endif
);
+extern void miSegregateChildren(WindowPtr pWin, RegionPtr pReg, int depth);
+
+/* mizerarc.c */
+
extern void miZeroPolyArc(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*narcs*/,
xArc * /*parcs*/
-#endif
);
/* mizerline.c */
extern void miZeroLine(
-#if NeedFunctionPrototypes
DrawablePtr /*dst*/,
GCPtr /*pgc*/,
int /*mode*/,
int /*nptInit*/,
DDXPointRec * /*pptInit*/
-#endif
);
extern void miZeroDashLine(
-#if NeedFunctionPrototypes
DrawablePtr /*dst*/,
GCPtr /*pgc*/,
int /*mode*/,
int /*nptInit*/,
DDXPointRec * /*pptInit*/
-#endif
);
extern void miPolyFillArc(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
int /*narcs*/,
xArc * /*parcs*/
-#endif
);
#endif /* MI_H */
diff --git a/mi/miarc.c b/mi/miarc.c
index db569fa41..8c86200ee 100644
--- a/mi/miarc.c
+++ b/mi/miarc.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/miarc.c,v 3.13 2002/01/12 22:20:33 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -48,7 +49,7 @@ SOFTWARE.
/* Author: Keith Packard and Bob Scheifler */
/* Warning: this code is toxic, do not dally very long here. */
-#ifdef _XOPEN_SOURCE
+#if defined(_XOPEN_SOURCE) || defined(__QNXNTO__)
#include <math.h>
#else
#define _XOPEN_SOURCE /* to get prototype for hypot on some systems */
@@ -67,12 +68,11 @@ SOFTWARE.
#include "mifillarc.h"
#include "Xfuncproto.h"
-static double miDsin(), miDcos(), miDasin(), miDatan2();
-double cbrt(
-#if NeedFunctionPrototypes
- double
-#endif
-);
+static double miDsin(double a);
+static double miDcos(double a);
+static double miDasin(double v);
+static double miDatan2(double dy, double dx);
+double cbrt(double);
#ifdef ICEILTEMPDECL
ICEILTEMPDECL
@@ -101,7 +101,7 @@ ICEILTEMPDECL
#undef max
#undef min
-#if defined (__GNUC__) && defined (__STDC__) && !defined (__STRICT_ANSI__)
+#if defined (__GNUC__) && !defined (__STRICT_ANSI__)
#define USE_INLINE
#endif
@@ -119,13 +119,13 @@ inline static const int min (const int x, const int y)
#else
static int
-max (x, y)
+max (int x, int y)
{
return x>y? x:y;
}
static int
-min (x, y)
+min (int x, int y)
{
return x<y? x:y;
}
@@ -242,12 +242,27 @@ typedef struct _miPolyArc {
GCLineWidth | GCCapStyle | GCJoinStyle)
static CARD32 gcvals[6];
-static void fillSpans(), newFinalSpan();
-static void drawArc(), drawQuadrant(), drawZeroArc();
-static void miArcJoin(), miArcCap(), miRoundCap(), miFreeArcs();
-static int computeAngleFromPath();
-static miPolyArcPtr miComputeArcs ();
-static int miGetArcPts();
+static void fillSpans(DrawablePtr pDrawable, GCPtr pGC);
+static void newFinalSpan(int y, register int xmin, register int xmax);
+static void drawArc(xArc *tarc, int l, int a0, int a1, miArcFacePtr right,
+ miArcFacePtr left);
+static void drawZeroArc(DrawablePtr pDraw, GCPtr pGC, xArc *tarc, int lw,
+ miArcFacePtr left, miArcFacePtr right);
+static void miArcJoin(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pLeft,
+ miArcFacePtr pRight, int xOrgLeft, int yOrgLeft,
+ double xFtransLeft, double yFtransLeft,
+ int xOrgRight, int yOrgRight,
+ double xFtransRight, double yFtransRight);
+static void miArcCap(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pFace,
+ int end, int xOrg, int yOrg, double xFtrans,
+ double yFtrans);
+static void miRoundCap(DrawablePtr pDraw, GCPtr pGC, SppPointRec pCenter,
+ SppPointRec pEnd, SppPointRec pCorner,
+ SppPointRec pOtherCorner, int fLineEnd,
+ int xOrg, int yOrg, double xFtrans, double yFtrans);
+static void miFreeArcs(miPolyArcPtr arcs, GCPtr pGC);
+static miPolyArcPtr miComputeArcs(xArc *parcs, int narcs, GCPtr pGC);
+static int miGetArcPts(SppArcPtr parc, int cpt, SppPointPtr *ppPts);
# define CUBED_ROOT_2 1.2599210498948732038115849718451499938964
# define CUBED_ROOT_4 1.5874010519681993173435330390930175781250
@@ -257,11 +272,12 @@ static int miGetArcPts();
*/
static void
-miArcSegment(pDraw, pGC, tarc, right, left)
- DrawablePtr pDraw;
- GCPtr pGC;
- xArc tarc;
- miArcFacePtr right, left;
+miArcSegment(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ xArc tarc,
+ miArcFacePtr right,
+ miArcFacePtr left)
{
int l = pGC->lineWidth;
int a0, a1, startAngle, endAngle;
@@ -397,6 +413,10 @@ typedef struct {
#define CACHESIZE 25
+static void drawQuadrant(struct arc_def *def, struct accelerators *acc,
+ int a0, int a1, int mask, miArcFacePtr right,
+ miArcFacePtr left, miArcSpanData *spdata);
+
static arcCacheRec arcCache[CACHESIZE];
static unsigned long lrustamp;
static arcCacheRec *lastCacheHit = &arcCache[0];
@@ -433,18 +453,18 @@ miFreeArcCache (data, id)
}
static void
-miComputeCircleSpans(lw, parc, spdata)
- int lw;
- xArc *parc;
- miArcSpanData *spdata;
+miComputeCircleSpans(
+ int lw,
+ xArc *parc,
+ miArcSpanData *spdata)
{
register miArcSpan *span;
int doinner;
register int x, y, e;
int xk, yk, xm, ym, dx, dy;
register int slw, inslw;
- int inx, iny, ine;
- int inxk, inyk, inxm, inym;
+ int inx = 0, iny, ine = 0;
+ int inxk = 0, inyk = 0, inxm = 0, inym = 0;
doinner = -lw;
slw = parc->width - doinner;
@@ -501,15 +521,15 @@ miComputeCircleSpans(lw, parc, spdata)
}
static void
-miComputeEllipseSpans(lw, parc, spdata)
- int lw;
- xArc *parc;
- miArcSpanData *spdata;
+miComputeEllipseSpans(
+ int lw,
+ xArc *parc,
+ miArcSpanData *spdata)
{
register miArcSpan *span;
double w, h, r, xorg;
double Hs, Hf, WH, K, Vk, Nk, Fk, Vr, N, Nc, Z, rs;
- double A, T, b, d, x, y, t, inx, outx, hepp, hepm;
+ double A, T, b, d, x, y, t, inx, outx = 0.0, hepp, hepm;
int flip, solution;
w = (double)parc->width / 2.0;
@@ -587,7 +607,10 @@ miComputeEllipseSpans(lw, parc, spdata)
t = y / h;
x = w * sqrt(1 - (t * t));
t = K - y;
- t = sqrt(rs - (t * t));
+ if (rs - (t * t) >= 0)
+ t = sqrt(rs - (t * t));
+ else
+ t = 0;
if (flip == 2)
inx = x - t;
else
@@ -612,7 +635,10 @@ miComputeEllipseSpans(lw, parc, spdata)
t = y / h;
x = w * sqrt(1 - (t * t));
t = K - y;
- inx = x - sqrt(rs - (t * t));
+ if (rs - (t * t) >= 0)
+ inx = x - sqrt(rs - (t * t));
+ else
+ inx = x;
}
y = (b - d) / 2;
if (y >= 0.0)
@@ -622,7 +648,10 @@ miComputeEllipseSpans(lw, parc, spdata)
t = y / h;
x = w * sqrt(1 - (t * t));
t = K - y;
- t = sqrt(rs - (t * t));
+ if (rs - (t * t) >= 0)
+ t = sqrt(rs - (t * t));
+ else
+ t = 0;
if (flip == 1)
inx = x - t;
else
@@ -685,11 +714,11 @@ miComputeEllipseSpans(lw, parc, spdata)
}
static double
-tailX(K, def, bounds, acc)
- double K;
- struct arc_def *def;
- struct arc_bound *bounds;
- struct accelerators *acc;
+tailX(
+ double K,
+ struct arc_def *def,
+ struct arc_bound *bounds,
+ struct accelerators *acc)
{
double w, h, r;
double Hs, Hf, WH, Vk, Nk, Fk, Vr, N, Nc, Z, rs;
@@ -769,7 +798,10 @@ tailX(K, def, bounds, acc)
t = y / h;
x = w * sqrt(1 - (t * t));
t = K - y;
- t = sqrt(rs - (t * t));
+ if (rs - (t * t) >= 0)
+ t = sqrt(rs - (t * t));
+ else
+ t = 0;
*xp++ = x - t;
}
}
@@ -791,7 +823,10 @@ tailX(K, def, bounds, acc)
t = y / h;
x = w * sqrt(1 - (t * t));
t = K - y;
- *xp++ = x - sqrt(rs - (t * t));
+ if (rs - (t * t) >= 0)
+ *xp++ = x - sqrt(rs - (t * t));
+ else
+ *xp++ = x;
}
y = (b - d) / 2;
if (y >= 0.0 && flip == 1)
@@ -801,7 +836,10 @@ tailX(K, def, bounds, acc)
t = y / h;
x = w * sqrt(1 - (t * t));
t = K - y;
- t = sqrt(rs - (t * t));
+ if (rs - (t * t) >= 0)
+ t = sqrt(rs - (t * t));
+ else
+ t = 0;
*xp++ = x - t;
}
}
@@ -817,10 +855,10 @@ tailX(K, def, bounds, acc)
}
static miArcSpanData *
-miComputeWideEllipse(lw, parc, mustFree)
- int lw;
- register xArc *parc;
- Bool *mustFree;
+miComputeWideEllipse(
+ int lw,
+ register xArc *parc,
+ Bool *mustFree)
{
register miArcSpanData *spdata;
register arcCacheRec *cent, *lruent;
@@ -896,10 +934,10 @@ miComputeWideEllipse(lw, parc, mustFree)
}
static void
-miFillWideEllipse(pDraw, pGC, parc)
- DrawablePtr pDraw;
- GCPtr pGC;
- xArc *parc;
+miFillWideEllipse(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ xArc *parc)
{
DDXPointPtr points;
register DDXPointPtr pts;
@@ -1039,8 +1077,8 @@ miPolyArc(pDraw, pGC, narcs, parcs)
register int i;
xArc *parc;
int xMin, xMax, yMin, yMax;
- int pixmapWidth, pixmapHeight;
- int xOrg, yOrg;
+ int pixmapWidth = 0, pixmapHeight = 0;
+ int xOrg = 0, yOrg = 0;
int width;
Bool fTricky;
DrawablePtr pDrawTo;
@@ -1259,8 +1297,7 @@ miPolyArc(pDraw, pGC, narcs, parcs)
}
static double
-angleBetween (center, point1, point2)
- SppPointRec center, point1, point2;
+angleBetween (SppPointRec center, SppPointRec point1, SppPointRec point2)
{
double a1, a2, a;
@@ -1279,10 +1316,12 @@ angleBetween (center, point1, point2)
}
static void
-translateBounds (b, x, y, fx, fy)
-miArcFacePtr b;
-int x, y;
-double fx, fy;
+translateBounds (
+ miArcFacePtr b,
+ int x,
+ int y,
+ double fx,
+ double fy)
{
fx += x;
fy += y;
@@ -1295,16 +1334,11 @@ double fx, fy;
}
static void
-miArcJoin (pDraw, pGC, pLeft, pRight,
- xOrgLeft, yOrgLeft, xFtransLeft, yFtransLeft,
- xOrgRight, yOrgRight, xFtransRight, yFtransRight)
- DrawablePtr pDraw;
- GCPtr pGC;
- miArcFacePtr pRight, pLeft;
- int xOrgRight, yOrgRight;
- double xFtransRight, yFtransRight;
- int xOrgLeft, yOrgLeft;
- double xFtransLeft, yFtransLeft;
+miArcJoin(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pLeft,
+ miArcFacePtr pRight, int xOrgLeft, int yOrgLeft,
+ double xFtransLeft, double yFtransLeft,
+ int xOrgRight, int yOrgRight,
+ double xFtransRight, double yFtransRight)
{
SppPointRec center, corner, otherCorner;
SppPointRec poly[5], e;
@@ -1312,7 +1346,7 @@ miArcJoin (pDraw, pGC, pLeft, pRight,
int cpt;
SppArcRec arc;
miArcFaceRec Right, Left;
- int polyLen;
+ int polyLen = 0;
int xOrg, yOrg;
double xFtrans, yFtrans;
double a;
@@ -1410,13 +1444,15 @@ miArcJoin (pDraw, pGC, pLeft, pRight,
/*ARGSUSED*/
static void
-miArcCap (pDraw, pGC, pFace, end, xOrg, yOrg, xFtrans, yFtrans)
- DrawablePtr pDraw;
- GCPtr pGC;
- miArcFacePtr pFace;
- int end;
- int xOrg, yOrg;
- double xFtrans, yFtrans;
+miArcCap (
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ miArcFacePtr pFace,
+ int end,
+ int xOrg,
+ int yOrg,
+ double xFtrans,
+ double yFtrans)
{
SppPointRec corner, otherCorner, center, endPoint, poly[5];
@@ -1461,18 +1497,21 @@ miArcCap (pDraw, pGC, pFace, end, xOrg, yOrg, xFtrans, yFtrans)
*/
/*ARGSUSED*/
static void
-miRoundCap(pDraw, pGC, pCenter, pEnd, pCorner, pOtherCorner, fLineEnd,
- xOrg, yOrg, xFtrans, yFtrans)
- DrawablePtr pDraw;
- GCPtr pGC;
- SppPointRec pCenter, pEnd;
- SppPointRec pCorner, pOtherCorner;
- int fLineEnd, xOrg, yOrg;
- double xFtrans, yFtrans;
+miRoundCap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ SppPointRec pCenter,
+ SppPointRec pEnd,
+ SppPointRec pCorner,
+ SppPointRec pOtherCorner,
+ int fLineEnd,
+ int xOrg,
+ int yOrg,
+ double xFtrans,
+ double yFtrans)
{
int cpt;
double width;
- double miDatan2 ();
SppArcRec arc;
SppPointPtr pArcPts;
@@ -1518,8 +1557,7 @@ miRoundCap(pDraw, pGC, pCenter, pEnd, pCorner, pOtherCorner, fLineEnd,
# define mod(a,b) ((a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
static double
-miDcos (a)
-double a;
+miDcos (double a)
{
int i;
@@ -1536,8 +1574,7 @@ double a;
}
static double
-miDsin (a)
-double a;
+miDsin (double a)
{
int i;
@@ -1554,8 +1591,7 @@ double a;
}
static double
-miDasin (v)
-double v;
+miDasin (double v)
{
if (v == 0)
return 0.0;
@@ -1567,8 +1603,7 @@ double v;
}
static double
-miDatan2 (dy, dx)
-double dy, dx;
+miDatan2 (double dy, double dx)
{
if (dy == 0) {
if (dx >= 0)
@@ -1600,16 +1635,16 @@ double dy, dx;
* This procedure allocates the space necessary to fit the arc points.
* Sometimes it's convenient for those points to be at the end of an existing
* array. (For example, if we want to leave a spare point to make sectors
- * instead of segments.) So we pass in the Xalloc()ed chunk that contains the
+ * instead of segments.) So we pass in the xalloc()ed chunk that contains the
* array and an index saying where we should start stashing the points.
* If there isn't an array already, we just pass in a null pointer and
- * count on Xrealloc() to handle the null pointer correctly.
+ * count on xrealloc() to handle the null pointer correctly.
*/
static int
-miGetArcPts(parc, cpt, ppPts)
- SppArcPtr parc; /* points to an arc */
- int cpt; /* number of points already in arc list */
- SppPointPtr *ppPts; /* pointer to pointer to arc-list -- modified */
+miGetArcPts(
+ SppArcPtr parc, /* points to an arc */
+ int cpt, /* number of points already in arc list */
+ SppPointPtr *ppPts) /* pointer to pointer to arc-list -- modified */
{
double st, /* Start Theta, start angle */
et, /* End Theta, offset from start theta */
@@ -1701,10 +1736,12 @@ struct arcData {
# define ADD_REALLOC_STEP 20
static void
-addCap (capsp, ncapsp, sizep, end, arcIndex)
- miArcCapPtr *capsp;
- int *ncapsp, *sizep;
- int end, arcIndex;
+addCap (
+ miArcCapPtr *capsp,
+ int *ncapsp,
+ int *sizep,
+ int end,
+ int arcIndex)
{
int newsize;
miArcCapPtr cap;
@@ -1726,10 +1763,16 @@ addCap (capsp, ncapsp, sizep, end, arcIndex)
}
static void
-addJoin (joinsp, njoinsp, sizep, end0, index0, phase0, end1, index1, phase1)
- miArcJoinPtr *joinsp;
- int *njoinsp, *sizep;
- int end0, index0, phase0, end1, index1, phase1;
+addJoin (
+ miArcJoinPtr *joinsp,
+ int *njoinsp,
+ int *sizep,
+ int end0,
+ int index0,
+ int phase0,
+ int end1,
+ int index1,
+ int phase1)
{
int newsize;
miArcJoinPtr join;
@@ -1755,10 +1798,11 @@ addJoin (joinsp, njoinsp, sizep, end0, index0, phase0, end1, index1, phase1)
}
static miArcDataPtr
-addArc (arcsp, narcsp, sizep, xarc)
- miArcDataPtr *arcsp;
- int *narcsp, *sizep;
- xArc *xarc;
+addArc (
+ miArcDataPtr *arcsp,
+ int *narcsp,
+ int *sizep,
+ xArc *xarc)
{
int newsize;
miArcDataPtr arc;
@@ -1780,9 +1824,9 @@ addArc (arcsp, narcsp, sizep, xarc)
}
static void
-miFreeArcs(arcs, pGC)
- miPolyArcPtr arcs;
- GCPtr pGC;
+miFreeArcs(
+ miPolyArcPtr arcs,
+ GCPtr pGC)
{
int iphase;
@@ -1819,13 +1863,16 @@ typedef struct {
double map[DASH_MAP_SIZE];
} dashMap;
+static int computeAngleFromPath(int startAngle, int endAngle, dashMap *map,
+ int *lenp, int backwards);
+
static void
-computeDashMap (arcp, map)
- xArc *arcp;
- dashMap *map;
+computeDashMap (
+ xArc *arcp,
+ dashMap *map)
{
int di;
- double a, x, y, prevx, prevy, dist;
+ double a, x, y, prevx = 0.0, prevy = 0.0, dist;
for (di = 0; di < DASH_MAP_SIZE; di++) {
a = dashIndexToAngle (di);
@@ -1847,15 +1894,15 @@ typedef enum {HORIZONTAL, VERTICAL, OTHER} arcTypes;
/* this routine is a bit gory */
static miPolyArcPtr
-miComputeArcs (parcs, narcs, pGC)
- xArc *parcs;
- int narcs;
- GCPtr pGC;
+miComputeArcs (
+ xArc *parcs,
+ int narcs,
+ GCPtr pGC)
{
int isDashed, isDoubleDash;
int dashOffset;
miPolyArcPtr arcs;
- int start, i, j, k, nexti, nextk;
+ int start, i, j, k = 0, nexti, nextk = 0;
int joinSize[2];
int capSize[2];
int arcSize[2];
@@ -1864,13 +1911,13 @@ miComputeArcs (parcs, narcs, pGC)
struct arcData *data;
miArcDataPtr arc;
xArc xarc;
- int iphase, prevphase, joinphase;
+ int iphase, prevphase = 0, joinphase;
int arcsJoin;
int selfJoin;
- int iDash, dashRemaining;
- int iDashStart, dashRemainingStart, iphaseStart;
- int startAngle, spanAngle, endAngle, backwards;
+ int iDash = 0, dashRemaining;
+ int iDashStart = 0, dashRemainingStart = 0, iphaseStart;
+ int startAngle, spanAngle, endAngle, backwards = 0;
int prevDashAngle, dashAngle;
dashMap map;
@@ -2242,9 +2289,9 @@ arcfail:
}
static double
-angleToLength (angle, map)
- int angle;
- dashMap *map;
+angleToLength (
+ int angle,
+ dashMap *map)
{
double len, excesslen, sidelen = map->map[DASH_MAP_SIZE - 1], totallen;
int di;
@@ -2292,9 +2339,9 @@ angleToLength (angle, map)
*/
static int
-lengthToAngle (len, map)
- double len;
- dashMap *map;
+lengthToAngle (
+ double len,
+ dashMap *map)
{
double sidelen = map->map[DASH_MAP_SIZE - 1];
int angle, angleexcess;
@@ -2364,11 +2411,12 @@ lengthToAngle (len, map)
*/
static int
-computeAngleFromPath (startAngle, endAngle, map, lenp, backwards)
- int startAngle, endAngle; /* normalized absolute angles in *64 degrees */
- dashMap *map;
- int *lenp;
- int backwards;
+computeAngleFromPath (
+ int startAngle,
+ int endAngle, /* normalized absolute angles in *64 degrees */
+ dashMap *map,
+ int *lenp,
+ int backwards)
{
int a0, a1, a;
double len0;
@@ -2409,14 +2457,15 @@ computeAngleFromPath (startAngle, endAngle, map, lenp, backwards)
*/
static void
-drawZeroArc (pDraw, pGC, tarc, lw, left, right)
- DrawablePtr pDraw;
- GCPtr pGC;
- xArc *tarc;
- int lw;
- miArcFacePtr right, left;
+drawZeroArc (
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ xArc *tarc,
+ int lw,
+ miArcFacePtr left,
+ miArcFacePtr right)
{
- double x0, y0, x1, y1, w, h, x, y;
+ double x0 = 0.0, y0 = 0.0, x1 = 0.0, y1 = 0.0, w, h, x, y;
double xmax, ymax, xmin, ymin;
int a0, a1;
double a, startAngle, endAngle;
@@ -2543,9 +2592,9 @@ drawZeroArc (pDraw, pGC, tarc, lw, left, right)
*/
static void
-tailEllipseY (def, acc)
- struct arc_def *def;
- struct accelerators *acc;
+tailEllipseY (
+ struct arc_def *def,
+ struct accelerators *acc)
{
double t;
@@ -2572,46 +2621,50 @@ tailEllipseY (def, acc)
*/
static double
-outerXfromXY (x, y, def, acc)
- double x, y;
- struct arc_def *def;
- struct accelerators *acc;
+outerXfromXY (
+ double x,
+ double y,
+ struct arc_def *def,
+ struct accelerators *acc)
{
return x + (x * acc->h2l) / sqrt (x*x * acc->h4 + y*y * acc->w4);
}
static double
-outerYfromXY (x, y, def, acc)
- double x, y;
- struct arc_def *def;
- struct accelerators *acc;
+outerYfromXY (
+ double x,
+ double y,
+ struct arc_def *def,
+ struct accelerators *acc)
{
return y + (y * acc->w2l) / sqrt (x*x * acc->h4 + y*y * acc->w4);
}
static double
-innerXfromXY (x, y, def, acc)
- double x, y;
- struct arc_def *def;
- struct accelerators *acc;
+innerXfromXY (
+ double x,
+ double y,
+ struct arc_def *def,
+ struct accelerators *acc)
{
return x - (x * acc->h2l) / sqrt (x*x * acc->h4 + y*y * acc->w4);
}
static double
-innerYfromXY (x, y, def, acc)
- double x, y;
- struct arc_def *def;
- struct accelerators *acc;
+innerYfromXY (
+ double x,
+ double y,
+ struct arc_def *def,
+ struct accelerators *acc)
{
return y - (y * acc->w2l) / sqrt (x*x * acc->h4 + y*y * acc->w4);
}
static double
-innerYfromY (y, def, acc)
- double y;
- struct arc_def *def;
- struct accelerators *acc;
+innerYfromY (
+ double y,
+ struct arc_def *def,
+ struct accelerators *acc)
{
double x;
@@ -2621,9 +2674,12 @@ innerYfromY (y, def, acc)
}
static void
-computeLine (x1, y1, x2, y2, line)
- double x1, y1, x2, y2;
- struct line *line;
+computeLine (
+ double x1,
+ double y1,
+ double x2,
+ double y2,
+ struct line *line)
{
if (y1 == y2)
line->valid = 0;
@@ -2641,11 +2697,11 @@ computeLine (x1, y1, x2, y2, line)
*/
static void
-computeAcc (tarc, lw, def, acc)
- xArc *tarc;
- int lw;
- struct arc_def *def;
- struct accelerators *acc;
+computeAcc (
+ xArc *tarc,
+ int lw,
+ struct arc_def *def,
+ struct accelerators *acc)
{
def->w = ((double) tarc->width) / 2.0;
def->h = ((double) tarc->height) / 2.0;
@@ -2671,11 +2727,12 @@ computeAcc (tarc, lw, def, acc)
*/
static void
-computeBound (def, bound, acc, right, left)
- struct arc_def *def;
- struct arc_bound *bound;
- struct accelerators *acc;
- miArcFacePtr right, left;
+computeBound (
+ struct arc_def *def,
+ struct arc_bound *bound,
+ struct accelerators *acc,
+ miArcFacePtr right,
+ miArcFacePtr left)
{
double t;
double innerTaily;
@@ -2811,11 +2868,11 @@ computeBound (def, bound, acc, right, left)
*/
static double
-hookEllipseY (scan_y, bound, acc, left)
- double scan_y;
- struct arc_bound *bound;
- struct accelerators *acc;
- int left;
+hookEllipseY (
+ double scan_y,
+ struct arc_bound *bound,
+ struct accelerators *acc,
+ int left)
{
double ret;
@@ -2837,12 +2894,12 @@ hookEllipseY (scan_y, bound, acc, left)
*/
static double
-hookX (scan_y, def, bound, acc, left)
- double scan_y;
- struct arc_def *def;
- struct arc_bound *bound;
- struct accelerators *acc;
- int left;
+hookX (
+ double scan_y,
+ struct arc_def *def,
+ struct arc_bound *bound,
+ struct accelerators *acc,
+ int left)
{
double ellipse_y, x;
double maxMin;
@@ -2894,16 +2951,16 @@ hookX (scan_y, def, bound, acc, left)
*/
static void
-arcSpan (y, lx, lw, rx, rw, def, bounds, acc, mask)
- int y;
- int lx;
- int lw;
- int rx;
- int rw;
- struct arc_def *def;
- struct arc_bound *bounds;
- struct accelerators *acc;
- int mask;
+arcSpan (
+ int y,
+ int lx,
+ int lw,
+ int rx,
+ int rw,
+ struct arc_def *def,
+ struct arc_bound *bounds,
+ struct accelerators *acc,
+ int mask)
{
int linx, loutx, rinx, routx;
double x, altx;
@@ -2964,15 +3021,15 @@ arcSpan (y, lx, lw, rx, rw, def, bounds, acc, mask)
}
static void
-arcSpan0 (lx, lw, rx, rw, def, bounds, acc, mask)
- int lx;
- int lw;
- int rx;
- int rw;
- struct arc_def *def;
- struct arc_bound *bounds;
- struct accelerators *acc;
- int mask;
+arcSpan0 (
+ int lx,
+ int lw,
+ int rx,
+ int rw,
+ struct arc_def *def,
+ struct arc_bound *bounds,
+ struct accelerators *acc,
+ int mask)
{
double x;
@@ -2992,14 +3049,14 @@ arcSpan0 (lx, lw, rx, rw, def, bounds, acc, mask)
}
static void
-tailSpan (y, lw, rw, def, bounds, acc, mask)
- int y;
- int lw;
- int rw;
- struct arc_def *def;
- struct arc_bound *bounds;
- struct accelerators *acc;
- int mask;
+tailSpan (
+ int y,
+ int lw,
+ int rw,
+ struct arc_def *def,
+ struct arc_bound *bounds,
+ struct accelerators *acc,
+ int mask)
{
double yy, xalt, x, lx, rx;
int n;
@@ -3101,7 +3158,7 @@ realAllocSpan ()
}
static void
-disposeFinalSpans ()
+disposeFinalSpans (void)
{
struct finalSpanChunk *chunk, *next;
@@ -3116,9 +3173,9 @@ disposeFinalSpans ()
}
static void
-fillSpans (pDrawable, pGC)
- DrawablePtr pDrawable;
- GCPtr pGC;
+fillSpans (
+ DrawablePtr pDrawable,
+ GCPtr pGC)
{
register struct finalSpan *span;
register DDXPointPtr xSpan;
@@ -3131,8 +3188,8 @@ fillSpans (pDrawable, pGC)
if (nspans == 0)
return;
- xSpan = xSpans = (DDXPointPtr) xalloc (nspans * sizeof (DDXPointRec));
- xWidth = xWidths = (int *) xalloc (nspans * sizeof (int));
+ xSpan = xSpans = (DDXPointPtr) ALLOCATE_LOCAL (nspans * sizeof (DDXPointRec));
+ xWidth = xWidths = (int *) ALLOCATE_LOCAL (nspans * sizeof (int));
if (xSpans && xWidths)
{
i = 0;
@@ -3151,8 +3208,10 @@ fillSpans (pDrawable, pGC)
(*pGC->ops->FillSpans) (pDrawable, pGC, i, xSpans, xWidths, TRUE);
}
disposeFinalSpans ();
- xfree (xSpans);
- xfree (xWidths);
+ if (xSpans)
+ DEALLOCATE_LOCAL (xSpans);
+ if (xWidths)
+ DEALLOCATE_LOCAL (xWidths);
finalMiny = 0;
finalMaxy = -1;
finalSize = 0;
@@ -3166,8 +3225,7 @@ fillSpans (pDrawable, pGC)
realFindSpan (y))
static struct finalSpan **
-realFindSpan (y)
- int y;
+realFindSpan (int y)
{
struct finalSpan **newSpans;
int newSize, newMiny, newMaxy;
@@ -3218,9 +3276,10 @@ realFindSpan (y)
}
static void
-newFinalSpan (y, xmin, xmax)
- int y;
- register int xmin, xmax;
+newFinalSpan (
+ int y,
+ register int xmin,
+ register int xmax)
{
register struct finalSpan *x;
register struct finalSpan **f;
@@ -3275,9 +3334,9 @@ newFinalSpan (y, xmin, xmax)
}
static void
-mirrorSppPoint (quadrant, sppPoint)
- int quadrant;
- SppPointPtr sppPoint;
+mirrorSppPoint (
+ int quadrant,
+ SppPointPtr sppPoint)
{
switch (quadrant) {
case 0:
@@ -3308,17 +3367,20 @@ mirrorSppPoint (quadrant, sppPoint)
*/
static void
-drawArc (tarc, l, a0, a1, right, left)
- xArc *tarc;
- int l, a0, a1;
- miArcFacePtr right, left; /* save end line points */
+drawArc (
+ xArc *tarc,
+ int l,
+ int a0,
+ int a1,
+ miArcFacePtr right,
+ miArcFacePtr left) /* save end line points */
{
struct arc_def def;
struct accelerators acc;
int startq, endq, curq;
- int rightq, leftq, righta, lefta;
+ int rightq, leftq = 0, righta = 0, lefta = 0;
miArcFacePtr passRight, passLeft;
- int q0, q1, mask;
+ int q0 = 0, q1 = 0, mask;
struct band {
int a0, a1;
int mask;
@@ -3547,13 +3609,15 @@ drawArc (tarc, l, a0, a1, right, left)
}
static void
-drawQuadrant (def, acc, a0, a1, mask, right, left, spdata)
- struct arc_def *def;
- struct accelerators *acc;
- int a0, a1;
- int mask;
- miArcFacePtr right, left;
- miArcSpanData *spdata;
+drawQuadrant (
+ struct arc_def *def,
+ struct accelerators *acc,
+ int a0,
+ int a1,
+ int mask,
+ miArcFacePtr right,
+ miArcFacePtr left,
+ miArcSpanData *spdata)
{
struct arc_bound bound;
double yy, x, xalt;
diff --git a/mi/mibitblt.c b/mi/mibitblt.c
index 762e7effa..f0228212c 100644
--- a/mi/mibitblt.c
+++ b/mi/mibitblt.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mibitblt.c,v 3.11 2001/12/14 20:00:20 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -268,19 +269,26 @@ miCopyArea(pSrcDrawable, pDstDrawable,
* No clever strategy here, we grab a scanline at a time, pull out the
* bits and then stuff them in a 1 bit deep map.
*/
+/*
+ * This should be replaced with something more general. mi shouldn't have to
+ * care about such things as scanline padding et alia.
+ */
static
-unsigned long *
-miGetPlane(pDraw, planeNum, sx, sy, w, h, result)
- DrawablePtr pDraw;
- int planeNum; /* number of the bitPlane */
- int sx, sy, w, h;
- unsigned long *result;
+MiBits *
+miGetPlane(
+ DrawablePtr pDraw,
+ int planeNum, /* number of the bitPlane */
+ int sx,
+ int sy,
+ int w,
+ int h,
+ MiBits *result)
{
int i, j, k, width, bitsPerPixel, widthInBytes;
- DDXPointRec pt;
- unsigned long pixel;
- unsigned long bit;
- unsigned char *pCharsOut;
+ DDXPointRec pt = {0, 0};
+ MiBits pixel;
+ MiBits bit;
+ unsigned char *pCharsOut = NULL;
#if BITMAP_SCANLINE_UNIT == 8
#define OUT_TYPE unsigned char
@@ -296,15 +304,15 @@ miGetPlane(pDraw, planeNum, sx, sy, w, h, result)
#endif
OUT_TYPE *pOut;
- int delta;
+ int delta = 0;
sx += pDraw->x;
sy += pDraw->y;
widthInBytes = BitmapBytePad(w);
if(!result)
- result = (unsigned long *)xalloc(h * widthInBytes);
+ result = (MiBits *)xalloc(h * widthInBytes);
if (!result)
- return (unsigned long *)NULL;
+ return (MiBits *)NULL;
bitsPerPixel = pDraw->bitsPerPixel;
bzero((char *)result, h * widthInBytes);
pOut = (OUT_TYPE *) result;
@@ -344,12 +352,23 @@ miGetPlane(pDraw, planeNum, sx, sy, w, h, result)
* Now get the bit and insert into a bitmap in XY format.
*/
bit = (pixel >> planeNum) & 1;
+#ifndef XFree86Server
/* XXX assuming bit order == byte order */
#if BITMAP_BIT_ORDER == LSBFirst
bit <<= k;
#else
bit <<= ((BITMAP_SCANLINE_UNIT - 1) - k);
#endif
+#else
+ /* XXX assuming byte order == LSBFirst */
+ if (screenInfo.bitmapBitOrder == LSBFirst)
+ bit <<= k;
+ else
+ bit <<= ((screenInfo.bitmapScanlineUnit - 1) -
+ (k % screenInfo.bitmapScanlineUnit)) +
+ ((k / screenInfo.bitmapScanlineUnit) *
+ screenInfo.bitmapScanlineUnit);
+#endif
*pOut |= (OUT_TYPE) bit;
k++;
if (k == BITMAP_SCANLINE_UNIT)
@@ -380,7 +399,7 @@ miOpqStipDrawable(pDraw, pGC, prgnSrc, pbits, srcx, w, h, dstx, dsty)
DrawablePtr pDraw;
GCPtr pGC;
RegionPtr prgnSrc;
- unsigned long *pbits;
+ MiBits *pbits;
int srcx, w, h, dstx, dsty;
{
int oldfill, i;
@@ -537,7 +556,7 @@ miCopyPlane(pSrcDrawable, pDstDrawable,
int dstx, dsty;
unsigned long bitPlane;
{
- unsigned long *ptile;
+ MiBits *ptile;
BoxRec box;
RegionPtr prgnSrc, prgnExposed;
@@ -589,7 +608,7 @@ miCopyPlane(pSrcDrawable, pDstDrawable,
ptile = miGetPlane(pSrcDrawable, ffs(bitPlane) - 1,
box.x1, box.y1,
box.x2 - box.x1, box.y2 - box.y1,
- (unsigned long *) NULL);
+ (MiBits *) NULL);
if (ptile)
{
miOpqStipDrawable(pDstDrawable, pGC, prgnSrc, ptile, 0,
@@ -630,10 +649,10 @@ miGetImage(pDraw, sx, sy, w, h, format, planeMask, pDst)
{
unsigned char depth;
int i, linelength, width, srcx, srcy;
- DDXPointRec pt;
+ DDXPointRec pt = {0, 0};
XID gcv[2];
PixmapPtr pPixmap = (PixmapPtr)NULL;
- GCPtr pGC;
+ GCPtr pGC = NULL;
depth = pDraw->depth;
if(format == ZPixmap)
@@ -697,11 +716,10 @@ miGetImage(pDraw, sx, sy, w, h, format, planeMask, pDst)
else
{
(void) miGetPlane(pDraw, ffs(planeMask) - 1, sx, sy, w, h,
- (unsigned long *)pDst);
+ (MiBits *)pDst);
}
}
-
/* MIPUTIMAGE -- public entry for the PutImage request
* Here we benefit from knowing the format of the bits pointed to by pImage,
* even if we don't know how pDraw represents them.
@@ -752,7 +770,7 @@ miPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage)
box.y2 = h;
prgnSrc = REGION_CREATE(pGC->pScreen, &box, 1);
- miOpqStipDrawable(pDraw, pGC, prgnSrc, (unsigned long *) pImage,
+ miOpqStipDrawable(pDraw, pGC, prgnSrc, (MiBits *) pImage,
leftPad, w, h, x, y);
REGION_DESTROY(pGC->pScreen, prgnSrc);
break;
@@ -782,6 +800,7 @@ miPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage)
gcv[1] = (XID)oldFg;
gcv[2] = (XID)oldBg;
DoChangeGC(pGC, GCPlaneMask | GCForeground | GCBackground, gcv, 0);
+ ValidateGC(pDraw, pGC);
break;
case ZPixmap:
diff --git a/mi/mibstore.c b/mi/mibstore.c
index f8a4cc891..f98aaebbf 100644
--- a/mi/mibstore.c
+++ b/mi/mibstore.c
@@ -42,6 +42,8 @@ implied warranty.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/mi/mibstore.c,v 1.10 2001/12/14 20:00:20 dawes Exp $ */
+
#define NEED_EVENTS
#include "X.h"
#include "Xmd.h"
@@ -50,7 +52,6 @@ implied warranty.
#include "regionstr.h"
#include "scrnintstr.h"
#include "gcstruct.h"
-#include "extnsionst.h"
#include "windowstr.h"
#include "pixmapstr.h"
#include "fontstruct.h"
@@ -136,12 +137,12 @@ implied warranty.
(pGC)->funcs = oldFuncs; \
}
-static void miCreateBSPixmap();
-static void miDestroyBSPixmap();
-static void miTileVirtualBS();
-static void miBSAllocate(), miBSFree();
-static Bool miBSCreateGCPrivate ();
-static void miBSClearBackingRegion ();
+static void miCreateBSPixmap(WindowPtr pWin, BoxPtr pExtents);
+static void miDestroyBSPixmap(WindowPtr pWin);
+static void miTileVirtualBS(WindowPtr pWin);
+static void miBSAllocate(WindowPtr pWin), miBSFree(WindowPtr pWin);
+static Bool miBSCreateGCPrivate(GCPtr pGC);
+static void miBSClearBackingRegion(WindowPtr pWin, RegionPtr pRgn);
#define MoreCopy0 ;
#define MoreCopy2 *dstCopy++ = *srcCopy++; *dstCopy++ = *srcCopy++;
@@ -181,22 +182,36 @@ else \
static int miBSScreenIndex;
static unsigned long miBSGeneration = 0;
-static Bool miBSCloseScreen();
-static void miBSGetImage();
-static void miBSGetSpans();
-static Bool miBSChangeWindowAttributes();
-static Bool miBSCreateGC();
-static Bool miBSDestroyWindow();
+static Bool miBSCloseScreen(int i, ScreenPtr pScreen);
+static void miBSGetImage(DrawablePtr pDrawable, int sx, int sy,
+ int w, int h, unsigned int format,
+ unsigned long planemask, char *pdstLine);
+static void miBSGetSpans(DrawablePtr pDrawable, int wMax,
+ DDXPointPtr ppt, int *pwidth, int nspans,
+ char *pdstStart);
+static Bool miBSChangeWindowAttributes(WindowPtr pWin,
+ unsigned long mask);
+static Bool miBSCreateGC(GCPtr pGC);
+static Bool miBSDestroyWindow(WindowPtr pWin);
/*
* backing store screen functions
*/
-static void miBSSaveDoomedAreas();
-static RegionPtr miBSRestoreAreas();
-static void miBSExposeCopy();
-static RegionPtr miBSTranslateBackingStore(), miBSClearBackingStore();
-static void miBSDrawGuarantee();
+static void miBSSaveDoomedAreas(WindowPtr pWin, RegionPtr pObscured,
+ int dx, int dy);
+static RegionPtr miBSRestoreAreas(WindowPtr pWin, RegionPtr prgnExposed);
+static void miBSExposeCopy(WindowPtr pSrc, DrawablePtr pDst,
+ GCPtr pGC, RegionPtr prgnExposed,
+ int srcx, int srcy, int dstx, int dsty,
+ unsigned long plane);
+static RegionPtr miBSTranslateBackingStore(WindowPtr pWin, int windx,
+ int windy, RegionPtr oldClip,
+ int oldx, int oldy);
+static RegionPtr miBSClearBackingStore(WindowPtr pWin, int x, int y,
+ int w, int h, Bool generateExposures);
+static void miBSDrawGuarantee(WindowPtr pWin, GCPtr pGC,
+ int guarantee);
/*
* wrapper vectors for GC funcs and ops
@@ -204,9 +219,14 @@ static void miBSDrawGuarantee();
static int miBSGCIndex;
-static void miBSValidateGC (), miBSCopyGC (), miBSDestroyGC();
-static void miBSChangeGC();
-static void miBSChangeClip(), miBSDestroyClip(), miBSCopyClip();
+static void miBSValidateGC(GCPtr pGC, unsigned long stateChanges,
+ DrawablePtr pDrawable);
+static void miBSCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
+static void miBSDestroyGC(GCPtr pGC);
+static void miBSChangeGC(GCPtr pGC, unsigned long mask);
+static void miBSChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
+static void miBSDestroyClip(GCPtr pGC);
+static void miBSCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
static GCFuncs miBSGCFuncs = {
miBSValidateGC,
@@ -218,17 +238,59 @@ static GCFuncs miBSGCFuncs = {
miBSCopyClip,
};
-static void miBSFillSpans(), miBSSetSpans(), miBSPutImage();
-static RegionPtr miBSCopyArea(), miBSCopyPlane();
-static void miBSPolyPoint(), miBSPolylines(), miBSPolySegment();
-static void miBSPolyRectangle(),miBSPolyArc(), miBSFillPolygon();
-static void miBSPolyFillRect(), miBSPolyFillArc();
-static int miBSPolyText8(), miBSPolyText16();
-static void miBSImageText8(), miBSImageText16();
-static void miBSImageGlyphBlt(),miBSPolyGlyphBlt();
-static void miBSPushPixels();
+static void miBSFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit,
+ DDXPointPtr pptInit, int *pwidthInit,
+ int fSorted);
+static void miBSSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *psrc,
+ DDXPointPtr ppt, int *pwidth, int nspans,
+ int fSorted);
+static void miBSPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
+ int x, int y, int w, int h, int leftPad,
+ int format, char *pBits);
+static RegionPtr miBSCopyArea(DrawablePtr pSrc, DrawablePtr pDst,
+ GCPtr pGC, int srcx, int srcy, int w, int h,
+ int dstx, int dsty);
+static RegionPtr miBSCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
+ GCPtr pGC, int srcx, int srcy, int w, int h,
+ int dstx, int dsty, unsigned long plane);
+static void miBSPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, xPoint *pptInit);
+static void miBSPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pptInit);
+static void miBSPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg,
+ xSegment *pSegs);
+static void miBSPolyRectangle(DrawablePtr pDrawable, GCPtr pGC,
+ int nrects, xRectangle *pRects);
+static void miBSPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs,
+ xArc *parcs);
+static void miBSFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
+ int shape, int mode, int count,
+ DDXPointPtr pPts);
+static void miBSPolyFillRect(DrawablePtr pDrawable, GCPtr pGC,
+ int nrectFill, xRectangle *prectInit);
+static void miBSPolyFillArc(DrawablePtr pDrawable, GCPtr pGC,
+ int narcs, xArc *parcs);
+static int miBSPolyText8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars);
+static int miBSPolyText16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count,
+ unsigned short *chars);
+static void miBSImageText8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars);
+static void miBSImageText16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count,
+ unsigned short *chars);
+static void miBSImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase);
+static void miBSPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase);
+static void miBSPushPixels(GCPtr pGC, PixmapPtr pBitMap,
+ DrawablePtr pDst, int w, int h,
+ int x, int y);
#ifdef NEED_LINEHELPER
-static void miBSLineHelper();
+static void miBSLineHelper(void);
#endif
static GCOps miBSGCOps = {
@@ -259,10 +321,15 @@ static GCOps miBSGCOps = {
* store enabled
*/
-static void miBSCheapValidateGC(), miBSCheapCopyGC(), miBSCheapDestroyGC();
-static void miBSCheapChangeGC ();
-static void miBSCheapChangeClip(), miBSCheapDestroyClip();
-static void miBSCheapCopyClip();
+static void miBSCheapValidateGC(GCPtr pGC, unsigned long stateChanges,
+ DrawablePtr pDrawable);
+static void miBSCheapCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
+static void miBSCheapDestroyGC(GCPtr pGC);
+static void miBSCheapChangeGC(GCPtr pGC, unsigned long mask);
+static void miBSCheapChangeClip(GCPtr pGC, int type, pointer pvalue,
+ int nrects);
+static void miBSCheapDestroyClip(GCPtr pGC);
+static void miBSCheapCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
static GCFuncs miBSCheapGCFuncs = {
miBSCheapValidateGC,
@@ -282,13 +349,13 @@ static GCFuncs miBSCheapGCFuncs = {
/*
* called from device screen initialization proc. Gets a GCPrivateIndex
- * and wraps appropriate per-screen functions
+ * and wraps appropriate per-screen functions. pScreen->BackingStoreFuncs
+ * must be previously initialized.
*/
void
-miInitializeBackingStore (pScreen, funcs)
+miInitializeBackingStore (pScreen)
ScreenPtr pScreen;
- miBSFuncPtr funcs;
{
miBSScreenPtr pScreenPriv;
@@ -312,7 +379,6 @@ miInitializeBackingStore (pScreen, funcs)
pScreenPriv->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
pScreenPriv->CreateGC = pScreen->CreateGC;
pScreenPriv->DestroyWindow = pScreen->DestroyWindow;
- pScreenPriv->funcs = funcs;
pScreen->CloseScreen = miBSCloseScreen;
pScreen->GetImage = miBSGetImage;
@@ -368,7 +434,9 @@ miBSCloseScreen (i, pScreen)
return (*pScreen->CloseScreen) (i, pScreen);
}
-static void miBSFillVirtualBits();
+static void miBSFillVirtualBits(DrawablePtr pDrawable, GCPtr pGC,
+ RegionPtr pRgn, int x, int y, int state,
+ PixUnion pixunion, unsigned long planemask);
static void
miBSGetImage (pDrawable, sx, sy, w, h, format, planemask, pdstLine)
@@ -389,7 +457,7 @@ miBSGetImage (pDrawable, sx, sy, w, h, format, planemask, pdstLine)
{
PixmapPtr pPixmap;
miBSWindowPtr pWindowPriv;
- GCPtr pGC;
+ GCPtr pGC = NULL;
WindowPtr pWin, pSrcWin;
int xoff, yoff;
RegionRec Remaining;
@@ -847,8 +915,7 @@ miBSCreateGCPrivate (pGC)
}
static void
-miBSDestroyGCPrivate (pGC)
- GCPtr pGC;
+miBSDestroyGCPrivate (GCPtr pGC)
{
miBSGCRec *pPriv;
@@ -1030,6 +1097,11 @@ miBSPutImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format, pBits)
EPILOGUE (pGC);
}
+typedef RegionPtr (* CopyAreaProcPtr)(DrawablePtr, DrawablePtr, GCPtr,
+ int, int, int, int, int, int);
+typedef RegionPtr (* CopyPlaneProcPtr)(DrawablePtr, DrawablePtr, GCPtr,
+ int, int, int, int, int, int,
+ unsigned long bitPlane);
/*-
*-----------------------------------------------------------------------
* miBSDoCopy --
@@ -1058,18 +1130,18 @@ miBSPutImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format, pBits)
*-----------------------------------------------------------------------
*/
static Bool
-miBSDoCopy(pWin, pGC, srcx, srcy, w, h, dstx, dsty, plane, copyProc, ppRgn)
- WindowPtr pWin; /* Window being scrolled */
- GCPtr pGC; /* GC we're called through */
- int srcx; /* X of source rectangle */
- int srcy; /* Y of source rectangle */
- int w; /* Width of source rectangle */
- int h; /* Height of source rectangle */
- int dstx; /* X of destination rectangle */
- int dsty; /* Y of destination rectangle */
- unsigned long plane; /* Plane to copy (0 for CopyArea) */
- RegionPtr (*copyProc)(); /* Procedure to call to perform the copy */
- RegionPtr *ppRgn; /* resultant Graphics Expose region */
+miBSDoCopy(
+ WindowPtr pWin, /* Window being scrolled */
+ GCPtr pGC, /* GC we're called through */
+ int srcx, /* X of source rectangle */
+ int srcy, /* Y of source rectangle */
+ int w, /* Width of source rectangle */
+ int h, /* Height of source rectangle */
+ int dstx, /* X of destination rectangle */
+ int dsty, /* Y of destination rectangle */
+ unsigned long plane, /* Plane to copy (0 for CopyArea) */
+ CopyPlaneProcPtr copyProc, /* Procedure to call to perform the copy */
+ RegionPtr *ppRgn) /* resultant Graphics Expose region */
{
RegionPtr pRgnExp; /* Exposed region */
RegionPtr pRgnObs; /* Obscured region */
@@ -1086,11 +1158,12 @@ miBSDoCopy(pWin, pGC, srcx, srcy, w, h, dstx, dsty, plane, copyProc, ppRgn)
register BoxPtr pBox;
int dx, dy, nrects;
Bool graphicsExposures;
- RegionPtr (*pixCopyProc)();
+ CopyPlaneProcPtr pixCopyProc;
int numRectsExp, numRectsObs;
BoxPtr pBoxExp, pBoxObs;
SETUP_BACKING (pWin, pGC);
+ (void)oldFuncs;
/*
* Create a region of exposed boxes in pRgnExp.
@@ -1310,7 +1383,7 @@ miBSDoCopy(pWin, pGC, srcx, srcy, w, h, dstx, dsty, plane, copyProc, ppRgn)
}
else
{
- pixCopyProc = pBackingGC->ops->CopyArea;
+ pixCopyProc = (CopyPlaneProcPtr)pBackingGC->ops->CopyArea;
}
for (i = 0; i < nrects; i++)
@@ -1325,7 +1398,7 @@ miBSDoCopy(pWin, pGC, srcx, srcy, w, h, dstx, dsty, plane, copyProc, ppRgn)
*/
if (boxes[sequence[i]].source == pix)
{
- (void) (* copyProc) (pBackingDrawable, pWin, pGC,
+ (void) (* copyProc) (pBackingDrawable, &(pWin->drawable), pGC,
pBox->x1 - pBackingStore->x,
pBox->y1 - pBackingStore->y,
pBox->x2 - pBox->x1, pBox->y2 - pBox->y1,
@@ -1339,12 +1412,12 @@ miBSDoCopy(pWin, pGC, srcx, srcy, w, h, dstx, dsty, plane, copyProc, ppRgn)
}
else
{
- (void) (* pixCopyProc) (pWin, pBackingDrawable, pBackingGC,
+ (void) (* pixCopyProc) (&(pWin->drawable), pBackingDrawable, pBackingGC,
pBox->x1, pBox->y1,
pBox->x2 - pBox->x1, pBox->y2 - pBox->y1,
pBox->x1 + dx - pBackingStore->x,
pBox->y1 + dy - pBackingStore->y, plane);
- (void) (* copyProc) (pWin, pWin, pGC,
+ (void) (* copyProc) (&(pWin->drawable), &(pWin->drawable), pGC,
pBox->x1, pBox->y1,
pBox->x2 - pBox->x1, pBox->y2 - pBox->y1,
pBox->x1 + dx, pBox->y1 + dy, plane);
@@ -1431,7 +1504,8 @@ miBSCopyArea (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty)
if ((pSrc != pDst) ||
(!miBSDoCopy((WindowPtr)pSrc, pGC, srcx, srcy, w, h, dstx, dsty,
- (unsigned long) 0, pGC->ops->CopyArea, &winExposed)))
+ (unsigned long) 0, (CopyPlaneProcPtr)pGC->ops->CopyArea,
+ &winExposed)))
{
/*
* always copy to the backing store first, miBSDoCopy
@@ -2305,8 +2379,8 @@ miBSClearBackingStore(pWin, x, y, w, h, generateExposures)
gcvalues[1] = (pointer) background.pixmap;
gcmask = GCFillStyle|GCTile;
}
- gcvalues[2] = (pointer)(ts_x_origin - pBackingStore->x);
- gcvalues[3] = (pointer)(ts_y_origin - pBackingStore->y);
+ gcvalues[2] = (pointer)(long)(ts_x_origin - pBackingStore->x);
+ gcvalues[3] = (pointer)(long)(ts_y_origin - pBackingStore->y);
gcmask |= GCTileStipXOrigin|GCTileStipYOrigin;
DoChangeGC(pGC, gcmask, (XID *)gcvalues, TRUE);
ValidateGC((DrawablePtr)pBackingStore->pBackingPixmap, pGC);
@@ -2449,12 +2523,12 @@ miBSFillVirtualBits (pDrawable, pGC, pRgn, x, y, state, pixunion, planeMask)
}
if (pGC->patOrg.x != x)
{
- gcval[i++] = (pointer)x;
+ gcval[i++] = (pointer)(long)x;
gcmask |= GCTileStipXOrigin;
}
if (pGC->patOrg.y != y)
{
- gcval[i++] = (pointer)y;
+ gcval[i++] = (pointer)(long)y;
gcmask |= GCTileStipYOrigin;
}
}
@@ -2596,7 +2670,9 @@ miBSFree(pWin)
WindowPtr pWin;
{
miBSWindowPtr pBackingStore;
- register ScreenPtr pScreen = pWin->drawable.pScreen;
+ register ScreenPtr pScreen;
+
+ pScreen = pWin->drawable.pScreen;
pBackingStore = (miBSWindowPtr)pWin->backStorage;
if (pBackingStore)
@@ -2626,10 +2702,11 @@ miBSFree(pWin)
*-----------------------------------------------------------------------
*/
static void
-miResizeBackingStore(pWin, dx, dy, saveBits)
- WindowPtr pWin;
- int dx, dy; /* bits are moving this far */
- Bool saveBits; /* bits are useful */
+miResizeBackingStore(
+ WindowPtr pWin,
+ int dx, /* bits are moving this far */
+ int dy, /* bits are moving this far */
+ Bool saveBits) /* bits are useful */
{
miBSWindowPtr pBackingStore;
PixmapPtr pBackingPixmap;
@@ -2655,7 +2732,7 @@ miResizeBackingStore(pWin, dx, dy, saveBits)
if (nw != pBackingPixmap->drawable.width ||
nh != pBackingPixmap->drawable.height)
{
- if (!saveBits)
+ if (!saveBits || !nw || !nh)
{
pNewPixmap = NullPixmap;
pBackingStore->status = StatusNoPixmap;
@@ -2786,9 +2863,6 @@ miBSSaveDoomedAreas(pWin, pObscured, dx, dy)
*/
if (pBackingStore->status != StatusVirtual)
{
- miBSScreenPtr pScreenPriv;
-
- pScreenPriv = (miBSScreenPtr) pScreen->devPrivates[miBSScreenIndex].ptr;
if (!pBackingStore->pBackingPixmap)
miCreateBSPixmap (pWin, &oldExtents);
else
@@ -2803,12 +2877,22 @@ miBSSaveDoomedAreas(pWin, pObscured, dx, dy)
x += pBackingStore->x;
y += pBackingStore->y;
}
- (* pScreenPriv->funcs->SaveAreas) (pBackingStore->pBackingPixmap,
- pObscured, x - dx, y - dy, pWin);
+ (* pScreen->BackingStoreFuncs.SaveAreas)
+ (pBackingStore->pBackingPixmap, pObscured,
+ x - dx, y - dy, pWin);
}
}
REGION_TRANSLATE(pScreen, pObscured, x, y);
}
+ else
+ {
+ if (REGION_BROKEN (pScreen, pObscured))
+ {
+ REGION_EMPTY( pScreen, &pBackingStore->SavedRegion);
+ miDestroyBSPixmap (pWin);
+ return;
+ }
+ }
}
/*-
@@ -2870,21 +2954,17 @@ miBSRestoreAreas(pWin, prgnExposed)
if (REGION_NOTEMPTY( pScreen, prgnRestored))
{
- miBSScreenPtr pScreenPriv;
-
REGION_SUBTRACT( pScreen, prgnSaved, prgnSaved, prgnExposed);
REGION_SUBTRACT( pScreen, prgnExposed, prgnExposed, prgnRestored);
/*
* Do the actual restoration
*/
-
- pScreenPriv = (miBSScreenPtr)
- pScreen->devPrivates[miBSScreenIndex].ptr;
- (* pScreenPriv->funcs->RestoreAreas) (pBackingPixmap,
+ (* pScreen->BackingStoreFuncs.RestoreAreas) (pBackingPixmap,
prgnRestored,
pWin->drawable.x + pBackingStore->x,
- pWin->drawable.y + pBackingStore->y, pWin);
+ pWin->drawable.y + pBackingStore->y,
+ pWin);
/*
* if the saved region is completely empty, dispose of the
* backing pixmap, otherwise, retranslate the saved
@@ -3280,7 +3360,7 @@ miBSValidateGC (pGC, stateChanges, pDrawable)
DrawablePtr pDrawable;
{
GCPtr pBackingGC;
- miBSWindowPtr pWindowPriv;
+ miBSWindowPtr pWindowPriv = NULL;
miBSGCPtr pPriv;
WindowPtr pWin;
int lift_functions;
@@ -3456,17 +3536,13 @@ miBSValidateGC (pGC, stateChanges, pDrawable)
if (pGC->clientClipType == CT_PIXMAP)
{
- miBSScreenPtr pScreenPriv;
-
(*pBackingGC->funcs->CopyClip)(pBackingGC, pGC);
REGION_TRANSLATE(pGC->pScreen, backingCompositeClip,
-pGC->clipOrg.x, -pGC->clipOrg.y);
vals[0] = pGC->clipOrg.x - pWindowPriv->x;
vals[1] = pGC->clipOrg.y - pWindowPriv->y;
DoChangeGC(pBackingGC, GCClipXOrigin|GCClipYOrigin, vals, 0);
- pScreenPriv = (miBSScreenPtr)
- pGC->pScreen->devPrivates[miBSScreenIndex].ptr;
- (* pScreenPriv->funcs->SetClipmaskRgn)
+ (* pGC->pScreen->BackingStoreFuncs.SetClipmaskRgn)
(pBackingGC, backingCompositeClip);
REGION_DESTROY( pGC->pScreen, backingCompositeClip);
}
@@ -3641,7 +3717,7 @@ miCreateBSPixmap (pWin, pExtents)
miBSWindowPtr pBackingStore;
ScreenPtr pScreen;
PixUnion background;
- char backgroundState;
+ char backgroundState = 0;
BoxPtr extents;
Bool backSet;
@@ -3654,7 +3730,9 @@ miCreateBSPixmap (pWin, pExtents)
extents = REGION_EXTENTS( pScreen, &pBackingStore->SavedRegion);
- if (!pBackingStore->pBackingPixmap)
+ if (!pBackingStore->pBackingPixmap &&
+ extents->x2 != extents->x1 &&
+ extents->y2 != extents->y1)
{
/* the policy here could be more sophisticated */
pBackingStore->x = extents->x1;
@@ -3757,7 +3835,7 @@ miBSExposeCopy (pSrc, pDst, pGC, prgnExposed, srcx, srcy, dstx, dsty, plane)
{
RegionRec tempRgn;
miBSWindowPtr pBackingStore;
- RegionPtr (*copyProc)();
+ CopyPlaneProcPtr copyProc;
GCPtr pScratchGC;
register BoxPtr pBox;
register int i;
@@ -3780,7 +3858,7 @@ miBSExposeCopy (pSrc, pDst, pGC, prgnExposed, srcx, srcy, dstx, dsty, plane)
if (plane != 0) {
copyProc = pGC->ops->CopyPlane;
} else {
- copyProc = pGC->ops->CopyArea;
+ copyProc = (CopyPlaneProcPtr)pGC->ops->CopyArea;
}
dx = dstx - srcx;
@@ -3811,7 +3889,7 @@ miBSExposeCopy (pSrc, pDst, pGC, prgnExposed, srcx, srcy, dstx, dsty, plane)
--i >= 0;
pBox++)
{
- (* copyProc) (pBackingStore->pBackingPixmap, pDst, pGC,
+ (* copyProc) (&(pBackingStore->pBackingPixmap->drawable), pDst, pGC,
pBox->x1 - pBackingStore->x,
pBox->y1 - pBackingStore->y,
pBox->x2 - pBox->x1, pBox->y2 - pBox->y1,
diff --git a/mi/mibstore.h b/mi/mibstore.h
index fe6c759e0..e8f197dbc 100644
--- a/mi/mibstore.h
+++ b/mi/mibstore.h
@@ -15,48 +15,16 @@
* "$Xorg: mibstore.h,v 1.3 2000/08/17 19:53:37 cpqbld Exp $
*/
+
+/* $XFree86: xc/programs/Xserver/mi/mibstore.h,v 1.5 2001/08/06 20:51:18 dawes Exp $ */
+
#ifndef _MIBSTORE_H
#define _MIBSTORE_H
-typedef struct _miBSFuncRec {
- void (*SaveAreas)(
-#if NeedNestedPrototypes
- PixmapPtr /*pBackingPixmap*/,
- RegionPtr /*pObscured*/,
- int /*x*/,
- int /*y*/,
- WindowPtr /*pWin*/
-#endif
-);
- void (*RestoreAreas)(
-#if NeedNestedPrototypes
- PixmapPtr /*pBackingPixmap*/,
- RegionPtr /*pExposed*/,
- int /*x*/,
- int /*y*/,
- WindowPtr /*pWin*/
-#endif
-);
- void (*SetClipmaskRgn)(
-#if NeedNestedPrototypes
- GCPtr /*pBackingGC*/,
- RegionPtr /*pbackingCompositeClip*/
-#endif
-);
- PixmapPtr (*GetImagePixmap)(); /* unused */
- PixmapPtr (*GetSpansPixmap)(); /* unused */
-} miBSFuncRec;
-
-#ifndef _XTYPEDEF_MIBSFUNCPTR
-typedef struct _miBSFuncRec *miBSFuncPtr;
-#define _XTYPEDEF_MIBSFUNCPTR
-#endif
+#include "screenint.h"
extern void miInitializeBackingStore(
-#if NeedFunctionPrototypes
- ScreenPtr /*pScreen*/,
- miBSFuncPtr /*funcs*/
-#endif
+ ScreenPtr /*pScreen*/
);
#endif /* _MIBSTORE_H */
diff --git a/mi/mibstorest.h b/mi/mibstorest.h
index d56ee76f6..249b4d4d3 100644
--- a/mi/mibstorest.h
+++ b/mi/mibstorest.h
@@ -31,6 +31,8 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/mibstorest.h,v 1.5 2001/12/14 20:00:21 dawes Exp $ */
+
#include "mibstore.h"
#include "regionstr.h"
@@ -84,8 +86,4 @@ typedef struct {
ChangeWindowAttributesProcPtr ChangeWindowAttributes;
CreateGCProcPtr CreateGC;
DestroyWindowProcPtr DestroyWindow;
- /*
- * pointer to vector of device-specific backing store functions
- */
- miBSFuncPtr funcs;
} miBSScreenRec, *miBSScreenPtr;
diff --git a/mi/miclipn.c b/mi/miclipn.c
index 6eca416f8..95272c176 100644
--- a/mi/miclipn.c
+++ b/mi/miclipn.c
@@ -26,18 +26,21 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/miclipn.c,v 1.4 2001/12/14 20:00:21 dawes Exp $ */
#include "X.h"
#include "windowstr.h"
#include "scrnintstr.h"
+#include "mi.h"
-static void (*clipNotify)() = 0;
-static void (*ClipNotifies[MAXSCREENS])();
+static void (*clipNotify)(WindowPtr,int,int) = 0;
+static void (*ClipNotifies[MAXSCREENS])(WindowPtr,int,int);
static void
-miClipNotifyWrapper(pWin, dx, dy)
- WindowPtr pWin;
- int dx, dy;
+miClipNotifyWrapper(
+ WindowPtr pWin,
+ int dx,
+ int dy )
{
if (clipNotify)
(*clipNotify)(pWin, dx, dy);
@@ -55,8 +58,12 @@ miClipNotifyWrapper(pWin, dx, dy)
static unsigned long clipGeneration = 0;
void
-miClipNotify (func)
- void (*func)();
+miClipNotify (
+ void (*func)(
+ WindowPtr /* pWin */,
+ int /* dx */,
+ int /* dy */
+ ) )
{
int i;
diff --git a/mi/micursor.c b/mi/micursor.c
index b23bcddf6..4c95d2f49 100644
--- a/mi/micursor.c
+++ b/mi/micursor.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/micursor.c,v 1.3 2001/12/14 20:00:21 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -48,6 +49,7 @@ SOFTWARE.
#include "scrnintstr.h"
#include "cursor.h"
#include "misc.h"
+#include "mi.h"
extern Bool Must_have_memory;
diff --git a/mi/midash.c b/mi/midash.c
index cc7e31b28..c3dd24355 100644
--- a/mi/midash.c
+++ b/mi/midash.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/midash.c,v 1.4 2001/12/14 20:00:21 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -49,7 +50,7 @@ SOFTWARE.
#include "mistruct.h"
#include "mifpoly.h"
-static miDashPtr CheckDashStorage();
+static miDashPtr CheckDashStorage(miDashPtr *ppseg, int nseg, int *pnsegMax);
/* return a list of DashRec. there will be an extra
entry at the end holding the last point of the polyline.
@@ -250,10 +251,10 @@ necessary. this interface seems unnecessarily cumbersome.
static
miDashPtr
-CheckDashStorage(ppseg, nseg, pnsegMax)
-miDashPtr *ppseg; /* base pointer */
-int nseg; /* number of segment we want to write to */
-int *pnsegMax; /* size (in segments) of list so far */
+CheckDashStorage(
+ miDashPtr *ppseg, /* base pointer */
+ int nseg, /* number of segment we want to write to */
+ int *pnsegMax) /* size (in segments) of list so far */
{
if (nseg > *pnsegMax)
{
diff --git a/mi/midispcur.c b/mi/midispcur.c
index 4c33d8e1d..3917a7928 100644
--- a/mi/midispcur.c
+++ b/mi/midispcur.c
@@ -30,6 +30,7 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/midispcur.c,v 1.9 2002/12/09 04:10:57 tsi Exp $ */
#define NEED_EVENTS
# include "X.h"
@@ -44,15 +45,16 @@ in this Software without prior written authorization from The Open Group.
# include "mipointer.h"
# include "misprite.h"
# include "gcstruct.h"
-
-extern WindowPtr *WindowTable;
+#ifdef ARGB_CURSOR
+# include "picturestr.h"
+#endif
/* per-screen private data */
static int miDCScreenIndex;
static unsigned long miDCGeneration = 0;
-static Bool miDCCloseScreen();
+static Bool miDCCloseScreen(int index, ScreenPtr pScreen);
typedef struct {
GCPtr pSourceGC, pMaskGC;
@@ -61,22 +63,39 @@ typedef struct {
GCPtr pPixSourceGC, pPixMaskGC;
CloseScreenProcPtr CloseScreen;
PixmapPtr pSave, pTemp;
+#ifdef ARGB_CURSOR
+ PicturePtr pRootPicture;
+ PicturePtr pTempPicture;
+#endif
} miDCScreenRec, *miDCScreenPtr;
/* per-cursor per-screen private data */
typedef struct {
PixmapPtr sourceBits; /* source bits */
PixmapPtr maskBits; /* mask bits */
+#ifdef ARGB_CURSOR
+ PicturePtr pPicture;
+#endif
} miDCCursorRec, *miDCCursorPtr;
/*
* sprite/cursor method table
*/
-static Bool miDCRealizeCursor(), miDCUnrealizeCursor();
-static Bool miDCPutUpCursor(), miDCSaveUnderCursor();
-static Bool miDCRestoreUnderCursor(), miDCMoveCursor();
-static Bool miDCChangeSave();
+static Bool miDCRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
+static Bool miDCUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
+static Bool miDCPutUpCursor(ScreenPtr pScreen, CursorPtr pCursor,
+ int x, int y, unsigned long source,
+ unsigned long mask);
+static Bool miDCSaveUnderCursor(ScreenPtr pScreen, int x, int y,
+ int w, int h);
+static Bool miDCRestoreUnderCursor(ScreenPtr pScreen, int x, int y,
+ int w, int h);
+static Bool miDCMoveCursor(ScreenPtr pScreen, CursorPtr pCursor,
+ int x, int y, int w, int h, int dx, int dy,
+ unsigned long source, unsigned long mask);
+static Bool miDCChangeSave(ScreenPtr pScreen, int x, int y, int w, int h,
+ int dx, int dy);
static miSpriteCursorFuncRec miDCFuncs = {
miDCRealizeCursor,
@@ -117,6 +136,10 @@ miDCInitialize (pScreen, screenFuncs)
pScreenPriv->pMoveGC =
pScreenPriv->pPixSourceGC =
pScreenPriv->pPixMaskGC = NULL;
+#ifdef ARGB_CURSOR
+ pScreenPriv->pRootPicture = NULL;
+ pScreenPriv->pTempPicture = NULL;
+#endif
pScreenPriv->pSave = pScreenPriv->pTemp = NULL;
@@ -135,9 +158,11 @@ miDCInitialize (pScreen, screenFuncs)
#define tossGC(gc) (gc ? FreeGC (gc, (GContext) 0) : 0)
#define tossPix(pix) (pix ? (*pScreen->DestroyPixmap) (pix) : TRUE)
+#define tossPict(pict) (pict ? FreePicture (pict, 0) : 0)
static Bool
miDCCloseScreen (index, pScreen)
+ int index;
ScreenPtr pScreen;
{
miDCScreenPtr pScreenPriv;
@@ -153,6 +178,10 @@ miDCCloseScreen (index, pScreen)
tossGC (pScreenPriv->pPixMaskGC);
tossPix (pScreenPriv->pSave);
tossPix (pScreenPriv->pTemp);
+#ifdef ARGB_CURSOR
+ tossPict (pScreenPriv->pRootPicture);
+ tossPict (pScreenPriv->pTempPicture);
+#endif
xfree ((pointer) pScreenPriv);
return (*pScreen->CloseScreen) (index, pScreen);
}
@@ -167,10 +196,50 @@ miDCRealizeCursor (pScreen, pCursor)
return TRUE;
}
+#ifdef ARGB_CURSOR
+#define EnsurePicture(picture,draw,win) (picture || miDCMakePicture(&picture,draw,win))
+
+static VisualPtr
+miDCGetWindowVisual (WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ VisualID vid = wVisual (pWin);
+ int i;
+
+ for (i = 0; i < pScreen->numVisuals; i++)
+ if (pScreen->visuals[i].vid == vid)
+ return &pScreen->visuals[i];
+ return 0;
+}
+
+static PicturePtr
+miDCMakePicture (PicturePtr *ppPicture, DrawablePtr pDraw, WindowPtr pWin)
+{
+ ScreenPtr pScreen = pDraw->pScreen;
+ VisualPtr pVisual;
+ PictFormatPtr pFormat;
+ XID subwindow_mode = IncludeInferiors;
+ PicturePtr pPicture;
+ int error;
+
+ pVisual = miDCGetWindowVisual (pWin);
+ if (!pVisual)
+ return 0;
+ pFormat = PictureMatchVisual (pScreen, pDraw->depth, pVisual);
+ if (!pFormat)
+ return 0;
+ pPicture = CreatePicture (0, pDraw, pFormat,
+ CPSubwindowMode, &subwindow_mode,
+ serverClient, &error);
+ *ppPicture = pPicture;
+ return pPicture;
+}
+#endif
+
static miDCCursorPtr
-miDCRealize (pScreen, pCursor)
- ScreenPtr pScreen;
- CursorPtr pCursor;
+miDCRealize (
+ ScreenPtr pScreen,
+ CursorPtr pCursor)
{
miDCCursorPtr pPriv;
GCPtr pGC;
@@ -179,6 +248,55 @@ miDCRealize (pScreen, pCursor)
pPriv = (miDCCursorPtr) xalloc (sizeof (miDCCursorRec));
if (!pPriv)
return (miDCCursorPtr)NULL;
+#ifdef ARGB_CURSOR
+ if (pCursor->bits->argb)
+ {
+ PixmapPtr pPixmap;
+ PictFormatPtr pFormat;
+ int error;
+
+ pFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8);
+ if (!pFormat)
+ {
+ xfree ((pointer) pPriv);
+ return (miDCCursorPtr)NULL;
+ }
+
+ pPriv->sourceBits = 0;
+ pPriv->maskBits = 0;
+ pPixmap = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width,
+ pCursor->bits->height, 32);
+ if (!pPixmap)
+ {
+ xfree ((pointer) pPriv);
+ return (miDCCursorPtr)NULL;
+ }
+ pGC = GetScratchGC (32, pScreen);
+ if (!pGC)
+ {
+ (*pScreen->DestroyPixmap) (pPixmap);
+ xfree ((pointer) pPriv);
+ return (miDCCursorPtr)NULL;
+ }
+ ValidateGC (&pPixmap->drawable, pGC);
+ (*pGC->ops->PutImage) (&pPixmap->drawable, pGC, 32,
+ 0, 0, pCursor->bits->width,
+ pCursor->bits->height,
+ 0, ZPixmap, (char *) pCursor->bits->argb);
+ FreeScratchGC (pGC);
+ pPriv->pPicture = CreatePicture (0, &pPixmap->drawable,
+ pFormat, 0, 0, serverClient, &error);
+ (*pScreen->DestroyPixmap) (pPixmap);
+ if (!pPriv->pPicture)
+ {
+ xfree ((pointer) pPriv);
+ return (miDCCursorPtr)NULL;
+ }
+ pCursor->bits->devPriv[pScreen->myNum] = (pointer) pPriv;
+ return pPriv;
+ }
+ pPriv->pPicture = 0;
+#endif
pPriv->sourceBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 1);
if (!pPriv->sourceBits)
{
@@ -241,8 +359,14 @@ miDCUnrealizeCursor (pScreen, pCursor)
pPriv = (miDCCursorPtr) pCursor->bits->devPriv[pScreen->myNum];
if (pPriv && (pCursor->bits->refcnt <= 1))
{
- (*pScreen->DestroyPixmap) (pPriv->sourceBits);
- (*pScreen->DestroyPixmap) (pPriv->maskBits);
+ if (pPriv->sourceBits)
+ (*pScreen->DestroyPixmap) (pPriv->sourceBits);
+ if (pPriv->maskBits)
+ (*pScreen->DestroyPixmap) (pPriv->maskBits);
+#ifdef ARGB_CURSOR
+ if (pPriv->pPicture)
+ FreePicture (pPriv->pPicture, 0);
+#endif
xfree ((pointer) pPriv);
pCursor->bits->devPriv[pScreen->myNum] = (pointer)NULL;
}
@@ -250,13 +374,17 @@ miDCUnrealizeCursor (pScreen, pCursor)
}
static void
-miDCPutBits (pDrawable, pPriv, sourceGC, maskGC, x, y, w, h, source, mask)
- DrawablePtr pDrawable;
- GCPtr sourceGC, maskGC;
- int x, y;
- unsigned w, h;
- miDCCursorPtr pPriv;
- unsigned long source, mask;
+miDCPutBits (
+ DrawablePtr pDrawable,
+ miDCCursorPtr pPriv,
+ GCPtr sourceGC,
+ GCPtr maskGC,
+ int x,
+ int y,
+ unsigned w,
+ unsigned h,
+ unsigned long source,
+ unsigned long mask)
{
XID gcvals[1];
@@ -281,9 +409,9 @@ miDCPutBits (pDrawable, pPriv, sourceGC, maskGC, x, y, w, h, source, mask)
#define EnsureGC(gc,win) (gc || miDCMakeGC(&gc, win))
static GCPtr
-miDCMakeGC(ppGC, pWin)
- GCPtr *ppGC;
- WindowPtr pWin;
+miDCMakeGC(
+ GCPtr *ppGC,
+ WindowPtr pWin)
{
GCPtr pGC;
int status;
@@ -293,12 +421,13 @@ miDCMakeGC(ppGC, pWin)
gcvals[1] = FALSE;
pGC = CreateGC((DrawablePtr)pWin,
GCSubwindowMode|GCGraphicsExposures, gcvals, &status);
- if (pGC)
+ if (pGC && pWin->drawable.pScreen->DrawGuarantee)
(*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeVisBack);
*ppGC = pGC;
return pGC;
}
+
static Bool
miDCPutUpCursor (pScreen, pCursor, x, y, source, mask)
ScreenPtr pScreen;
@@ -319,18 +448,36 @@ miDCPutUpCursor (pScreen, pCursor, x, y, source, mask)
}
pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr;
pWin = WindowTable[pScreen->myNum];
- if (!EnsureGC(pScreenPriv->pSourceGC, pWin))
- return FALSE;
- if (!EnsureGC(pScreenPriv->pMaskGC, pWin))
+#ifdef ARGB_CURSOR
+ if (pPriv->pPicture)
{
- FreeGC (pScreenPriv->pSourceGC, (GContext) 0);
- pScreenPriv->pSourceGC = 0;
- return FALSE;
+ if (!EnsurePicture(pScreenPriv->pRootPicture, &pWin->drawable, pWin))
+ return FALSE;
+ CompositePicture (PictOpOver,
+ pPriv->pPicture,
+ NULL,
+ pScreenPriv->pRootPicture,
+ 0, 0, 0, 0,
+ x, y,
+ pCursor->bits->width,
+ pCursor->bits->height);
+ }
+ else
+#endif
+ {
+ if (!EnsureGC(pScreenPriv->pSourceGC, pWin))
+ return FALSE;
+ if (!EnsureGC(pScreenPriv->pMaskGC, pWin))
+ {
+ FreeGC (pScreenPriv->pSourceGC, (GContext) 0);
+ pScreenPriv->pSourceGC = 0;
+ return FALSE;
+ }
+ miDCPutBits ((DrawablePtr)pWin, pPriv,
+ pScreenPriv->pSourceGC, pScreenPriv->pMaskGC,
+ x, y, pCursor->bits->width, pCursor->bits->height,
+ source, mask);
}
- miDCPutBits ((DrawablePtr)pWin, pPriv,
- pScreenPriv->pSourceGC, pScreenPriv->pMaskGC,
- x, y, pCursor->bits->width, pCursor->bits->height,
- source, mask);
return TRUE;
}
@@ -554,6 +701,13 @@ miDCMoveCursor (pScreen, pCursor, x, y, w, h, dx, dy, source, mask)
{
if (pTemp)
(*pScreen->DestroyPixmap) (pTemp);
+#ifdef ARGB_CURSOR
+ if (pScreenPriv->pTempPicture)
+ {
+ FreePicture (pScreenPriv->pTempPicture, 0);
+ pScreenPriv->pTempPicture = 0;
+ }
+#endif
pScreenPriv->pTemp = pTemp = (*pScreen->CreatePixmap)
(pScreen, w, h, pScreenPriv->pSave->drawable.depth);
if (!pTemp)
@@ -578,24 +732,42 @@ miDCMoveCursor (pScreen, pCursor, x, y, w, h, dx, dy, source, mask)
/*
* draw the cursor in the temporary pixmap
*/
- if (!pScreenPriv->pPixSourceGC)
+#ifdef ARGB_CURSOR
+ if (pPriv->pPicture)
{
- pScreenPriv->pPixSourceGC = CreateGC ((DrawablePtr)pTemp,
- GCGraphicsExposures, &gcval, &status);
- if (!pScreenPriv->pPixSourceGC)
+ if (!EnsurePicture(pScreenPriv->pTempPicture, &pTemp->drawable, pWin))
return FALSE;
+ CompositePicture (PictOpOver,
+ pPriv->pPicture,
+ NULL,
+ pScreenPriv->pTempPicture,
+ 0, 0, 0, 0,
+ dx, dy,
+ pCursor->bits->width,
+ pCursor->bits->height);
}
- if (!pScreenPriv->pPixMaskGC)
+ else
+#endif
{
- pScreenPriv->pPixMaskGC = CreateGC ((DrawablePtr)pTemp,
- GCGraphicsExposures, &gcval, &status);
+ if (!pScreenPriv->pPixSourceGC)
+ {
+ pScreenPriv->pPixSourceGC = CreateGC ((DrawablePtr)pTemp,
+ GCGraphicsExposures, &gcval, &status);
+ if (!pScreenPriv->pPixSourceGC)
+ return FALSE;
+ }
if (!pScreenPriv->pPixMaskGC)
- return FALSE;
+ {
+ pScreenPriv->pPixMaskGC = CreateGC ((DrawablePtr)pTemp,
+ GCGraphicsExposures, &gcval, &status);
+ if (!pScreenPriv->pPixMaskGC)
+ return FALSE;
+ }
+ miDCPutBits ((DrawablePtr)pTemp, pPriv,
+ pScreenPriv->pPixSourceGC, pScreenPriv->pPixMaskGC,
+ dx, dy, pCursor->bits->width, pCursor->bits->height,
+ source, mask);
}
- miDCPutBits ((DrawablePtr)pTemp, pPriv,
- pScreenPriv->pPixSourceGC, pScreenPriv->pPixMaskGC,
- dx, dy, pCursor->bits->width, pCursor->bits->height,
- source, mask);
/*
* copy the temporary pixmap onto the screen
diff --git a/mi/mieq.c b/mi/mieq.c
index 02b35160c..699d4130c 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -25,6 +25,7 @@ in this Software without prior written authorization from The Open Group.
*
* Author: Keith Packard, MIT X Consortium
*/
+/* $XFree86: xc/programs/Xserver/mi/mieq.c,v 1.3 2001/12/14 20:00:22 dawes Exp $ */
/*
* mieq.c
@@ -89,7 +90,7 @@ void
mieqEnqueue (e)
xEvent *e;
{
- HWEventQueueType oldtail, newtail, prevtail;
+ HWEventQueueType oldtail, newtail;
Bool isMotion;
oldtail = miEventQueue.tail;
@@ -139,7 +140,7 @@ mieqSwitchScreen (pScreen, fromDIX)
* Call this from ProcessInputEvents()
*/
-mieqProcessInputEvents ()
+void mieqProcessInputEvents ()
{
EventRec *e;
int x, y;
@@ -147,8 +148,6 @@ mieqProcessInputEvents ()
while (miEventQueue.head != miEventQueue.tail)
{
- extern int screenIsSaved;
-
if (screenIsSaved == SCREEN_SAVER_ON)
SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset);
diff --git a/mi/miexpose.c b/mi/miexpose.c
index cacb2f983..ca896b9e0 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/miexpose.c,v 3.9 2001/12/14 20:00:22 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -64,7 +65,12 @@ SOFTWARE.
#include "mi.h"
#include "Xmd.h"
-extern WindowPtr *WindowTable;
+#include "globals.h"
+
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
/*
machine-independent graphics exposure code. any device that uses
@@ -103,7 +109,7 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
int dstx, dsty;
unsigned long plane;
{
- register ScreenPtr pscr = pGC->pScreen;
+ register ScreenPtr pscr;
RegionPtr prgnSrcClip; /* drawable-relative source clip */
RegionRec rgnSrcRec;
RegionPtr prgnDstClip; /* drawable-relative dest clip */
@@ -120,6 +126,9 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
BoxRec expBox;
Bool extents;
+ /* This prevents warning about pscr not being used. */
+ pGC->pScreen = pscr = pGC->pScreen;
+
/* avoid work if we can */
if (!pGC->graphicsExposures &&
(pDstDrawable->type == DRAWABLE_PIXMAP) &&
@@ -388,6 +397,7 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor)
}
}
+
void
miSendExposures(pWin, pRgn, dx, dy)
WindowPtr pWin;
@@ -414,7 +424,40 @@ miSendExposures(pWin, pRgn, dx, dy)
pe->u.expose.height = pBox->y2 - pBox->y1;
pe->u.expose.count = i;
}
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ int scrnum = pWin->drawable.pScreen->myNum;
+ int x = 0, y = 0;
+ XID realWin = 0;
+
+ if(!pWin->parent) {
+ x = panoramiXdataPtr[scrnum].x;
+ y = panoramiXdataPtr[scrnum].y;
+ pWin = WindowTable[0];
+ realWin = pWin->drawable.id;
+ } else if (scrnum) {
+ PanoramiXRes *win;
+ win = PanoramiXFindIDByScrnum(XRT_WINDOW,
+ pWin->drawable.id, scrnum);
+ if(!win) {
+ DEALLOCATE_LOCAL(pEvent);
+ return;
+ }
+ realWin = win->info[0].id;
+ pWin = LookupIDByType(realWin, RT_WINDOW);
+ }
+ if(x || y || scrnum)
+ for (i = 0; i < numRects; i++) {
+ pEvent[i].u.expose.window = realWin;
+ pEvent[i].u.expose.x += x;
+ pEvent[i].u.expose.y += y;
+ }
+ }
+#endif
+
DeliverEvents(pWin, pEvent, numRects, NullWindow);
+
DEALLOCATE_LOCAL(pEvent);
}
@@ -540,9 +583,9 @@ static GCPtr screenContext[MAXSCREENS];
/*ARGSUSED*/
static int
-tossGC (value, id)
-pointer value;
-XID id;
+tossGC (
+ pointer value,
+ XID id)
{
GCPtr pGC = (GCPtr)value;
screenContext[pGC->pScreen->myNum] = (GCPtr)NULL;
@@ -550,6 +593,8 @@ XID id;
numGCs--;
if (!numGCs)
ResType = 0;
+
+ return 0;
}
@@ -807,6 +852,7 @@ int what;
/* MICLEARDRAWABLE -- sets the entire drawable to the background color of
* the GC. Useful when we have a scratch drawable and need to initialize
* it. */
+void
miClearDrawable(pDraw, pGC)
DrawablePtr pDraw;
GCPtr pGC;
diff --git a/mi/mifillarc.c b/mi/mifillarc.c
index 5889f1c06..a93b9e3a2 100644
--- a/mi/mifillarc.c
+++ b/mi/mifillarc.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mifillarc.c,v 3.7 2001/12/14 20:00:22 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -137,11 +138,12 @@ miFillArcDSetup(arc, info)
}
static void
-miGetArcEdge(arc, edge, k, top, left)
- register xArc *arc;
- register miSliceEdgePtr edge;
- int k;
- Bool top, left;
+miGetArcEdge(
+ register xArc *arc,
+ register miSliceEdgePtr edge,
+ int k,
+ Bool top,
+ Bool left )
{
register int xady, y;
@@ -266,13 +268,14 @@ miEllipseAngleToSlope (angle, width, height, dxp, dyp, d_dxp, d_dyp)
}
static void
-miGetPieEdge(arc, angle, edge, top, left)
- register xArc *arc;
- register int angle;
- register miSliceEdgePtr edge;
- Bool top, left;
+miGetPieEdge(
+ register xArc *arc,
+ register int angle,
+ register miSliceEdgePtr edge,
+ Bool top,
+ Bool left )
{
- register int k, signdx, signdy;
+ register int k;
int dx, dy;
miEllipseAngleToSlope (angle, arc->width, arc->height, &dx, &dy, 0, 0);
@@ -540,10 +543,10 @@ miFillArcSliceSetup(arc, slice, pGC)
}
static void
-miFillEllipseI(pDraw, pGC, arc)
- DrawablePtr pDraw;
- GCPtr pGC;
- xArc *arc;
+miFillEllipseI(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ xArc *arc )
{
register int x, y, e;
int yk, xk, ym, xm, dx, dy, xorg, yorg;
@@ -583,10 +586,10 @@ miFillEllipseI(pDraw, pGC, arc)
}
static void
-miFillEllipseD(pDraw, pGC, arc)
- DrawablePtr pDraw;
- GCPtr pGC;
- xArc *arc;
+miFillEllipseD(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ xArc *arc )
{
register int x, y;
int xorg, yorg, dx, dy, slw;
@@ -648,10 +651,10 @@ miFillEllipseD(pDraw, pGC, arc)
}
static void
-miFillArcSliceI(pDraw, pGC, arc)
- DrawablePtr pDraw;
- GCPtr pGC;
- xArc *arc;
+miFillArcSliceI(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ xArc *arc )
{
int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
register int x, y, e;
@@ -711,10 +714,10 @@ miFillArcSliceI(pDraw, pGC, arc)
}
static void
-miFillArcSliceD(pDraw, pGC, arc)
- DrawablePtr pDraw;
- GCPtr pGC;
- xArc *arc;
+miFillArcSliceD(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ xArc *arc )
{
register int x, y;
int dx, dy, xorg, yorg, slw;
diff --git a/mi/mifillarc.h b/mi/mifillarc.h
index 63071bbd1..ed8503f15 100644
--- a/mi/mifillarc.h
+++ b/mi/mifillarc.h
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mifillarc.h,v 3.7 2001/12/14 20:00:22 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -26,6 +27,9 @@ in this Software without prior written authorization from The Open Group.
/* $Xorg: mifillarc.h,v 1.4 2001/02/09 02:05:20 xorgcvs Exp $ */
+#ifndef __MIFILLARC_H__
+#define __MIFILLARC_H__
+
#define FULLCIRCLE (360 * 64)
typedef struct _miFillArc {
@@ -175,34 +179,25 @@ typedef struct _miArcSlice {
((slw > 1) || (ine != inxk)))
extern int miFreeArcCache(
-#if NeedFunctionPrototypes
pointer /*data*/,
XID /*id*/
-#endif
);
extern struct finalSpan *realAllocSpan(
-#if NeedFunctionPrototypes
void
-#endif
);
extern void miFillArcSetup(
-#if NeedFunctionPrototypes
xArc * /*arc*/,
miFillArcRec * /*info*/
-#endif
);
extern void miFillArcDSetup(
-#if NeedFunctionPrototypes
xArc * /*arc*/,
miFillArcDRec * /*info*/
-#endif
);
extern void miEllipseAngleToSlope(
-#if NeedFunctionPrototypes
int /*angle*/,
int /*width*/,
int /*height*/,
@@ -210,14 +205,12 @@ extern void miEllipseAngleToSlope(
int * /*dyp*/,
double * /*d_dxp*/,
double * /*d_dyp*/
-#endif
);
extern void miFillArcSliceSetup(
-#if NeedFunctionPrototypes
xArc * /*arc*/,
miArcSliceRec * /*slice*/,
GCPtr /*pGC*/
-#endif
);
+#endif /* __MIFILLARC_H__ */
diff --git a/mi/mifillrct.c b/mi/mifillrct.c
index af2f9429b..be2c58dfe 100644
--- a/mi/mifillrct.c
+++ b/mi/mifillrct.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mifillrct.c,v 1.3 2001/12/14 20:00:22 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -51,7 +52,7 @@ SOFTWARE.
#include "gcstruct.h"
#include "windowstr.h"
#include "pixmap.h"
-
+#include "mi.h"
#include "misc.h"
/* mi rectangles
diff --git a/mi/mifpoly.h b/mi/mifpoly.h
index bb923e2b6..837cf7b20 100644
--- a/mi/mifpoly.h
+++ b/mi/mifpoly.h
@@ -45,6 +45,10 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/mi/mifpoly.h,v 1.4 2001/12/14 20:00:22 dawes Exp $ */
+
+#ifndef __MIFPOLY_H__
+#define __MIFPOLY_H__
#define EPSILON 0.000001
#define ISEQUAL(a,b) (Fabs((a) - (b)) <= EPSILON)
@@ -68,8 +72,7 @@ SOFTWARE.
#define ICEIL(x) ((int)ceil(x))
#else
#ifdef __GNUC__
-static __inline int ICEIL(x)
- double x;
+static __inline int ICEIL(double x)
{
int _cTmp = x;
return ((x == _cTmp) || (x < 0.0)) ? _cTmp : _cTmp+1;
@@ -95,7 +98,6 @@ typedef struct _SppArc {
/* mifpolycon.c */
extern void miFillSppPoly(
-#if NeedFunctionPrototypes
DrawablePtr /*dst*/,
GCPtr /*pgc*/,
int /*count*/,
@@ -104,5 +106,6 @@ extern void miFillSppPoly(
int /*yTrans*/,
double /*xFtrans*/,
double /*yFtrans*/
-#endif
);
+
+#endif /* __MIFPOLY_H__ */
diff --git a/mi/mifpolycon.c b/mi/mifpolycon.c
index 0b6655186..93999ea7d 100644
--- a/mi/mifpolycon.c
+++ b/mi/mifpolycon.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mifpolycon.c,v 1.3 2001/12/14 20:00:23 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -52,7 +53,8 @@ SOFTWARE.
#include "pixmapstr.h"
#include "mifpoly.h"
-static int GetFPolyYBounds();
+static int GetFPolyYBounds(register SppPointPtr pts, int n, double yFtrans,
+ int *by, int *ty);
#ifdef ICEILTEMPDECL
ICEILTEMPDECL
@@ -84,9 +86,9 @@ miFillSppPoly(dst, pgc, count, ptsIn, xTrans, yTrans, xFtrans, yFtrans)
meet the polygon exactly.
*/
{
- double xl, xr, /* x vals of left and right edges */
- ml, /* left edge slope */
- mr, /* right edge slope */
+ double xl = 0.0, xr = 0.0, /* x vals of left and right edges */
+ ml = 0.0, /* left edge slope */
+ mr = 0.0, /* right edge slope */
dy, /* delta y */
i; /* loop counter */
int y, /* current scanline */
@@ -161,8 +163,8 @@ miFillSppPoly(dst, pgc, count, ptsIn, xTrans, yTrans, xFtrans, yFtrans)
/* add a right edge if we need to */
if ((y > ptsIn[nextright].y + yFtrans) ||
- ISEQUAL(y, ptsIn[nextright].y + yFtrans)
- && Marked[nextright] != 1)
+ (ISEQUAL(y, ptsIn[nextright].y + yFtrans)
+ && Marked[nextright] != 1))
{
Marked[nextright]++;
right = nextright--;
@@ -246,11 +248,12 @@ miFillSppPoly(dst, pgc, count, ptsIn, xTrans, yTrans, xFtrans, yFtrans)
* smallest and largest y */
static
int
-GetFPolyYBounds(pts, n, yFtrans, by, ty)
- register SppPointPtr pts;
- int n;
- double yFtrans;
- int *by, *ty;
+GetFPolyYBounds(
+ register SppPointPtr pts,
+ int n,
+ double yFtrans,
+ int *by,
+ int *ty)
{
register SppPointPtr ptMin;
double ymin, ymax;
diff --git a/mi/migc.c b/mi/migc.c
index 808347d22..29eec9749 100644
--- a/mi/migc.c
+++ b/mi/migc.c
@@ -27,6 +27,7 @@ from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/migc.c,v 1.9 2001/12/14 20:00:23 dawes Exp $ */
#include "scrnintstr.h"
#include "gcstruct.h"
@@ -34,15 +35,6 @@ from The Open Group.
#include "windowstr.h"
#include "migc.h"
-int miGCPrivateIndex;
-
-void
-miRegisterGCPrivateIndex(gcindex)
- int gcindex;
-{
- miGCPrivateIndex = gcindex;
-}
-
/* ARGSUSED */
void
miChangeGC(pGC, mask)
@@ -56,13 +48,10 @@ void
miDestroyGC(pGC)
GCPtr pGC;
{
- miPrivGC *pPriv;
-
- pPriv = (miPrivGC *) (pGC->devPrivates[miGCPrivateIndex].ptr);
- if (pPriv->pRotatedPixmap)
- (*pGC->pScreen->DestroyPixmap) (pPriv->pRotatedPixmap);
- if (pPriv->freeCompClip)
- REGION_DESTROY(pGC->pScreen, pPriv->pCompositeClip);
+ if (pGC->pRotatedPixmap)
+ (*pGC->pScreen->DestroyPixmap) (pGC->pRotatedPixmap);
+ if (pGC->freeCompClip)
+ REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
miDestroyGCOps(pGC->ops);
}
@@ -75,7 +64,6 @@ miCreateGCOps(prototype)
GCOpsPtr prototype;
{
GCOpsPtr ret;
- extern Bool Must_have_memory;
/* XXX */ Must_have_memory = TRUE;
ret = (GCOpsPtr) xalloc(sizeof(GCOps));
@@ -188,8 +176,10 @@ miComputeCompositeClip(pGC, pDrawable)
GCPtr pGC;
DrawablePtr pDrawable;
{
- ScreenPtr pScreen = pGC->pScreen;
- miPrivGC *devPriv = (miPrivGC *) (pGC->devPrivates[miGCPrivateIndex].ptr);
+ ScreenPtr pScreen;
+
+ /* This prevents warnings about pScreen not being used. */
+ pGC->pScreen = pScreen = pGC->pScreen;
if (pDrawable->type == DRAWABLE_WINDOW)
{
@@ -207,7 +197,7 @@ miComputeCompositeClip(pGC, pDrawable)
pregWin = &pWin->clipList;
freeTmpClip = FALSE;
}
- freeCompClip = devPriv->freeCompClip;
+ freeCompClip = pGC->freeCompClip;
/*
* if there is no client clip, we can get by with just keeping the
@@ -219,9 +209,9 @@ miComputeCompositeClip(pGC, pDrawable)
if (pGC->clientClipType == CT_NONE)
{
if (freeCompClip)
- REGION_DESTROY(pScreen, devPriv->pCompositeClip);
- devPriv->pCompositeClip = pregWin;
- devPriv->freeCompClip = freeTmpClip;
+ REGION_DESTROY(pScreen, pGC->pCompositeClip);
+ pGC->pCompositeClip = pregWin;
+ pGC->freeCompClip = freeTmpClip;
}
else
{
@@ -240,7 +230,7 @@ miComputeCompositeClip(pGC, pDrawable)
if (freeCompClip)
{
- REGION_INTERSECT(pGC->pScreen, devPriv->pCompositeClip,
+ REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
pregWin, pGC->clientClip);
if (freeTmpClip)
REGION_DESTROY(pScreen, pregWin);
@@ -248,15 +238,15 @@ miComputeCompositeClip(pGC, pDrawable)
else if (freeTmpClip)
{
REGION_INTERSECT(pScreen, pregWin, pregWin, pGC->clientClip);
- devPriv->pCompositeClip = pregWin;
+ pGC->pCompositeClip = pregWin;
}
else
{
- devPriv->pCompositeClip = REGION_CREATE(pScreen, NullBox, 0);
- REGION_INTERSECT(pScreen, devPriv->pCompositeClip,
+ pGC->pCompositeClip = REGION_CREATE(pScreen, NullBox, 0);
+ REGION_INTERSECT(pScreen, pGC->pCompositeClip,
pregWin, pGC->clientClip);
}
- devPriv->freeCompClip = TRUE;
+ pGC->freeCompClip = TRUE;
REGION_TRANSLATE(pScreen, pGC->clientClip,
-(pDrawable->x + pGC->clipOrg.x),
-(pDrawable->y + pGC->clipOrg.y));
@@ -267,29 +257,41 @@ miComputeCompositeClip(pGC, pDrawable)
BoxRec pixbounds;
/* XXX should we translate by drawable.x/y here ? */
- pixbounds.x1 = 0;
- pixbounds.y1 = 0;
- pixbounds.x2 = pDrawable->width;
- pixbounds.y2 = pDrawable->height;
+ /* If you want pixmaps in offscreen memory, yes */
+ pixbounds.x1 = pDrawable->x;
+ pixbounds.y1 = pDrawable->y;
+ pixbounds.x2 = pDrawable->x + pDrawable->width;
+ pixbounds.y2 = pDrawable->y + pDrawable->height;
- if (devPriv->freeCompClip)
+ if (pGC->freeCompClip)
{
- REGION_RESET(pScreen, devPriv->pCompositeClip, &pixbounds);
+ REGION_RESET(pScreen, pGC->pCompositeClip, &pixbounds);
}
else
{
- devPriv->freeCompClip = TRUE;
- devPriv->pCompositeClip = REGION_CREATE(pScreen, &pixbounds, 1);
+ pGC->freeCompClip = TRUE;
+ pGC->pCompositeClip = REGION_CREATE(pScreen, &pixbounds, 1);
}
if (pGC->clientClipType == CT_REGION)
{
- REGION_TRANSLATE(pScreen, devPriv->pCompositeClip,
+ if(pDrawable->x || pDrawable->y) {
+ REGION_TRANSLATE(pScreen, pGC->clientClip,
+ pDrawable->x + pGC->clipOrg.x,
+ pDrawable->y + pGC->clipOrg.y);
+ REGION_INTERSECT(pScreen, pGC->pCompositeClip,
+ pGC->pCompositeClip, pGC->clientClip);
+ REGION_TRANSLATE(pScreen, pGC->clientClip,
+ -(pDrawable->x + pGC->clipOrg.x),
+ -(pDrawable->y + pGC->clipOrg.y));
+ } else {
+ REGION_TRANSLATE(pScreen, pGC->pCompositeClip,
-pGC->clipOrg.x, -pGC->clipOrg.y);
- REGION_INTERSECT(pScreen, devPriv->pCompositeClip,
- devPriv->pCompositeClip, pGC->clientClip);
- REGION_TRANSLATE(pScreen, devPriv->pCompositeClip,
+ REGION_INTERSECT(pScreen, pGC->pCompositeClip,
+ pGC->pCompositeClip, pGC->clientClip);
+ REGION_TRANSLATE(pScreen, pGC->pCompositeClip,
pGC->clipOrg.x, pGC->clipOrg.y);
+ }
}
} /* end of composite clip for pixmap */
} /* end miComputeCompositeClip */
diff --git a/mi/migc.h b/mi/migc.h
index 9e9974c3e..8cb5a56c9 100644
--- a/mi/migc.h
+++ b/mi/migc.h
@@ -27,87 +27,48 @@ from The Open Group.
*/
-/* This structure has to line up with the mfb and cfb gc private structures so
- * that when it is superimposed on them, the three fields that migc.c needs to
- * see will be accessed correctly. I know this is not beautiful, but it seemed
- * better than all the code duplication in cfb and mfb.
- */
-typedef struct {
- unsigned char pad1;
- unsigned char pad2;
- unsigned char pad3;
- unsigned pad4:1;
- unsigned freeCompClip:1;
- PixmapPtr pRotatedPixmap;
- RegionPtr pCompositeClip;
-} miPrivGC;
-
-extern int miGCPrivateIndex;
-
-extern void miRegisterGCPrivateIndex(
-#if NeedFunctionPrototypes
- int /*gcindex*/
-#endif
-);
+/* $XFree86: xc/programs/Xserver/mi/migc.h,v 1.8 2001/12/14 20:00:23 dawes Exp $ */
extern void miChangeGC(
-#if NeedFunctionPrototypes
GCPtr /*pGC*/,
unsigned long /*mask*/
-#endif
);
extern void miDestroyGC(
-#if NeedFunctionPrototypes
GCPtr /*pGC*/
-#endif
);
extern GCOpsPtr miCreateGCOps(
-#if NeedFunctionPrototypes
GCOpsPtr /*prototype*/
-#endif
);
extern void miDestroyGCOps(
-#if NeedFunctionPrototypes
GCOpsPtr /*ops*/
-#endif
);
extern void miDestroyClip(
-#if NeedFunctionPrototypes
GCPtr /*pGC*/
-#endif
);
extern void miChangeClip(
-#if NeedFunctionPrototypes
GCPtr /*pGC*/,
int /*type*/,
pointer /*pvalue*/,
int /*nrects*/
-#endif
);
extern void miCopyClip(
-#if NeedFunctionPrototypes
GCPtr /*pgcDst*/,
GCPtr /*pgcSrc*/
-#endif
);
extern void miCopyGC(
-#if NeedFunctionPrototypes
GCPtr /*pGCSrc*/,
unsigned long /*changes*/,
GCPtr /*pGCDst*/
-#endif
);
extern void miComputeCompositeClip(
-#if NeedFunctionPrototypes
GCPtr /*pGC*/,
DrawablePtr /*pDrawable*/
-#endif
);
diff --git a/mi/miglblt.c b/mi/miglblt.c
index 4a7a8eaeb..3e7e5da1b 100644
--- a/mi/miglblt.c
+++ b/mi/miglblt.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/miglblt.c,v 1.6 2001/12/14 20:00:23 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -58,6 +59,7 @@ SOFTWARE.
#include "scrnintstr.h"
#include "pixmap.h"
#include "servermd.h"
+#include "mi.h"
/*
machine-independent glyph blt.
@@ -81,10 +83,10 @@ void
miPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
DrawablePtr pDrawable;
GC *pGC;
- int x, y;
+ int x, y;
unsigned int nglyph;
CharInfoPtr *ppci; /* array of character info */
- unsigned char *pglyphBase; /* start of array of glyphs */
+ pointer pglyphBase; /* start of array of glyphs */
{
int width, height;
PixmapPtr pPixmap;
@@ -194,10 +196,10 @@ void
miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
DrawablePtr pDrawable;
GC *pGC;
- int x, y;
+ int x, y;
unsigned int nglyph;
CharInfoPtr *ppci; /* array of character info */
- unsigned char *pglyphBase; /* start of array of glyphs */
+ pointer pglyphBase; /* start of array of glyphs */
{
ExtentInfoRec info; /* used by QueryGlyphExtents() */
XID gcvals[3];
@@ -237,12 +239,13 @@ miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
DoChangeGC(pGC, GCForeground, gcvals, 0);
ValidateGC(pDrawable, pGC);
(*pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci,
- (char *)pglyphBase);
+ pglyphBase);
/* put all the toys away when done playing */
gcvals[0] = oldAlu;
gcvals[1] = oldFG;
gcvals[2] = oldFS;
DoChangeGC(pGC, GCFunction|GCForeground|GCFillStyle, gcvals, 0);
+ ValidateGC(pDrawable, pGC);
}
diff --git a/mi/miinitext.c b/mi/miinitext.c
index c9ea7444c..ee63aa41b 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/miinitext.c,v 3.68 2003/01/15 02:34:14 torrey Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -47,10 +48,19 @@ SOFTWARE.
/* $Xorg: miinitext.c,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */
#include "misc.h"
+#include "extension.h"
+#include "micmap.h"
#ifdef NOPEXEXT /* sleaze for Solaris cpp building XsunMono */
#undef PEXEXT
#endif
+
+#if defined(QNX4) /* sleaze for Watcom on QNX4 ... */
+#undef PEXEXT
+#undef XIE
+#undef GLXEXT
+#endif
+
#ifdef PANORAMIX
extern Bool noPanoramiXExtension;
#endif
@@ -59,94 +69,176 @@ extern Bool noTestExtensions;
extern Bool noXkbExtension;
#endif
+#ifndef XFree86LOADER
+#define INITARGS void
+typedef void (*InitExtension)(INITARGS);
+#else /* XFree86Loader */
+#include "loaderProcs.h"
+#endif
+
+#ifdef MITSHM
+#define _XSHM_SERVER_
+#include "shmstr.h"
+#endif
+#ifdef XTEST
+#define _XTEST_SERVER_
+#include "XTest.h"
+#endif
+#ifdef XKB
+#include "XKB.h"
+#endif
+#ifdef LBX
+#define _XLBX_SERVER_
+#include "lbxstr.h"
+#endif
+#ifdef XPRINT
+#include "Print.h"
+#endif
+#ifdef XAPPGROUP
+#define _XAG_SERVER_
+#include "Xagstr.h"
+#endif
+#ifdef XCSECURITY
+#define _SECURITY_SERVER
+#include "securstr.h"
+#endif
+#ifdef PANORAMIX
+#include "panoramiXproto.h"
+#endif
+#ifdef XF86BIGFONT
+#include "xf86bigfstr.h"
+#endif
+#ifdef RES
+#include "XResproto.h"
+#endif
+
+/* FIXME: this whole block of externs should be from the appropriate headers */
#ifdef BEZIER
-extern void BezierExtensionInit();
+extern void BezierExtensionInit(INITARGS);
#endif
#ifdef XTESTEXT1
-extern void XTestExtension1Init();
+extern void XTestExtension1Init(INITARGS);
#endif
#ifdef SHAPE
-extern void ShapeExtensionInit();
+extern void ShapeExtensionInit(INITARGS);
#endif
#ifdef EVI
-extern void EVIExtensionInit();
+extern void EVIExtensionInit(INITARGS);
#endif
#ifdef MITSHM
-extern void ShmExtensionInit();
+extern void ShmExtensionInit(INITARGS);
#endif
#ifdef PEXEXT
-extern void PexExtensionInit();
+extern void PexExtensionInit(INITARGS);
#endif
#ifdef MULTIBUFFER
-extern void MultibufferExtensionInit();
+extern void MultibufferExtensionInit(INITARGS);
#endif
#ifdef PANORAMIX
-extern void PanoramiXExtensionInit();
+extern void PanoramiXExtensionInit(INITARGS);
#endif
#ifdef XINPUT
-extern void XInputExtensionInit();
+extern void XInputExtensionInit(INITARGS);
#endif
#ifdef XTEST
-extern void XTestExtensionInit();
+extern void XTestExtensionInit(INITARGS);
#endif
#ifdef BIGREQS
-extern void BigReqExtensionInit();
+extern void BigReqExtensionInit(INITARGS);
#endif
#ifdef MITMISC
-extern void MITMiscExtensionInit();
+extern void MITMiscExtensionInit(INITARGS);
#endif
#ifdef XIDLE
-extern void XIdleExtensionInit();
+extern void XIdleExtensionInit(INITARGS);
#endif
#ifdef XTRAP
-extern void DEC_XTRAPInit();
+extern void DEC_XTRAPInit(INITARGS);
#endif
#ifdef SCREENSAVER
-extern void ScreenSaverExtensionInit ();
+extern void ScreenSaverExtensionInit (INITARGS);
#endif
#ifdef XV
-extern void XvExtensionInit();
+extern void XvExtensionInit(INITARGS);
+extern void XvMCExtensionInit(INITARGS);
#endif
#ifdef XIE
-extern void XieInit();
+extern void XieInit(INITARGS);
#endif
#ifdef XSYNC
-extern void SyncExtensionInit();
+extern void SyncExtensionInit(INITARGS);
#endif
#ifdef XKB
-extern void XkbExtensionInit();
+extern void XkbExtensionInit(INITARGS);
#endif
#ifdef XCMISC
-extern void XCMiscExtensionInit();
+extern void XCMiscExtensionInit(INITARGS);
#endif
#ifdef XRECORD
-extern void XRecordExtensionInit();
+extern void RecordExtensionInit(INITARGS);
#endif
#ifdef LBX
-extern void LbxExtensionInit();
+extern void LbxExtensionInit(INITARGS);
#endif
#ifdef DBE
-extern void DbeExtensionInit();
+extern void DbeExtensionInit(INITARGS);
#endif
#ifdef XAPPGROUP
-extern void XagExtensionInit();
-#endif
-#ifdef XF86VIDMODE
-extern void XFree86VidModeExtensionInit();
+extern void XagExtensionInit(INITARGS);
#endif
#ifdef XCSECURITY
-extern void SecurityExtensionInit();
+extern void SecurityExtensionInit(INITARGS);
#endif
#ifdef XPRINT
-extern void XpExtensionInit();
+extern void XpExtensionInit(INITARGS);
+#endif
+#ifdef XF86BIGFONT
+extern void XFree86BigfontExtensionInit(INITARGS);
+#endif
+#ifdef XF86VIDMODE
+extern void XFree86VidModeExtensionInit(INITARGS);
+#endif
+#ifdef XF86MISC
+extern void XFree86MiscExtensionInit(INITARGS);
+#endif
+#ifdef XFreeXDGA
+extern void XFree86DGAExtensionInit(INITARGS);
+#endif
+#ifdef GLXEXT
+#ifndef __DARWIN__
+extern void GlxExtensionInit(INITARGS);
+extern void GlxWrapInitVisuals(miInitVisualsProcPtr *);
+#else
+extern void DarwinGlxExtensionInit(INITARGS);
+extern void DarwinGlxWrapInitVisuals(miInitVisualsProcPtr *);
+#endif
+#endif
+#ifdef XF86DRI
+extern void XFree86DRIExtensionInit(INITARGS);
#endif
#ifdef TOGCUP
-extern void XcupExtensionInit();
+extern void XcupExtensionInit(INITARGS);
#endif
#ifdef DPMSExtension
-extern void DPMSExtensionInit();
+extern void DPMSExtensionInit(INITARGS);
+#endif
+#ifdef DPSEXT
+extern void DPSExtensionInit(INITARGS);
+#endif
+#ifdef FONTCACHE
+extern void FontCacheExtensionInit(INITARGS);
+#endif
+#ifdef RENDER
+extern void RenderExtensionInit(INITARGS);
+#endif
+#ifdef RANDR
+extern void RRExtensionInit(INITARGS);
+#endif
+#ifdef RES
+extern void ResExtensionInit(INITARGS);
#endif
+#ifndef XFree86LOADER
/*ARGSUSED*/
void
@@ -155,9 +247,9 @@ InitExtensions(argc, argv)
char *argv[];
{
#ifdef PANORAMIX
-#if !defined(PRINT_ONLY_SERVER) && !defined(NO_PANORAMIX)
+# if !defined(PRINT_ONLY_SERVER) && !defined(NO_PANORAMIX)
if (!noPanoramiXExtension) PanoramiXExtensionInit();
-#endif
+# endif
#endif
#ifdef BEZIER
BezierExtensionInit();
@@ -180,7 +272,7 @@ InitExtensions(argc, argv)
#ifdef MULTIBUFFER
MultibufferExtensionInit();
#endif
-#ifdef XINPUT
+#if defined(XINPUT) && !defined(NO_HW_ONLY_EXTS)
XInputExtensionInit();
#endif
#ifdef XTEST
@@ -203,6 +295,7 @@ InitExtensions(argc, argv)
#endif
#ifdef XV
XvExtensionInit();
+ XvMCExtensionInit();
#endif
#ifdef XIE
XieInit();
@@ -210,7 +303,7 @@ InitExtensions(argc, argv)
#ifdef XSYNC
SyncExtensionInit();
#endif
-#if defined(XKB) && !defined(PRINT_ONLY_SERVER)
+#if defined(XKB) && !defined(PRINT_ONLY_SERVER) && !defined(NO_HW_ONLY_EXTS)
if (!noXkbExtension) XkbExtensionInit();
#endif
#ifdef XCMISC
@@ -228,9 +321,6 @@ InitExtensions(argc, argv)
#ifdef XAPPGROUP
XagExtensionInit();
#endif
-#if defined(XF86VIDMODE) && !defined(PRINT_ONLY_SERVER)
- XFree86VidModeExtensionInit();
-#endif
#ifdef XCSECURITY
SecurityExtensionInit();
#endif
@@ -240,7 +330,224 @@ InitExtensions(argc, argv)
#ifdef TOGCUP
XcupExtensionInit();
#endif
-#if defined(DPMSExtension) && !defined(PRINT_ONLY_SERVER)
+#if defined(DPMSExtension) && !defined(NO_HW_ONLY_EXTS)
DPMSExtensionInit();
#endif
+#ifdef FONTCACHE
+ FontCacheExtensionInit();
+#endif
+#ifdef XF86BIGFONT
+ XFree86BigfontExtensionInit();
+#endif
+#if !defined(PRINT_ONLY_SERVER) && !defined(NO_HW_ONLY_EXTS)
+#if defined(XF86VIDMODE)
+ XFree86VidModeExtensionInit();
+#endif
+#if defined(XF86MISC)
+ XFree86MiscExtensionInit();
+#endif
+#if defined(XFreeXDGA)
+ XFree86DGAExtensionInit();
+#endif
+#ifdef XF86DRI
+ XFree86DRIExtensionInit();
+#endif
+#endif
+#ifdef GLXEXT
+#ifndef XPRINT /* we don't want Glx in the Xprint server */
+#ifndef __DARWIN__
+ GlxExtensionInit();
+#else
+ DarwinGlxExtensionInit();
+#endif
+#endif
+#endif
+#ifdef DPSEXT
+#ifndef XPRINT
+ DPSExtensionInit();
+#endif
+#endif
+#ifdef RENDER
+ RenderExtensionInit();
+#endif
+#ifdef RANDR
+ RRExtensionInit();
+#endif
+#ifdef RES
+ ResExtensionInit();
+#endif
}
+
+void
+InitVisualWrap()
+{
+ miResetInitVisuals();
+#ifdef GLXEXT
+#ifndef XPRINT
+#ifndef __DARWIN__
+ GlxWrapInitVisuals(&miInitVisualsProc);
+#else
+ DarwinGlxWrapInitVisuals(&miInitVisualsProc);
+#endif
+#endif
+#endif
+}
+
+#else /* XFree86LOADER */
+#if 0
+/* FIXME:The names here must come from the headers. those with ?? are
+ not included in X11R6.3 sample implementation, so there's a problem... */
+/* XXX use the correct #ifdefs for symbols not present when an extension
+ is disabled */
+ExtensionModule extension[] =
+{
+ { NULL, "BEZIER", NULL, NULL }, /* ?? */
+ { NULL, "XTEST1", &noTestExtensions, NULL }, /* ?? */
+ { NULL, "SHAPE", NULL, NULL },
+ { NULL, "MIT-SHM", NULL, NULL },
+ { NULL, "X3D-PEX", NULL, NULL },
+ { NULL, "Multi-Buffering", NULL, NULL },
+ { NULL, "XInputExtension", NULL, NULL },
+ { NULL, "XTEST", &noTestExtensions, NULL },
+ { NULL, "BIG-REQUESTS", NULL, NULL },
+ { NULL, "MIT-SUNDRY-NONSTANDARD", NULL, NULL },
+ { NULL, "XIDLE", NULL, NULL }, /* ?? */
+ { NULL, "XTRAP", &noTestExtensions, NULL }, /* ?? */
+ { NULL, "MIT-SCREEN-SAVER", NULL, NULL },
+ { NULL, "XVideo", NULL, NULL }, /* ?? */
+ { NULL, "XIE", NULL, NULL },
+ { NULL, "SYNC", NULL, NULL },
+#ifdef XKB
+ { NULL, "XKEYBOARD", &noXkbExtension, NULL },
+#else
+ { NULL, "NOXKEYBOARD", NULL, NULL },
+#endif
+ { NULL, "XC-MISC", NULL, NULL },
+ { NULL, "RECORD", &noTestExtensions, NULL },
+ { NULL, "LBX", NULL, NULL },
+ { NULL, "DOUBLE-BUFFER", NULL, NULL },
+ { NULL, "XC-APPGROUP", NULL, NULL },
+ { NULL, "SECURITY", NULL, NULL },
+ { NULL, "XpExtension", NULL, NULL },
+ { NULL, "XFree86-VidModeExtension", NULL, NULL },
+ { NULL, "XFree86-Misc", NULL, NULL },
+ { NULL, "XFree86-DGA", NULL, NULL },
+ { NULL, "DPMS", NULL, NULL },
+ { NULL, "GLX", NULL, NULL },
+ { NULL, "TOG-CUP", NULL, NULL },
+ { NULL, "Extended-Visual-Information", NULL, NULL },
+#ifdef PANORAMIX
+ { NULL, "XINERAMA", &noPanoramiXExtension, NULL },
+#else
+ { NULL, "NOXINERAMA", NULL, NULL },
+#endif
+ { NULL, "XFree86-Bigfont", NULL, NULL },
+ { NULL, "XFree86-DRI", NULL, NULL },
+ { NULL, "Adobe-DPS-Extension", NULL, NULL },
+ { NULL, "FontCache", NULL, NULL },
+ { NULL, "RENDER", NULL, NULL },
+ { NULL, "RANDR", NULL, NULL },
+ { NULL, "X-Resource", NULL, NULL },
+ { NULL, NULL, NULL, NULL }
+};
+#endif
+
+/* List of built-in (statically linked) extensions */
+static ExtensionModule staticExtensions[] = {
+#ifdef BEZIER
+ { BezierExtensionInit, "BEZIER", NULL, NULL, NULL },
+#endif
+#ifdef XTESTEXT1
+ { XTestExtension1Init, "XTEST1", &noTestExtensions, NULL, NULL },
+#endif
+#ifdef MITSHM
+ { ShmExtensionInit, SHMNAME, NULL, NULL, NULL },
+#endif
+#ifdef XINPUT
+ { XInputExtensionInit, "XInputExtension", NULL, NULL, NULL },
+#endif
+#ifdef XTEST
+ { XTestExtensionInit, XTestExtensionName, &noTestExtensions, NULL, NULL },
+#endif
+#ifdef XIDLE
+ { XIdleExtensionInit, "XIDLE", NULL, NULL, NULL },
+#endif
+#ifdef XKB
+ { XkbExtensionInit, XkbName, &noXkbExtension, NULL, NULL },
+#endif
+#ifdef LBX
+ { LbxExtensionInit, LBXNAME, NULL, NULL, NULL },
+#endif
+#ifdef XAPPGROUP
+ { XagExtensionInit, XAGNAME, NULL, NULL, NULL },
+#endif
+#ifdef XCSECURITY
+ { SecurityExtensionInit, SECURITY_EXTENSION_NAME, NULL, NULL, NULL },
+#endif
+#ifdef XPRINT
+ { XpExtensionInit, XP_PRINTNAME, NULL, NULL, NULL },
+#endif
+#ifdef PANORAMIX
+ { PanoramiXExtensionInit, PANORAMIX_PROTOCOL_NAME, &noPanoramiXExtension, NULL, NULL },
+#endif
+#ifdef XF86BIGFONT
+ { XFree86BigfontExtensionInit, XF86BIGFONTNAME, NULL, NULL, NULL },
+#endif
+#ifdef RENDER
+ { RenderExtensionInit, "RENDER", NULL, NULL, NULL },
+#endif
+#ifdef RANDR
+ { RRExtensionInit, "RANDR", NULL, NULL, NULL },
+#endif
+ { NULL, NULL, NULL, NULL, NULL }
+};
+
+/*ARGSUSED*/
+void
+InitExtensions(argc, argv)
+ int argc;
+ char *argv[];
+{
+ int i;
+ ExtensionModule *ext;
+ static Bool listInitialised = FALSE;
+
+ if (!listInitialised) {
+ /* Add built-in extensions to the list. */
+ for (i = 0; staticExtensions[i].name; i++)
+ LoadExtension(&staticExtensions[i], TRUE);
+
+ /* Sort the extensions according the init dependencies. */
+ LoaderSortExtensions();
+ listInitialised = TRUE;
+ }
+
+ for (i = 0; ExtensionModuleList[i].name != NULL; i++) {
+ ext = &ExtensionModuleList[i];
+ if (ext->initFunc != NULL &&
+ (ext->disablePtr == NULL ||
+ (ext->disablePtr != NULL && !*ext->disablePtr))) {
+ (ext->initFunc)();
+ }
+ }
+}
+
+static void (*__miHookInitVisualsFunction)(miInitVisualsProcPtr *);
+
+void
+InitVisualWrap()
+{
+ miResetInitVisuals();
+ if (__miHookInitVisualsFunction)
+ (*__miHookInitVisualsFunction)(&miInitVisualsProc);
+}
+
+void miHookInitVisuals(void (**old)(miInitVisualsProcPtr *),
+ void (*new)(miInitVisualsProcPtr *))
+{
+ if (old)
+ *old = __miHookInitVisualsFunction;
+ __miHookInitVisualsFunction = new;
+}
+
+#endif /* XFree86LOADER */
diff --git a/mi/miline.h b/mi/miline.h
index 329dea51e..8977550b3 100644
--- a/mi/miline.h
+++ b/mi/miline.h
@@ -25,9 +25,12 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/miline.h,v 1.7 2001/12/14 20:00:24 dawes Exp $ */
#ifndef MILINE_H
+#include "screenint.h"
+
/*
* Public definitions used for configuring basic pixelization aspects
* of the sample implementation line-drawing routines provided in
@@ -76,10 +79,8 @@ in this Software without prior written authorization from The Open Group.
*/
extern void miSetZeroLineBias(
-#if NeedFunctionPrototypes
ScreenPtr /* pScreen */,
unsigned int /* bias */
-#endif
);
/*
@@ -101,6 +102,14 @@ extern void miSetZeroLineBias(
if ( (_y) < (_pbox)->y1) (_result) |= OUT_ABOVE; \
else if ( (_y) >= (_pbox)->y2) (_result) |= OUT_BELOW;
+#define MIOUTCODES(outcode, x, y, xmin, ymin, xmax, ymax) \
+{\
+ if (x < xmin) outcode |= OUT_LEFT;\
+ if (x > xmax) outcode |= OUT_RIGHT;\
+ if (y < ymin) outcode |= OUT_ABOVE;\
+ if (y > ymax) outcode |= OUT_BELOW;\
+}
+
#define SWAPINT(i, j) \
{ register int _t = i; i = j; j = _t; }
@@ -144,7 +153,6 @@ extern void miSetZeroLineBias(
extern int miZeroLineScreenIndex;
extern int miZeroClipLine(
-#if NeedFunctionPrototypes
int /*xmin*/,
int /*ymin*/,
int /*xmax*/,
@@ -161,7 +169,6 @@ extern int miZeroClipLine(
unsigned int /*bias*/,
int /*oc1*/,
int /*oc2*/
-#endif
);
#endif /* MILINE_H */
diff --git a/mi/mipointer.c b/mi/mipointer.c
index 8617861cd..58d93b80b 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -28,6 +28,7 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/mipointer.c,v 3.10 2001/12/14 20:00:24 dawes Exp $ */
# define NEED_EVENTS
# include "X.h"
@@ -42,7 +43,7 @@ in this Software without prior written authorization from The Open Group.
# include "cursorstr.h"
# include "dixstruct.h"
-static int miPointerScreenIndex;
+int miPointerScreenIndex;
static unsigned long miPointerGeneration = 0;
#define GetScreenPrivate(s) ((miPointerScreenPtr) ((s)->devPrivates[miPointerScreenIndex].ptr))
@@ -54,15 +55,17 @@ static unsigned long miPointerGeneration = 0;
static miPointerRec miPointer;
-static Bool miPointerRealizeCursor (), miPointerUnrealizeCursor ();
-static Bool miPointerDisplayCursor ();
-static void miPointerConstrainCursor (), miPointerPointerNonInterestBox();
-static void miPointerCursorLimits ();
-static Bool miPointerSetCursorPosition ();
-
-static Bool miPointerCloseScreen();
-
-static void miPointerMove ();
+static Bool miPointerRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
+static Bool miPointerUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
+static Bool miPointerDisplayCursor(ScreenPtr pScreen, CursorPtr pCursor);
+static void miPointerConstrainCursor(ScreenPtr pScreen, BoxPtr pBox);
+static void miPointerPointerNonInterestBox(ScreenPtr pScreen, BoxPtr pBox);
+static void miPointerCursorLimits(ScreenPtr pScreen, CursorPtr pCursor,
+ BoxPtr pHotBox, BoxPtr pTopLeftBox);
+static Bool miPointerSetCursorPosition(ScreenPtr pScreen, int x, int y,
+ Bool generateEvent);
+static Bool miPointerCloseScreen(int index, ScreenPtr pScreen);
+static void miPointerMove(ScreenPtr pScreen, int x, int y, unsigned long time);
Bool
miPointerInitialize (pScreen, spriteFuncs, screenFuncs, waitForUpdate)
@@ -93,6 +96,7 @@ miPointerInitialize (pScreen, spriteFuncs, screenFuncs, waitForUpdate)
if (!screenFuncs->NewEventScreen)
screenFuncs->NewEventScreen = mieqSwitchScreen;
pScreenPriv->waitForUpdate = waitForUpdate;
+ pScreenPriv->showTransparent = FALSE;
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = miPointerCloseScreen;
pScreen->devPrivates[miPointerScreenIndex].ptr = (pointer) pScreenPriv;
@@ -170,8 +174,6 @@ miPointerDisplayCursor (pScreen, pCursor)
ScreenPtr pScreen;
CursorPtr pCursor;
{
- SetupScreen(pScreen);
-
miPointer.pCursor = pCursor;
miPointer.pScreen = pScreen;
miPointerUpdate ();
@@ -249,7 +251,8 @@ miPointerWarpCursor (pScreen, x, y)
{
miPointer.devx = x;
miPointer.devy = y;
- (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y);
+ if(!miPointer.pCursor->bits->emptyMask)
+ (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y);
}
miPointer.x = x;
miPointer.y = y;
@@ -305,6 +308,7 @@ miPointerUpdate ()
{
ScreenPtr pScreen;
miPointerScreenPtr pScreenPriv;
+ CursorPtr pCursor;
int x, y, devx, devy;
pScreen = miPointer.pScreen;
@@ -346,8 +350,11 @@ miPointerUpdate ()
*/
else if (miPointer.pCursor != miPointer.pSpriteCursor)
{
- (*pScreenPriv->spriteFuncs->SetCursor)
- (pScreen, miPointer.pCursor, x, y);
+ pCursor = miPointer.pCursor;
+ if (pCursor->bits->emptyMask && !pScreenPriv->showTransparent)
+ pCursor = NullCursor;
+ (*pScreenPriv->spriteFuncs->SetCursor) (pScreen, pCursor, x, y);
+
miPointer.devx = x;
miPointer.devy = y;
miPointer.pSpriteCursor = miPointer.pCursor;
@@ -356,7 +363,8 @@ miPointerUpdate ()
{
miPointer.devx = x;
miPointer.devy = y;
- (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y);
+ if(!miPointer.pCursor->bits->emptyMask)
+ (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y);
}
}
@@ -373,6 +381,26 @@ miPointerDeltaCursor (dx, dy, time)
miPointerAbsoluteCursor (miPointer.x + dx, miPointer.y + dy, time);
}
+void
+miPointerSetNewScreen(int screen_no, int x, int y)
+{
+ miPointerScreenPtr pScreenPriv;
+ ScreenPtr pScreen;
+
+ pScreen = screenInfo.screens[screen_no];
+ pScreenPriv = GetScreenPrivate (pScreen);
+ (*pScreenPriv->screenFuncs->NewEventScreen) (pScreen, FALSE);
+ NewCurrentScreen (pScreen, x, y);
+ miPointer.limits.x2 = pScreen->width;
+ miPointer.limits.y2 = pScreen->height;
+}
+
+ScreenPtr
+miPointerCurrentScreen ()
+{
+ return (miPointer.pScreen);
+}
+
/*
* miPointerAbsoluteCursor. The pointer has moved to x,y
*/
@@ -451,7 +479,8 @@ miPointerMove (pScreen, x, y, time)
{
miPointer.devx = x;
miPointer.devy = y;
- (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y);
+ if(!miPointer.pCursor->bits->emptyMask)
+ (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y);
}
miPointer.x = x;
miPointer.y = y;
@@ -490,9 +519,21 @@ miPointerMove (pScreen, x, y, time)
}
void
+_miRegisterPointerDevice (pScreen, pDevice)
+ ScreenPtr pScreen;
+ DeviceIntPtr pDevice;
+{
+ miPointer.pPointer = (DevicePtr)pDevice;
+}
+
+/* obsolete: for binary compatibility */
+#ifdef miRegisterPointerDevice
+#undef miRegisterPointerDevice
+void
miRegisterPointerDevice (pScreen, pDevice)
ScreenPtr pScreen;
- DevicePtr pDevice;
+ DevicePtr pDevice;
{
miPointer.pPointer = pDevice;
}
+#endif /* miRegisterPointerDevice */
diff --git a/mi/mipointer.h b/mi/mipointer.h
index a2f74b07b..0486fc5a3 100644
--- a/mi/mipointer.h
+++ b/mi/mipointer.h
@@ -29,94 +29,134 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/mipointer.h,v 3.9 2001/12/14 20:00:24 dawes Exp $ */
+
+#ifndef MIPOINTER_H
+#define MIPOINTER_H
+
+#include "cursor.h"
+#include "input.h"
typedef struct _miPointerSpriteFuncRec {
- Bool (*RealizeCursor)(); /* pScreen, pCursor */
- Bool (*UnrealizeCursor)(); /* pScreen, pCursor */
- void (*SetCursor)(); /* pScreen, pCursor, x, y */
- void (*MoveCursor)(); /* pScreen, x, y */
+ Bool (*RealizeCursor)(
+ ScreenPtr /* pScr */,
+ CursorPtr /* pCurs */
+ );
+ Bool (*UnrealizeCursor)(
+ ScreenPtr /* pScr */,
+ CursorPtr /* pCurs */
+ );
+ void (*SetCursor)(
+ ScreenPtr /* pScr */,
+ CursorPtr /* pCurs */,
+ int /* x */,
+ int /* y */
+ );
+ void (*MoveCursor)(
+ ScreenPtr /* pScr */,
+ int /* x */,
+ int /* y */
+ );
} miPointerSpriteFuncRec, *miPointerSpriteFuncPtr;
typedef struct _miPointerScreenFuncRec {
- Bool (*CursorOffScreen)(); /* ppScreen, px, py */
- void (*CrossScreen)(); /* pScreen, entering */
- void (*WarpCursor)(); /* pScreen, x, y */
- void (*EnqueueEvent)(); /* xEvent */
- void (*NewEventScreen)(); /* pScreen */
+ Bool (*CursorOffScreen)(
+ ScreenPtr* /* ppScr */,
+ int* /* px */,
+ int* /* py */
+ );
+ void (*CrossScreen)(
+ ScreenPtr /* pScr */,
+ int /* entering */
+ );
+ void (*WarpCursor)(
+ ScreenPtr /* pScr */,
+ int /* x */,
+ int /* y */
+ );
+ void (*EnqueueEvent)(
+ xEventPtr /* event */
+ );
+ void (*NewEventScreen)(
+ ScreenPtr /* pScr */,
+ Bool /* fromDIX */
+ );
} miPointerScreenFuncRec, *miPointerScreenFuncPtr;
extern Bool miDCInitialize(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
miPointerScreenFuncPtr /*screenFuncs*/
-#endif
);
extern Bool miPointerInitialize(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
miPointerSpriteFuncPtr /*spriteFuncs*/,
miPointerScreenFuncPtr /*screenFuncs*/,
Bool /*waitForUpdate*/
-#endif
);
extern void miPointerWarpCursor(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
int /*x*/,
int /*y*/
-#endif
);
extern int miPointerGetMotionBufferSize(
-#if NeedFunctionPrototypes
void
-#endif
);
extern int miPointerGetMotionEvents(
-#if NeedFunctionPrototypes
DeviceIntPtr /*pPtr*/,
xTimecoord * /*coords*/,
unsigned long /*start*/,
unsigned long /*stop*/,
ScreenPtr /*pScreen*/
-#endif
);
extern void miPointerUpdate(
-#if NeedFunctionPrototypes
void
-#endif
);
extern void miPointerDeltaCursor(
-#if NeedFunctionPrototypes
int /*dx*/,
int /*dy*/,
unsigned long /*time*/
-#endif
);
extern void miPointerAbsoluteCursor(
-#if NeedFunctionPrototypes
int /*x*/,
int /*y*/,
unsigned long /*time*/
-#endif
);
extern void miPointerPosition(
-#if NeedFunctionPrototypes
int * /*x*/,
int * /*y*/
-#endif
);
+#undef miRegisterPointerDevice
extern void miRegisterPointerDevice(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
DevicePtr /*pDevice*/
-#endif
);
+
+extern void miPointerSetNewScreen(
+ int, /*screen_no*/
+ int, /*x*/
+ int /*y*/
+);
+extern ScreenPtr miPointerCurrentScreen(
+ void
+);
+
+#define miRegisterPointerDevice(pScreen,pDevice) \
+ _miRegisterPointerDevice(pScreen,pDevice)
+
+extern void _miRegisterPointerDevice(
+ ScreenPtr /*pScreen*/,
+ DeviceIntPtr /*pDevice*/
+);
+
+extern int miPointerScreenIndex;
+
+#endif /* MIPOINTER_H */
diff --git a/mi/mipointrst.h b/mi/mipointrst.h
index 236079166..ab5372229 100644
--- a/mi/mipointrst.h
+++ b/mi/mipointrst.h
@@ -29,9 +29,10 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/mipointrst.h,v 1.4 2001/12/14 20:00:25 dawes Exp $ */
-# include <mipointer.h>
-# include <input.h>
+#include "mipointer.h"
+#include "scrnintstr.h"
#define MOTION_SIZE 256
@@ -59,4 +60,5 @@ typedef struct {
miPointerScreenFuncPtr screenFuncs; /* screen-specific methods */
CloseScreenProcPtr CloseScreen;
Bool waitForUpdate; /* don't move cursor in SIGIO */
+ Bool showTransparent; /* show empty cursors */
} miPointerScreenRec, *miPointerScreenPtr;
diff --git a/mi/mipoly.h b/mi/mipoly.h
index d946388a6..42d973477 100644
--- a/mi/mipoly.h
+++ b/mi/mipoly.h
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/mipoly.h,v 1.3 2001/12/14 20:00:25 dawes Exp $ */
/*
@@ -182,47 +183,35 @@ typedef struct _ScanLineListBlock {
/* mipolyutil.c */
extern Bool miInsertEdgeInET(
-#if NeedFunctionPrototypes
EdgeTable * /*ET*/,
EdgeTableEntry * /*ETE*/,
int /*scanline*/,
ScanLineListBlock ** /*SLLBlock*/,
int * /*iSLLBlock*/
-#endif
);
extern Bool miCreateETandAET(
-#if NeedFunctionPrototypes
int /*count*/,
DDXPointPtr /*pts*/,
EdgeTable * /*ET*/,
EdgeTableEntry * /*AET*/,
EdgeTableEntry * /*pETEs*/,
ScanLineListBlock * /*pSLLBlock*/
-#endif
);
extern void miloadAET(
-#if NeedFunctionPrototypes
EdgeTableEntry * /*AET*/,
EdgeTableEntry * /*ETEs*/
-#endif
);
extern void micomputeWAET(
-#if NeedFunctionPrototypes
EdgeTableEntry * /*AET*/
-#endif
);
extern int miInsertionSort(
-#if NeedFunctionPrototypes
EdgeTableEntry * /*AET*/
-#endif
);
extern void miFreeStorage(
-#if NeedFunctionPrototypes
ScanLineListBlock * /*pSLLBlock*/
-#endif
);
diff --git a/mi/mipolycon.c b/mi/mipolycon.c
index 9daf44543..d99ed83d7 100644
--- a/mi/mipolycon.c
+++ b/mi/mipolycon.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mipolycon.c,v 1.4 2001/12/14 20:00:25 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -45,11 +46,13 @@ SOFTWARE.
******************************************************************/
/* $Xorg: mipolycon.c,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */
+
#include "gcstruct.h"
#include "pixmap.h"
+#include "mi.h"
#include "miscanfill.h"
-static int getPolyYBounds();
+static int getPolyYBounds(DDXPointPtr pts, int n, int *by, int *ty);
/*
* convexpoly.c
@@ -73,21 +76,21 @@ miFillConvexPoly(dst, pgc, count, ptsIn)
int count; /* number of points */
DDXPointPtr ptsIn; /* the points */
{
- register int xl, xr; /* x vals of left and right edges */
- register int dl, dr; /* decision variables */
- register int ml, m1l; /* left edge slope and slope+1 */
- int mr, m1r; /* right edge slope and slope+1 */
- int incr1l, incr2l; /* left edge error increments */
- int incr1r, incr2r; /* right edge error increments */
- int dy; /* delta y */
- int y; /* current scanline */
- int left, right; /* indices to first endpoints */
- int i; /* loop counter */
- int nextleft, nextright; /* indices to second endpoints */
+ register int xl = 0, xr = 0; /* x vals of left and right edges */
+ register int dl = 0, dr = 0; /* decision variables */
+ register int ml = 0, m1l = 0;/* left edge slope and slope+1 */
+ int mr = 0, m1r = 0; /* right edge slope and slope+1 */
+ int incr1l = 0, incr2l = 0; /* left edge error increments */
+ int incr1r = 0, incr2r = 0; /* right edge error increments */
+ int dy; /* delta y */
+ int y; /* current scanline */
+ int left, right; /* indices to first endpoints */
+ int i; /* loop counter */
+ int nextleft, nextright; /* indices to second endpoints */
DDXPointPtr ptsOut, FirstPoint; /* output buffer */
- int *width, *FirstWidth; /* output buffer */
- int imin; /* index of smallest vertex (in y) */
- int ymin; /* y-extents of polygon */
+ int *width, *FirstWidth; /* output buffer */
+ int imin; /* index of smallest vertex (in y) */
+ int ymin; /* y-extents of polygon */
int ymax;
/*
@@ -213,12 +216,8 @@ miFillConvexPoly(dst, pgc, count, ptsIn)
/*
* Find the index of the point with the smallest y.
*/
-static
-int
-getPolyYBounds(pts, n, by, ty)
- DDXPointPtr pts;
- int n;
- int *by, *ty;
+static int
+getPolyYBounds(DDXPointPtr pts, int n, int *by, int *ty)
{
register DDXPointPtr ptMin;
int ymin, ymax;
diff --git a/mi/mipolygen.c b/mi/mipolygen.c
index b9c0248c6..bbeb05dc3 100644
--- a/mi/mipolygen.c
+++ b/mi/mipolygen.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mipolygen.c,v 1.3 2001/12/14 20:00:25 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -50,6 +51,7 @@ SOFTWARE.
#include "miscanfill.h"
#include "mipoly.h"
#include "pixmap.h"
+#include "mi.h"
/*
*
diff --git a/mi/mipolypnt.c b/mi/mipolypnt.c
index 933e1cc3b..ed19f5f68 100644
--- a/mi/mipolypnt.c
+++ b/mi/mipolypnt.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mipolypnt.c,v 1.3 2001/12/14 20:00:25 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -50,6 +51,7 @@ SOFTWARE.
#include "pixmapstr.h"
#include "gcstruct.h"
#include "windowstr.h"
+#include "mi.h"
void
miPolyPoint(pDrawable, pGC, mode, npt, pptInit)
diff --git a/mi/mipolyrect.c b/mi/mipolyrect.c
index 935203d9a..f6d170ef9 100644
--- a/mi/mipolyrect.c
+++ b/mi/mipolyrect.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mipolyrect.c,v 1.3 2001/12/14 20:00:25 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -50,6 +51,7 @@ SOFTWARE.
#include "miscstruct.h"
#include "gcstruct.h"
#include "pixmap.h"
+#include "mi.h"
void
miPolyRectangle(pDraw, pGC, nrects, pRects)
diff --git a/mi/mipolyseg.c b/mi/mipolyseg.c
index 2500f7abb..82f2983e3 100644
--- a/mi/mipolyseg.c
+++ b/mi/mipolyseg.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mipolyseg.c,v 1.3 2001/12/14 20:00:26 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -50,6 +51,7 @@ SOFTWARE.
#include "miscstruct.h"
#include "gcstruct.h"
#include "pixmap.h"
+#include "mi.h"
/*****************************************************************
* miPolySegment
diff --git a/mi/mipolytext.c b/mi/mipolytext.c
index 22dc6b2a9..9084fe180 100644
--- a/mi/mipolytext.c
+++ b/mi/mipolytext.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mipolytext.c,v 1.3 2001/12/14 20:00:26 dawes Exp $ */
/*******************************************************************
Copyright 1987, 1998 The Open Group
@@ -61,6 +62,7 @@ SOFTWARE.
#include "gcstruct.h"
#include "fontstruct.h"
#include "dixfontstr.h"
+#include "mi.h"
int
miPolyText(pDraw, pGC, x, y, count, chars, fontEncoding)
diff --git a/mi/mipolyutil.c b/mi/mipolyutil.c
index 879bd6e1d..537ac6fb4 100644
--- a/mi/mipolyutil.c
+++ b/mi/mipolyutil.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mipolyutil.c,v 1.9 2001/12/14 20:00:26 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -49,9 +50,7 @@ SOFTWARE.
#include "gc.h"
#include "miscanfill.h"
#include "mipoly.h"
-
-#define MAXINT 0x7fffffff
-#define MININT -MAXINT
+#include "misc.h" /* MAXINT */
/*
* fillUtils.c
diff --git a/mi/mipushpxl.c b/mi/mipushpxl.c
index 24ee8bbe3..462d93191 100644
--- a/mi/mipushpxl.c
+++ b/mi/mipushpxl.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mipushpxl.c,v 3.12 2001/12/14 20:00:26 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -51,6 +52,7 @@ SOFTWARE.
#include "pixmapstr.h"
#include "miscstruct.h"
#include "../mfb/maskbits.h"
+#include "mi.h"
#define NPT 128
@@ -68,6 +70,11 @@ per scanline, scanline unit = 32 bits; later, this might mean
bitsizeof(int) padding and sacnline unit == bitsizeof(int).)
*/
+
+/*
+ * in order to have both (MSB_FIRST and LSB_FIRST) versions of this
+ * in the server, we need to rename one of them
+ */
void
miPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
GCPtr pGC;
@@ -75,21 +82,38 @@ miPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
DrawablePtr pDrawable;
int dx, dy, xOrg, yOrg;
{
- int h, dxDiv32, ibEnd;
- unsigned long *pwLineStart;
- register unsigned long *pw, *pwEnd;
- register unsigned long msk;
+ int h, dxDivPPW, ibEnd;
+ MiBits *pwLineStart;
+ register MiBits *pw, *pwEnd;
+ register MiBits msk;
register int ib, w;
register int ipt; /* index into above arrays */
Bool fInBox;
DDXPointRec pt[NPT], ptThisLine;
int width[NPT];
+#ifdef XFree86Server
+ PixelType startmask;
+ if (screenInfo.bitmapBitOrder == IMAGE_BYTE_ORDER)
+ if (screenInfo.bitmapBitOrder == LSBFirst)
+ startmask = (MiBits)(-1) ^
+ LONG2CHARSSAMEORDER((MiBits)(-1) << 1);
+ else
+ startmask = (MiBits)(-1) ^
+ LONG2CHARSSAMEORDER((MiBits)(-1) >> 1);
+ else
+ if (screenInfo.bitmapBitOrder == LSBFirst)
+ startmask = (MiBits)(-1) ^
+ LONG2CHARSDIFFORDER((MiBits)(-1) << 1);
+ else
+ startmask = (MiBits)(-1) ^
+ LONG2CHARSDIFFORDER((MiBits)(-1) >> 1);
+#endif
- pwLineStart = (unsigned long *)xalloc(BitmapBytePad(dx));
+ pwLineStart = (MiBits *)xalloc(BitmapBytePad(dx));
if (!pwLineStart)
return;
ipt = 0;
- dxDiv32 = dx/32;
+ dxDivPPW = dx/PPW;
for(h = 0, ptThisLine.x = 0, ptThisLine.y = 0;
h < dy;
@@ -103,18 +127,22 @@ miPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
/* Process all words which are fully in the pixmap */
fInBox = FALSE;
- pwEnd = pwLineStart + dxDiv32;
+ pwEnd = pwLineStart + dxDivPPW;
while(pw < pwEnd)
{
w = *pw;
- msk = endtab[1];
- for(ib = 0; ib < 32; ib++)
+#ifdef XFree86Server
+ msk = startmask;
+#else
+ msk = (MiBits)(-1) ^ SCRRIGHT((MiBits)(-1), 1);
+#endif
+ for(ib = 0; ib < PPW; ib++)
{
if(w & msk)
{
if(!fInBox)
{
- pt[ipt].x = ((pw - pwLineStart) << 5) + ib + xOrg;
+ pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg;
pt[ipt].y = h + yOrg;
/* start new box */
fInBox = TRUE;
@@ -124,7 +152,7 @@ miPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
{
if(fInBox)
{
- width[ipt] = ((pw - pwLineStart) << 5) +
+ width[ipt] = ((pw - pwLineStart) << PWSH) +
ib + xOrg - pt[ipt].x;
if (++ipt >= NPT)
{
@@ -136,16 +164,34 @@ miPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
fInBox = FALSE;
}
}
+#ifdef XFree86Server
+ /* This is not quite right, but it'll do for now */
+ if (screenInfo.bitmapBitOrder == IMAGE_BYTE_ORDER)
+ if (screenInfo.bitmapBitOrder == LSBFirst)
+ msk = LONG2CHARSSAMEORDER(LONG2CHARSSAMEORDER(msk) << 1);
+ else
+ msk = LONG2CHARSSAMEORDER(LONG2CHARSSAMEORDER(msk) >> 1);
+ else
+ if (screenInfo.bitmapBitOrder == LSBFirst)
+ msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) << 1);
+ else
+ msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) >> 1);
+#else
msk = SCRRIGHT(msk, 1);
+#endif
}
pw++;
}
- ibEnd = dx & 0x1F;
+ ibEnd = dx & PIM;
if(ibEnd)
{
/* Process final partial word on line */
w = *pw;
- msk = endtab[1];
+#ifdef XFree86Server
+ msk = startmask;
+#else
+ msk = (MiBits)(-1) ^ SCRRIGHT((MiBits)(-1), 1);
+#endif
for(ib = 0; ib < ibEnd; ib++)
{
if(w & msk)
@@ -153,7 +199,7 @@ miPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
if(!fInBox)
{
/* start new box */
- pt[ipt].x = ((pw - pwLineStart) << 5) + ib + xOrg;
+ pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg;
pt[ipt].y = h + yOrg;
fInBox = TRUE;
}
@@ -163,7 +209,7 @@ miPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
if(fInBox)
{
/* end box */
- width[ipt] = ((pw - pwLineStart) << 5) +
+ width[ipt] = ((pw - pwLineStart) << PWSH) +
ib + xOrg - pt[ipt].x;
if (++ipt >= NPT)
{
@@ -174,7 +220,21 @@ miPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
fInBox = FALSE;
}
}
+#ifdef XFree86Server
+ /* This is not quite right, but it'll do for now */
+ if (screenInfo.bitmapBitOrder == IMAGE_BYTE_ORDER)
+ if (screenInfo.bitmapBitOrder == LSBFirst)
+ msk = LONG2CHARSSAMEORDER(LONG2CHARSSAMEORDER(msk) << 1);
+ else
+ msk = LONG2CHARSSAMEORDER(LONG2CHARSSAMEORDER(msk) >> 1);
+ else
+ if (screenInfo.bitmapBitOrder == LSBFirst)
+ msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) << 1);
+ else
+ msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) >> 1);
+#else
msk = SCRRIGHT(msk, 1);
+#endif
}
}
/* If scanline ended with last bit set, end the box */
diff --git a/mi/miregion.c b/mi/miregion.c
index f9c25b09d..9a40e7757 100644
--- a/mi/miregion.c
+++ b/mi/miregion.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/miregion.c,v 1.8 2001/12/14 20:00:26 dawes Exp $ */
/***********************************************************
Copyright 1987, 1988, 1989, 1998 The Open Group
@@ -47,11 +48,34 @@ SOFTWARE.
******************************************************************/
/* $Xorg: miregion.c,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */
-#include <stdio.h>
+/* The panoramix components contained the following notice */
+/****************************************************************
+* *
+* Copyright (c) Digital Equipment Corporation, 1991, 1997 *
+* *
+* All Rights Reserved. Unpublished rights reserved under *
+* the copyright laws of the United States. *
+* *
+* The software contained on this media is proprietary to *
+* and embodies the confidential technology of Digital *
+* Equipment Corporation. Possession, use, duplication or *
+* dissemination of the software and media is authorized only *
+* pursuant to a valid written license from Digital Equipment *
+* Corporation. *
+* *
+* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
+* by the U.S. Government is subject to restrictions as set *
+* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
+* or in FAR 52.227-19, as applicable. *
+* *
+*****************************************************************/
+
#include "miscstruct.h"
#include "regionstr.h"
#include "Xprotostr.h"
#include "gc.h"
+#include "mi.h"
+#include "mispans.h"
#if defined (__GNUC__) && !defined (NO_INLINES)
#define INLINE __inline
@@ -59,12 +83,7 @@ SOFTWARE.
#define INLINE
#endif
-/*
- * hack until callers of these functions can deal with out-of-memory
- */
-
-extern Bool Must_have_memory;
-
+#undef assert
#ifdef DEBUG
#define assert(expr) {if (!(expr)) \
FatalError("Assertion failed file %s, line %d: expr\n", \
@@ -146,9 +165,13 @@ extern Bool Must_have_memory;
#define xallocData(n) (RegDataPtr)xalloc(REGION_SZOF(n))
#define xfreeData(reg) if ((reg)->data && (reg)->data->size) xfree((reg)->data)
+#define RECTALLOC_BAIL(pReg,n,bail) \
+if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
+ if (!miRectAlloc(pReg, n)) { goto bail; }
+
#define RECTALLOC(pReg,n) \
if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
- miRectAlloc(pReg, n)
+ if (!miRectAlloc(pReg, n)) { return FALSE; }
#define ADDRECT(pNextRect,nx1,ny1,nx2,ny2) \
{ \
@@ -163,7 +186,8 @@ if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
{ \
if (!(pReg)->data || ((pReg)->data->numRects == (pReg)->data->size))\
{ \
- miRectAlloc(pReg, 1); \
+ if (!miRectAlloc(pReg, 1)) \
+ return FALSE; \
pNextRect = REGION_TOP(pReg); \
} \
ADDRECT(pNextRect,nx1,ny1,nx2,ny2); \
@@ -188,6 +212,9 @@ if (((numRects) < ((reg)->data->size >> 1)) && ((reg)->data->size > 50)) \
BoxRec miEmptyBox = {0, 0, 0, 0};
RegDataRec miEmptyData = {0, 0};
+RegDataRec miBrokenData = {0, 0};
+RegionRec miBrokenRegion = { { 0, 0, 0, 0 }, &miBrokenData };
+
#ifdef DEBUG
int
miPrintRegion(rgn)
@@ -298,9 +325,9 @@ miRegionCreate(rect, size)
{
register RegionPtr pReg;
- Must_have_memory = TRUE; /* XXX */
pReg = (RegionPtr)xalloc(sizeof(RegionRec));
- Must_have_memory = FALSE; /* XXX */
+ if (!pReg)
+ return &miBrokenRegion;
if (rect)
{
pReg->extents = *rect;
@@ -355,7 +382,8 @@ miRegionDestroy(pReg)
{
good(pReg);
xfreeData(pReg);
- xfree(pReg);
+ if (pReg != &miBrokenRegion)
+ xfree(pReg);
}
void
@@ -367,21 +395,36 @@ miRegionUninit(pReg)
}
Bool
-miRectAlloc(pRgn, n)
- register RegionPtr pRgn;
- int n;
+miRegionBreak (pReg)
+ RegionPtr pReg;
{
- Must_have_memory = TRUE; /* XXX */
+ xfreeData (pReg);
+ pReg->extents = miEmptyBox;
+ pReg->data = &miBrokenData;
+ return FALSE;
+}
+
+Bool
+miRectAlloc(
+ register RegionPtr pRgn,
+ int n)
+{
+ RegDataPtr data;
+
if (!pRgn->data)
{
n++;
pRgn->data = xallocData(n);
+ if (!pRgn->data)
+ return miRegionBreak (pRgn);
pRgn->data->numRects = 1;
*REGION_BOXPTR(pRgn) = pRgn->extents;
}
else if (!pRgn->data->size)
{
pRgn->data = xallocData(n);
+ if (!pRgn->data)
+ return miRegionBreak (pRgn);
pRgn->data->numRects = 0;
}
else
@@ -393,9 +436,11 @@ miRectAlloc(pRgn, n)
n = 250;
}
n += pRgn->data->numRects;
- pRgn->data = (RegDataPtr)xrealloc(pRgn->data, REGION_SZOF(n));
+ data = (RegDataPtr)xrealloc(pRgn->data, REGION_SZOF(n));
+ if (!data)
+ return miRegionBreak (pRgn);
+ pRgn->data = data;
}
- Must_have_memory = FALSE; /* XXX */
pRgn->data->size = n;
return TRUE;
}
@@ -419,9 +464,9 @@ miRegionCopy(dst, src)
if (!dst->data || (dst->data->size < src->data->numRects))
{
xfreeData(dst);
- Must_have_memory = TRUE; /* XXX */
dst->data = xallocData(src->data->numRects);
- Must_have_memory = FALSE; /* XXX */
+ if (!dst->data)
+ return miRegionBreak (dst);
dst->data->size = src->data->numRects;
}
dst->data->numRects = src->data->numRects;
@@ -454,10 +499,10 @@ miRegionCopy(dst, src)
*-----------------------------------------------------------------------
*/
INLINE static int
-miCoalesce (pReg, prevStart, curStart)
- register RegionPtr pReg; /* Region to coalesce */
- int prevStart; /* Index of start of previous band */
- int curStart; /* Index of start of current band */
+miCoalesce (
+ register RegionPtr pReg, /* Region to coalesce */
+ int prevStart, /* Index of start of previous band */
+ int curStart) /* Index of start of current band */
{
register BoxPtr pPrevBox; /* Current box in previous band */
register BoxPtr pCurBox; /* Current box in current band */
@@ -538,12 +583,12 @@ miCoalesce (pReg, prevStart, curStart)
*/
INLINE static Bool
-miAppendNonO (pReg, r, rEnd, y1, y2)
- register RegionPtr pReg;
- register BoxPtr r;
- BoxPtr rEnd;
- register int y1;
- register int y2;
+miAppendNonO (
+ register RegionPtr pReg,
+ register BoxPtr r,
+ BoxPtr rEnd,
+ register int y1,
+ register int y2)
{
register BoxPtr pNextRect;
register int newRects;
@@ -578,7 +623,7 @@ miAppendNonO (pReg, r, rEnd, y1, y2)
#define AppendRegions(newReg, r, rEnd) \
{ \
int newRects; \
- if (newRects = rEnd - r) { \
+ if ((newRects = rEnd - r)) { \
RECTALLOC(newReg, newRects); \
memmove((char *)REGION_TOP(newReg),(char *)r, \
newRects * sizeof(BoxRec)); \
@@ -614,18 +659,29 @@ miAppendNonO (pReg, r, rEnd, y1, y2)
*
*-----------------------------------------------------------------------
*/
+
+typedef Bool (*OverlapProcPtr)(
+ RegionPtr pReg,
+ BoxPtr r1,
+ BoxPtr r1End,
+ BoxPtr r2,
+ BoxPtr r2End,
+ short y1,
+ short y2,
+ Bool *pOverlap);
+
static Bool
-miRegionOp(newReg, reg1, reg2, overlapFunc, appendNon1, appendNon2, pOverlap)
- RegionPtr newReg; /* Place to store result */
- RegionPtr reg1; /* First region in operation */
- RegionPtr reg2; /* 2d region in operation */
- Bool (*overlapFunc)(); /* Function to call for over-
+miRegionOp(
+ RegionPtr newReg, /* Place to store result */
+ RegionPtr reg1, /* First region in operation */
+ RegionPtr reg2, /* 2d region in operation */
+ OverlapProcPtr overlapFunc, /* Function to call for over-
* lapping bands */
- Bool appendNon1; /* Append non-overlapping bands */
+ Bool appendNon1, /* Append non-overlapping bands */
/* in region 1 ? */
- Bool appendNon2; /* Append non-overlapping bands */
+ Bool appendNon2, /* Append non-overlapping bands */
/* in region 2 ? */
- Bool *pOverlap;
+ Bool *pOverlap)
{
register BoxPtr r1; /* Pointer into first region */
register BoxPtr r2; /* Pointer into 2d region */
@@ -648,6 +704,12 @@ miRegionOp(newReg, reg1, reg2, overlapFunc, appendNon1, appendNon2, pOverlap)
int numRects;
/*
+ * Break any region computed from a broken region
+ */
+ if (REGION_NAR (reg1) || REGION_NAR(reg2))
+ return miRegionBreak (newReg);
+
+ /*
* Initialization:
* set r1, r2, r1End and r2End appropriately, save the rectangles
* of the destination region until the end in case it's one of
@@ -680,7 +742,8 @@ miRegionOp(newReg, reg1, reg2, overlapFunc, appendNon1, appendNon2, pOverlap)
else if (newReg->data->size)
newReg->data->numRects = 0;
if (newSize > newReg->data->size)
- miRectAlloc(newReg, newSize);
+ if (!miRectAlloc(newReg, newSize))
+ return FALSE;
/*
* Initialize ybot.
@@ -902,15 +965,15 @@ miSetExtents (pReg)
*/
/*ARGSUSED*/
static Bool
-miIntersectO (pReg, r1, r1End, r2, r2End, y1, y2, pOverlap)
- register RegionPtr pReg;
- register BoxPtr r1;
- BoxPtr r1End;
- register BoxPtr r2;
- BoxPtr r2End;
- short y1;
- short y2;
- Bool *pOverlap;
+miIntersectO (
+ register RegionPtr pReg,
+ register BoxPtr r1,
+ BoxPtr r1End,
+ register BoxPtr r2,
+ BoxPtr r2End,
+ short y1,
+ short y2,
+ Bool *pOverlap)
{
register int x1;
register int x2;
@@ -966,7 +1029,13 @@ miIntersect(newReg, reg1, reg2)
xfreeData(newReg);
newReg->extents.x2 = newReg->extents.x1;
newReg->extents.y2 = newReg->extents.y1;
- newReg->data = &miEmptyData;
+ if (REGION_NAR(reg1) || REGION_NAR(reg2))
+ {
+ newReg->data = &miBrokenData;
+ return FALSE;
+ }
+ else
+ newReg->data = &miEmptyData;
}
else if (!reg1->data && !reg2->data)
{
@@ -1039,15 +1108,15 @@ miIntersect(newReg, reg1, reg2)
*-----------------------------------------------------------------------
*/
static Bool
-miUnionO (pReg, r1, r1End, r2, r2End, y1, y2, pOverlap)
- register RegionPtr pReg;
- register BoxPtr r1;
- BoxPtr r1End;
- register BoxPtr r2;
- BoxPtr r2End;
- short y1;
- short y2;
- Bool *pOverlap;
+miUnionO (
+ register RegionPtr pReg,
+ register BoxPtr r1,
+ BoxPtr r1End,
+ register BoxPtr r2,
+ BoxPtr r2End,
+ short y1,
+ short y2,
+ Bool *pOverlap)
{
register BoxPtr pNextRect;
register int x1; /* left and right side of current union */
@@ -1125,6 +1194,8 @@ miUnion(newReg, reg1, reg2)
*/
if (REGION_NIL(reg1))
{
+ if (REGION_NAR(reg1))
+ return miRegionBreak (newReg);
if (newReg != reg2)
return miRegionCopy(newReg, reg2);
return TRUE;
@@ -1135,6 +1206,8 @@ miUnion(newReg, reg1, reg2)
*/
if (REGION_NIL(reg2))
{
+ if (REGION_NAR(reg2))
+ return miRegionBreak (newReg);
if (newReg != reg1)
return miRegionCopy(newReg, reg1);
return TRUE;
@@ -1202,6 +1275,9 @@ miRegionAppend(dstrgn, rgn)
BoxPtr new, old;
Bool prepend;
+ if (REGION_NAR(rgn))
+ return miRegionBreak (dstrgn);
+
if (!rgn->data && (dstrgn->data == &miEmptyData))
{
dstrgn->extents = rgn->extents;
@@ -1286,9 +1362,9 @@ miRegionAppend(dstrgn, rgn)
}
static void
-QuickSortRects(rects, numRects)
- register BoxRec rects[];
- register int numRects;
+QuickSortRects(
+ register BoxRec rects[],
+ register int numRects)
{
register int y1;
register int x1;
@@ -1399,6 +1475,7 @@ miRegionValidate(badreg, pOverlap)
register BoxPtr box; /* Current box in rects */
register BoxPtr riBox; /* Last box in ri[j].reg */
register RegionPtr hreg; /* ri[j_half].reg */
+ Bool ret = TRUE;
*pOverlap = FALSE;
if (!badreg->data)
@@ -1409,6 +1486,8 @@ miRegionValidate(badreg, pOverlap)
numRects = badreg->data->numRects;
if (!numRects)
{
+ if (REGION_NAR(badreg))
+ return FALSE;
good(badreg);
return TRUE;
}
@@ -1434,9 +1513,9 @@ miRegionValidate(badreg, pOverlap)
/* Set up the first region to be the first rectangle in badreg */
/* Note that step 2 code will never overflow the ri[0].reg rects array */
- Must_have_memory = TRUE; /* XXX */
ri = (RegionInfo *) xalloc(4 * sizeof(RegionInfo));
- Must_have_memory = FALSE; /* XXX */
+ if (!ri)
+ return miRegionBreak (badreg);
sizeRI = 4;
numRI = 1;
ri[0].prevBand = 0;
@@ -1472,7 +1551,7 @@ miRegionValidate(badreg, pOverlap)
}
else
{
- RECTALLOC(reg, 1);
+ RECTALLOC_BAIL(reg, 1, bail);
*REGION_TOP(reg) = *box;
reg->data->numRects++;
}
@@ -1485,7 +1564,7 @@ miRegionValidate(badreg, pOverlap)
if (reg->extents.x1 > box->x1) reg->extents.x1 = box->x1;
Coalesce(reg, rit->prevBand, rit->curBand);
rit->curBand = reg->data->numRects;
- RECTALLOC(reg, 1);
+ RECTALLOC_BAIL(reg, 1, bail);
*REGION_TOP(reg) = *box;
reg->data->numRects++;
goto NextRect;
@@ -1498,9 +1577,10 @@ miRegionValidate(badreg, pOverlap)
{
/* Oops, allocate space for new region information */
sizeRI <<= 1;
- Must_have_memory = TRUE; /* XXX */
- ri = (RegionInfo *) xrealloc(ri, sizeRI * sizeof(RegionInfo));
- Must_have_memory = FALSE; /* XXX */
+ rit = (RegionInfo *) xrealloc(ri, sizeRI * sizeof(RegionInfo));
+ if (!rit)
+ goto bail;
+ ri = rit;
rit = &ri[numRI];
}
numRI++;
@@ -1508,7 +1588,8 @@ miRegionValidate(badreg, pOverlap)
rit->curBand = 0;
rit->reg.extents = *box;
rit->reg.data = (RegDataPtr)NULL;
- miRectAlloc(&rit->reg, (i+numRI) / numRI); /* MUST force allocation */
+ if (!miRectAlloc(&rit->reg, (i+numRI) / numRI)) /* MUST force allocation */
+ goto bail;
NextRect: ;
} /* for i */
@@ -1537,7 +1618,8 @@ NextRect: ;
{
reg = &ri[j].reg;
hreg = &ri[j+half].reg;
- miRegionOp(reg, reg, hreg, miUnionO, TRUE, TRUE, pOverlap);
+ if (!miRegionOp(reg, reg, hreg, miUnionO, TRUE, TRUE, pOverlap))
+ ret = FALSE;
if (hreg->extents.x1 < reg->extents.x1)
reg->extents.x1 = hreg->extents.x1;
if (hreg->extents.y1 < reg->extents.y1)
@@ -1553,7 +1635,12 @@ NextRect: ;
*badreg = ri[0].reg;
xfree(ri);
good(badreg);
- return TRUE;
+ return ret;
+bail:
+ for (i = 0; i < numRI; i++)
+ xfreeData(&ri[i].reg);
+ xfree (ri);
+ return miRegionBreak (badreg);
}
RegionPtr
@@ -1569,6 +1656,8 @@ miRectsToRegion(nrects, prect, ctype)
int x1, y1, x2, y2;
pRgn = miRegionCreate(NullBox, 0);
+ if (REGION_NAR (pRgn))
+ return pRgn;
if (!nrects)
return pRgn;
if (nrects == 1)
@@ -1589,10 +1678,13 @@ miRectsToRegion(nrects, prect, ctype)
}
return pRgn;
}
- Must_have_memory = TRUE; /* XXX */
pData = xallocData(nrects);
+ if (!pData)
+ {
+ miRegionBreak (pRgn);
+ return pRgn;
+ }
pBox = (BoxPtr) (pData + 1);
- Must_have_memory = FALSE; /* XXX */
for (i = nrects; --i >= 0; prect++)
{
x1 = prect->x;
@@ -1653,15 +1745,15 @@ miRectsToRegion(nrects, prect, ctype)
*/
/*ARGSUSED*/
static Bool
-miSubtractO (pReg, r1, r1End, r2, r2End, y1, y2, pOverlap)
- register RegionPtr pReg;
- register BoxPtr r1;
- BoxPtr r1End;
- register BoxPtr r2;
- BoxPtr r2End;
- register int y1;
- int y2;
- Bool *pOverlap;
+miSubtractO (
+ register RegionPtr pReg,
+ register BoxPtr r1,
+ BoxPtr r1End,
+ register BoxPtr r2,
+ BoxPtr r2End,
+ register short y1,
+ short y2,
+ Bool *pOverlap)
{
register BoxPtr pNextRect;
register int x1;
@@ -1791,6 +1883,8 @@ miSubtract(regD, regM, regS)
if (REGION_NIL(regM) || REGION_NIL(regS) ||
!EXTENTCHECK(&regM->extents, &regS->extents))
{
+ if (REGION_NAR (regS))
+ return miRegionBreak (regD);
return miRegionCopy(regD, regM);
}
else if (regM == regS)
@@ -1854,6 +1948,8 @@ miInverse(newReg, reg1, invRect)
/* check for trivial rejects */
if (REGION_NIL(reg1) || !EXTENTCHECK(invRect, &reg1->extents))
{
+ if (REGION_NAR(reg1))
+ return miRegionBreak (newReg);
newReg->extents = *invRect;
xfreeData(newReg);
newReg->data = (RegDataPtr)NULL;
@@ -2078,6 +2174,35 @@ miTranslateRegion(pReg, x, y)
}
}
+Bool
+miRegionDataCopy(
+ register RegionPtr dst,
+ register RegionPtr src)
+{
+ good(dst);
+ good(src);
+ if (dst->data)
+ return TRUE;
+ if (dst == src)
+ return TRUE;
+ if (!src->data || !src->data->size)
+ {
+ xfreeData(dst);
+ dst->data = (RegDataPtr)NULL;
+ return TRUE;
+ }
+ if (!dst->data || (dst->data->size < src->data->numRects))
+ {
+ xfreeData(dst);
+ dst->data = xallocData(src->data->numRects);
+ if (!dst->data)
+ return miRegionBreak (dst);
+ }
+ dst->data->size = src->data->size;
+ dst->data->numRects = src->data->numRects;
+ return TRUE;
+}
+
void
miRegionReset(pReg, pBox)
RegionPtr pReg;
@@ -2133,6 +2258,12 @@ miRegionNotEmpty(pReg)
return(!REGION_NIL(pReg));
}
+Bool
+miRegionBroken(RegionPtr pReg)
+{
+ good(pReg);
+ return (REGION_NAR(pReg));
+}
void
miRegionEmpty(pReg)
@@ -2167,10 +2298,10 @@ miRegionExtents(pReg)
so forget it.
*/
-static void QuickSortSpans(spans, widths, numSpans)
- register DDXPointRec spans[];
- register int widths[];
- register int numSpans;
+static void QuickSortSpans(
+ register DDXPointRec spans[],
+ register int widths[],
+ register int numSpans)
{
register int y;
register int i, j, m;
@@ -2272,14 +2403,14 @@ static void QuickSortSpans(spans, widths, numSpans)
*/
int
-miClipSpans(prgnDst, ppt, pwidth, nspans, pptNew, pwidthNew, fSorted)
- RegionPtr prgnDst;
- register DDXPointPtr ppt;
- register int *pwidth;
- int nspans;
- register DDXPointPtr pptNew;
- int *pwidthNew;
- int fSorted;
+miClipSpans(
+ RegionPtr prgnDst,
+ register DDXPointPtr ppt,
+ register int *pwidth,
+ int nspans,
+ register DDXPointPtr pptNew,
+ int *pwidthNew,
+ int fSorted)
{
register DDXPointPtr pptLast;
int *pwidthNewStart; /* the vengeance of Xerox! */
@@ -2325,7 +2456,7 @@ miClipSpans(prgnDst, ppt, pwidth, nspans, pptNew, pwidthNew, fSorted)
} /* end for */
}
- else if (numRects = prgnDst->data->numRects)
+ else if ((numRects = prgnDst->data->numRects))
{
/* Have to clip against many boxes */
BoxPtr pboxBandStart, pboxBandEnd;
diff --git a/mi/miscrinit.c b/mi/miscrinit.c
index 1561c1844..ee199d24d 100644
--- a/mi/miscrinit.c
+++ b/mi/miscrinit.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/miscrinit.c,v 3.15 2001/12/14 20:00:26 dawes Exp $ */
#include "X.h"
#include "servermd.h"
@@ -33,9 +34,12 @@ from The Open Group.
#include "mi.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
-#include "mibstore.h"
#include "dix.h"
#include "miline.h"
+#ifdef MITSHM
+#define _XSHM_SERVER_
+#include "XShm.h"
+#endif
/* We use this structure to propogate some information from miScreenInit to
* miCreateScreenResources. miScreenInit allocates the structure, fills it
@@ -67,25 +71,64 @@ miModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel, devKind,
{
if (!pPixmap)
return FALSE;
- pPixmap->drawable.depth = depth;
- pPixmap->drawable.bitsPerPixel = bitsPerPixel;
- pPixmap->drawable.id = 0;
- pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- pPixmap->drawable.x = 0;
- pPixmap->drawable.y = 0;
- pPixmap->drawable.width = width;
- pPixmap->drawable.height = height;
- pPixmap->devKind = devKind;
- pPixmap->refcnt = 1;
- pPixmap->devPrivate.ptr = pPixData;
+
+ /*
+ * If all arguments are specified, reinitialize everything (including
+ * validated state).
+ */
+ if ((width > 0) && (height > 0) && (depth > 0) && (bitsPerPixel > 0) &&
+ (devKind > 0) && pPixData) {
+ pPixmap->drawable.depth = depth;
+ pPixmap->drawable.bitsPerPixel = bitsPerPixel;
+ pPixmap->drawable.id = 0;
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pPixmap->drawable.x = 0;
+ pPixmap->drawable.y = 0;
+ pPixmap->drawable.width = width;
+ pPixmap->drawable.height = height;
+ pPixmap->devKind = devKind;
+ pPixmap->refcnt = 1;
+ pPixmap->devPrivate.ptr = pPixData;
+ } else {
+ /*
+ * Only modify specified fields, keeping all others intact.
+ */
+
+ if (width > 0)
+ pPixmap->drawable.width = width;
+
+ if (height > 0)
+ pPixmap->drawable.height = height;
+
+ if (depth > 0)
+ pPixmap->drawable.depth = depth;
+
+ if (bitsPerPixel > 0)
+ pPixmap->drawable.bitsPerPixel = bitsPerPixel;
+ else if ((bitsPerPixel < 0) && (depth > 0))
+ pPixmap->drawable.bitsPerPixel = BitsPerPixel(depth);
+
+ /*
+ * CAVEAT: Non-SI DDXen may use devKind and devPrivate fields for
+ * other purposes.
+ */
+ if (devKind > 0)
+ pPixmap->devKind = devKind;
+ else if ((devKind < 0) && ((width > 0) || (depth > 0)))
+ pPixmap->devKind = PixmapBytePad(pPixmap->drawable.width,
+ pPixmap->drawable.depth);
+
+ if (pPixData)
+ pPixmap->devPrivate.ptr = pPixData;
+ }
return TRUE;
}
/*ARGSUSED*/
Bool
-miCloseScreen (index, pScreen)
- int index;
+miCloseScreen (iScreen, pScreen)
+ int iScreen;
ScreenPtr pScreen;
{
return ((*pScreen->DestroyPixmap)((PixmapPtr)pScreen->devPrivate));
@@ -122,7 +165,8 @@ miCreateScreenResources(pScreen)
return FALSE;
if (!(*pScreen->ModifyPixmapHeader)(pPixmap, pScreen->width,
- pScreen->height, pScreen->rootDepth, pScreen->rootDepth,
+ pScreen->height, pScreen->rootDepth,
+ BitsPerPixel(pScreen->rootDepth),
PixmapBytePad(pScrInitParms->width, pScreen->rootDepth),
pScrInitParms->pbits))
return FALSE;
@@ -158,16 +202,9 @@ miScreenDevPrivateInit(pScreen, width, pbits)
return TRUE;
}
-/*
- * If you pass in bsfuncs, then you must preinitialize the missing
- * screen procs before calling miScreenInit, so that the backing store
- * code can correctly wrap them.
- */
-
Bool
miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
- rootDepth, numDepths, depths, rootVisual, numVisuals, visuals,
- bsfuncs)
+ rootDepth, numDepths, depths, rootVisual, numVisuals, visuals)
register ScreenPtr pScreen;
pointer pbits; /* pointer to screen bits */
int xsize, ysize; /* in pixels */
@@ -179,7 +216,6 @@ miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
VisualID rootVisual; /* root visual */
int numVisuals; /* number of visuals supported */
VisualRec *visuals; /* supported visuals */
- miBSFuncPtr bsfuncs; /* backing store functions */
{
pScreen->width = xsize;
pScreen->height = ysize;
@@ -192,11 +228,13 @@ miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
/* defColormap */
pScreen->minInstalledCmaps = 1;
pScreen->maxInstalledCmaps = 1;
- pScreen->backingStoreSupport = Always;
+ pScreen->backingStoreSupport = NotUseful;
pScreen->saveUnderSupport = NotUseful;
/* whitePixel, blackPixel */
pScreen->ModifyPixmapHeader = miModifyPixmapHeader;
pScreen->CreateScreenResources = miCreateScreenResources;
+ pScreen->GetScreenPixmap = miGetScreenPixmap;
+ pScreen->SetScreenPixmap = miSetScreenPixmap;
pScreen->numVisuals = numVisuals;
pScreen->visuals = visuals;
if (width)
@@ -208,21 +246,23 @@ miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
}
/* else CloseScreen */
/* QueryBestSize, SaveScreen, GetImage, GetSpans */
- pScreen->PointerNonInterestBox = (void (*)()) 0;
- pScreen->SourceValidate = (void (*)()) 0;
+ pScreen->PointerNonInterestBox = (PointerNonInterestBoxProcPtr) 0;
+ pScreen->SourceValidate = (SourceValidateProcPtr) 0;
/* CreateWindow, DestroyWindow, PositionWindow, ChangeWindowAttributes */
/* RealizeWindow, UnrealizeWindow */
pScreen->ValidateTree = miValidateTree;
- pScreen->PostValidateTree = (void (*)()) 0;
+ pScreen->PostValidateTree = (PostValidateTreeProcPtr) 0;
pScreen->WindowExposures = miWindowExposures;
/* PaintWindowBackground, PaintWindowBorder, CopyWindow */
pScreen->ClearToBackground = miClearToBackground;
- pScreen->ClipNotify = (void (*)()) 0;
+ pScreen->ClipNotify = (ClipNotifyProcPtr) 0;
+ pScreen->RestackWindow = (RestackWindowProcPtr) 0;
/* CreatePixmap, DestroyPixmap */
/* RealizeFont, UnrealizeFont */
/* CreateGC */
/* CreateColormap, DestroyColormap, InstallColormap, UninstallColormap */
/* ListInstalledColormaps, StoreColors, ResolveColor */
+#ifdef NEED_SCREEN_REGIONS
pScreen->RegionCreate = miRegionCreate;
pScreen->RegionInit = miRegionInit;
pScreen->RegionCopy = miRegionCopy;
@@ -237,19 +277,22 @@ miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
pScreen->RectIn = miRectIn;
pScreen->PointInRegion = miPointInRegion;
pScreen->RegionNotEmpty = miRegionNotEmpty;
+ pScreen->RegionBroken = miRegionBroken;
+ pScreen->RegionBreak = miRegionBreak;
pScreen->RegionEmpty = miRegionEmpty;
pScreen->RegionExtents = miRegionExtents;
pScreen->RegionAppend = miRegionAppend;
pScreen->RegionValidate = miRegionValidate;
+#endif /* NEED_SCREEN_REGIONS */
/* BitmapToRegion */
+#ifdef NEED_SCREEN_REGIONS
pScreen->RectsToRegion = miRectsToRegion;
+#endif /* NEED_SCREEN_REGIONS */
pScreen->SendGraphicsExpose = miSendGraphicsExpose;
- pScreen->BlockHandler = (void (*)())NoopDDA;
- pScreen->WakeupHandler = (void (*)())NoopDDA;
+ pScreen->BlockHandler = (ScreenBlockHandlerProcPtr)NoopDDA;
+ pScreen->WakeupHandler = (ScreenWakeupHandlerProcPtr)NoopDDA;
pScreen->blockData = (pointer)0;
pScreen->wakeupData = (pointer)0;
- if (bsfuncs)
- miInitializeBackingStore (pScreen, bsfuncs);
pScreen->MarkWindow = miMarkWindow;
pScreen->MarkOverlappedWindows = miMarkOverlappedWindows;
pScreen->ChangeSaveUnder = miChangeSaveUnder;
@@ -258,20 +301,41 @@ miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
pScreen->ResizeWindow = miSlideAndSizeWindow;
pScreen->GetLayerWindow = miGetLayerWindow;
pScreen->HandleExposures = miHandleValidateExposures;
- pScreen->ReparentWindow = (void (*)())0;
+ pScreen->ReparentWindow = (ReparentWindowProcPtr) 0;
pScreen->ChangeBorderWidth = miChangeBorderWidth;
#ifdef SHAPE
pScreen->SetShape = miSetShape;
#endif
pScreen->MarkUnrealizedWindow = miMarkUnrealizedWindow;
+ pScreen->SaveDoomedAreas = 0;
+ pScreen->RestoreAreas = 0;
+ pScreen->ExposeCopy = 0;
+ pScreen->TranslateBackingStore = 0;
+ pScreen->ClearBackingStore = 0;
+ pScreen->DrawGuarantee = 0;
+
miSetZeroLineBias(pScreen, DEFAULTZEROLINEBIAS);
return miScreenDevPrivateInit(pScreen, width, pbits);
}
+int
+miAllocateGCPrivateIndex()
+{
+ static int privateIndex = -1;
+ static unsigned long miGeneration = 0;
+
+ if (miGeneration != serverGeneration)
+ {
+ privateIndex = AllocateGCPrivateIndex();
+ miGeneration = serverGeneration;
+ }
+ return privateIndex;
+}
+
int miZeroLineScreenIndex;
-int miZeroLineGeneration;
+unsigned int miZeroLineGeneration = 0;
void
miSetZeroLineBias(pScreen, bias)
@@ -286,3 +350,18 @@ miSetZeroLineBias(pScreen, bias)
if (miZeroLineScreenIndex >= 0)
pScreen->devPrivates[miZeroLineScreenIndex].uval = bias;
}
+
+PixmapPtr
+miGetScreenPixmap(pScreen)
+ ScreenPtr pScreen;
+{
+ return (PixmapPtr)(pScreen->devPrivate);
+}
+
+void
+miSetScreenPixmap(pPix)
+ PixmapPtr pPix;
+{
+ if (pPix)
+ pPix->drawable.pScreen->devPrivate = (pointer)pPix;
+}
diff --git a/mi/mispans.c b/mi/mispans.c
index 562b843ce..81fa45da7 100644
--- a/mi/mispans.c
+++ b/mi/mispans.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mispans.c,v 3.4 2001/12/14 20:00:26 dawes Exp $ */
/***********************************************************
Copyright 1989, 1998 The Open Group
@@ -222,10 +223,10 @@ void miFreeSpanGroup(spanGroup)
if (spanGroup->group != NULL) xfree(spanGroup->group);
}
-static void QuickSortSpansX(points, widths, numSpans)
- register DDXPointRec points[];
- register int widths[];
- register int numSpans;
+static void QuickSortSpansX(
+ register DDXPointRec points[],
+ register int widths[],
+ register int numSpans )
{
register int x;
register int i, j, m;
@@ -309,10 +310,10 @@ static void QuickSortSpansX(points, widths, numSpans)
} /* QuickSortSpans */
-static int UniquifySpansX(spans, newPoints, newWidths)
- Spans *spans;
- register DDXPointRec *newPoints;
- register int *newWidths;
+static int UniquifySpansX(
+ Spans *spans,
+ register DDXPointRec *newPoints,
+ register int *newWidths )
{
register int newx1, newx2, oldpt, i, y;
register DDXPointRec *oldPoints;
@@ -418,8 +419,10 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup)
if (!yspans || !ysizes)
{
- xfree (yspans);
- xfree (ysizes);
+ if (yspans)
+ xfree (yspans);
+ if (ysizes)
+ xfree (ysizes);
miDisposeSpanGroup (spanGroup);
return;
}
@@ -496,10 +499,12 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup)
xfree (yspans[i].points);
xfree (yspans[i].widths);
}
- xfree (points);
- xfree (widths);
xfree (yspans);
xfree (ysizes);
+ if (points)
+ xfree (points);
+ if (widths)
+ xfree (widths);
return;
}
count = 0;
@@ -524,7 +529,7 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup)
xfree(points);
xfree(widths);
xfree(yspans);
- xfree(ysizes);
+ xfree(ysizes); /* use (DE)ALLOCATE_LOCAL for these? */
}
spanGroup->count = 0;
diff --git a/mi/mispans.h b/mi/mispans.h
index 3750d2add..5ae2d014a 100644
--- a/mi/mispans.h
+++ b/mi/mispans.h
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mispans.h,v 1.3 2001/12/14 20:00:26 dawes Exp $ */
/***********************************************************
Copyright 1989, 1998 The Open Group
@@ -62,60 +63,45 @@ typedef struct {
/* Initialize SpanGroup. MUST BE DONE before use. */
extern void miInitSpanGroup(
-#if NeedFunctionPrototypes
SpanGroup * /*spanGroup*/
-#endif
);
/* Add a Spans to a SpanGroup. The spans MUST BE in y-sorted order */
extern void miAppendSpans(
-#if NeedFunctionPrototypes
SpanGroup * /*spanGroup*/,
SpanGroup * /*otherGroup*/,
Spans * /*spans*/
-#endif
);
/* Paint a span group, possibly with some overlap */
extern void miFillSpanGroup(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
SpanGroup * /*spanGroup*/
-#endif
);
/* Paint a span group, insuring that each pixel is painted at most once */
extern void miFillUniqueSpanGroup(
-#if NeedFunctionPrototypes
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
SpanGroup * /*spanGroup*/
-#endif
);
/* Free up data in a span group. MUST BE DONE or you'll suffer memory leaks */
extern void miFreeSpanGroup(
-#if NeedFunctionPrototypes
SpanGroup * /*spanGroup*/
-#endif
);
extern void miSubtractSpans(
-#if NeedFunctionPrototypes
SpanGroup * /*spanGroup*/,
Spans * /*sub*/
-#endif
);
extern void miDisposeSpanGroup(
-#if NeedFunctionPrototypes
SpanGroup * /*spanGroup*/
-#endif
);
extern int miClipSpans(
-#if NeedFunctionPrototypes
RegionPtr /*prgnDst*/,
DDXPointPtr /*ppt*/,
int * /*pwidth*/,
@@ -123,7 +109,6 @@ extern int miClipSpans(
DDXPointPtr /*pptNew*/,
int * /*pwidthNew*/,
int /*fSorted*/
-#endif
);
/* Rops which must use span groups */
diff --git a/mi/misprite.c b/mi/misprite.c
index 2fc6da8dd..d323f1168 100644
--- a/mi/misprite.c
+++ b/mi/misprite.c
@@ -30,6 +30,7 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/misprite.c,v 3.11 2002/12/09 04:10:58 tsi Exp $ */
# include "X.h"
# include "Xproto.h"
@@ -47,6 +48,9 @@ in this Software without prior written authorization from The Open Group.
# include "mispritest.h"
# include "dixfontstr.h"
# include "fontstruct.h"
+#ifdef RENDER
+# include "mipict.h"
+#endif
/*
* screen wrappers
@@ -55,23 +59,63 @@ in this Software without prior written authorization from The Open Group.
static int miSpriteScreenIndex;
static unsigned long miSpriteGeneration = 0;
-static Bool miSpriteCloseScreen();
-static void miSpriteGetImage();
-static void miSpriteGetSpans();
-static void miSpriteSourceValidate();
-static Bool miSpriteCreateGC();
-static void miSpriteBlockHandler();
-static void miSpriteInstallColormap();
-static void miSpriteStoreColors();
-
-static void miSpritePaintWindowBackground();
-static void miSpritePaintWindowBorder();
-static void miSpriteCopyWindow();
-static void miSpriteClearToBackground();
+static Bool miSpriteCloseScreen(int i, ScreenPtr pScreen);
+static void miSpriteGetImage(DrawablePtr pDrawable, int sx, int sy,
+ int w, int h, unsigned int format,
+ unsigned long planemask, char *pdstLine);
+static void miSpriteGetSpans(DrawablePtr pDrawable, int wMax,
+ DDXPointPtr ppt, int *pwidth, int nspans,
+ char *pdstStart);
+static void miSpriteSourceValidate(DrawablePtr pDrawable, int x, int y,
+ int width, int height);
+static Bool miSpriteCreateGC(GCPtr pGC);
+static void miSpriteBlockHandler(int i, pointer blockData,
+ pointer pTimeout,
+ pointer pReadMask);
+static void miSpriteInstallColormap(ColormapPtr pMap);
+static void miSpriteStoreColors(ColormapPtr pMap, int ndef,
+ xColorItem *pdef);
+
+static void miSpritePaintWindowBackground(WindowPtr pWin,
+ RegionPtr pRegion, int what);
+static void miSpritePaintWindowBorder(WindowPtr pWin,
+ RegionPtr pRegion, int what);
+static void miSpriteCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
+ RegionPtr pRegion);
+static void miSpriteClearToBackground(WindowPtr pWin, int x, int y,
+ int w, int h,
+ Bool generateExposures);
+
+#ifdef RENDER
+static void miSpriteComposite(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height);
+
+static void miSpriteGlyphs(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int nlist,
+ GlyphListPtr list,
+ GlyphPtr *glyphs);
+#endif
-static void miSpriteSaveDoomedAreas();
-static RegionPtr miSpriteRestoreAreas();
-static void miSpriteComputeSaved();
+static void miSpriteSaveDoomedAreas(WindowPtr pWin,
+ RegionPtr pObscured, int dx,
+ int dy);
+static RegionPtr miSpriteRestoreAreas(WindowPtr pWin, RegionPtr pRgnExposed);
+static void miSpriteComputeSaved(ScreenPtr pScreen);
#define SCREEN_PROLOGUE(pScreen, field)\
((pScreen)->field = \
@@ -86,10 +130,14 @@ static void miSpriteComputeSaved();
static int miSpriteGCIndex;
-static void miSpriteValidateGC (), miSpriteCopyGC ();
-static void miSpriteDestroyGC(), miSpriteChangeGC();
-static void miSpriteChangeClip(), miSpriteDestroyClip();
-static void miSpriteCopyClip();
+static void miSpriteValidateGC(GCPtr pGC, unsigned long stateChanges,
+ DrawablePtr pDrawable);
+static void miSpriteCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
+static void miSpriteDestroyGC(GCPtr pGC);
+static void miSpriteChangeGC(GCPtr pGC, unsigned long mask);
+static void miSpriteChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
+static void miSpriteDestroyClip(GCPtr pGC);
+static void miSpriteCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
static GCFuncs miSpriteGCFuncs = {
miSpriteValidateGC,
@@ -121,19 +169,62 @@ static GCFuncs miSpriteGCFuncs = {
* GC op wrappers
*/
-static void miSpriteFillSpans(), miSpriteSetSpans();
-static void miSpritePutImage();
-static RegionPtr miSpriteCopyArea(), miSpriteCopyPlane();
-static void miSpritePolyPoint(), miSpritePolylines();
-static void miSpritePolySegment(), miSpritePolyRectangle();
-static void miSpritePolyArc(), miSpriteFillPolygon();
-static void miSpritePolyFillRect(), miSpritePolyFillArc();
-static int miSpritePolyText8(), miSpritePolyText16();
-static void miSpriteImageText8(), miSpriteImageText16();
-static void miSpriteImageGlyphBlt(), miSpritePolyGlyphBlt();
-static void miSpritePushPixels();
+static void miSpriteFillSpans(DrawablePtr pDrawable, GCPtr pGC,
+ int nInit, DDXPointPtr pptInit,
+ int *pwidthInit, int fSorted);
+static void miSpriteSetSpans(DrawablePtr pDrawable, GCPtr pGC,
+ char *psrc, DDXPointPtr ppt, int *pwidth,
+ int nspans, int fSorted);
+static void miSpritePutImage(DrawablePtr pDrawable, GCPtr pGC,
+ int depth, int x, int y, int w, int h,
+ int leftPad, int format, char *pBits);
+static RegionPtr miSpriteCopyArea(DrawablePtr pSrc, DrawablePtr pDst,
+ GCPtr pGC, int srcx, int srcy, int w,
+ int h, int dstx, int dsty);
+static RegionPtr miSpriteCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
+ GCPtr pGC, int srcx, int srcy, int w,
+ int h, int dstx, int dsty,
+ unsigned long plane);
+static void miSpritePolyPoint(DrawablePtr pDrawable, GCPtr pGC,
+ int mode, int npt, xPoint *pptInit);
+static void miSpritePolylines(DrawablePtr pDrawable, GCPtr pGC,
+ int mode, int npt, DDXPointPtr pptInit);
+static void miSpritePolySegment(DrawablePtr pDrawable, GCPtr pGC,
+ int nseg, xSegment *pSegs);
+static void miSpritePolyRectangle(DrawablePtr pDrawable, GCPtr pGC,
+ int nrects, xRectangle *pRects);
+static void miSpritePolyArc(DrawablePtr pDrawable, GCPtr pGC,
+ int narcs, xArc *parcs);
+static void miSpriteFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
+ int shape, int mode, int count,
+ DDXPointPtr pPts);
+static void miSpritePolyFillRect(DrawablePtr pDrawable, GCPtr pGC,
+ int nrectFill, xRectangle *prectInit);
+static void miSpritePolyFillArc(DrawablePtr pDrawable, GCPtr pGC,
+ int narcs, xArc *parcs);
+static int miSpritePolyText8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars);
+static int miSpritePolyText16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count,
+ unsigned short *chars);
+static void miSpriteImageText8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars);
+static void miSpriteImageText16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count,
+ unsigned short *chars);
+static void miSpriteImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase);
+static void miSpritePolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase);
+static void miSpritePushPixels(GCPtr pGC, PixmapPtr pBitMap,
+ DrawablePtr pDst, int w, int h,
+ int x, int y);
#ifdef NEED_LINEHELPER
-static void miSpriteLineHelper();
+static void miSpriteLineHelper(void);
#endif
static GCOps miSpriteGCOps = {
@@ -174,7 +265,7 @@ static GCOps miSpriteGCOps = {
(pScreenPriv->isUp && \
(pScreenPriv->pCacheWin == pWin ? \
pScreenPriv->isInCacheWin : ( \
- ((int) (pScreenPriv->pCacheWin = (pWin))) , \
+ (pScreenPriv->pCacheWin = (pWin)), \
(pScreenPriv->isInCacheWin = \
(pWin)->drawable.x < pScreenPriv->saved.x2 && \
pScreenPriv->saved.x1 < (pWin)->drawable.x + \
@@ -200,8 +291,11 @@ static GCOps miSpriteGCOps = {
* pointer-sprite method table
*/
-static Bool miSpriteRealizeCursor (), miSpriteUnrealizeCursor ();
-static void miSpriteSetCursor (), miSpriteMoveCursor ();
+static Bool miSpriteRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
+static Bool miSpriteUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
+static void miSpriteSetCursor(ScreenPtr pScreen, CursorPtr pCursor,
+ int x, int y);
+static void miSpriteMoveCursor(ScreenPtr pScreen, int x, int y);
miPointerSpriteFuncRec miSpritePointerFuncs = {
miSpriteRealizeCursor,
@@ -214,7 +308,8 @@ miPointerSpriteFuncRec miSpritePointerFuncs = {
* other misc functions
*/
-static void miSpriteRemoveCursor (), miSpriteRestoreCursor();
+static void miSpriteRemoveCursor(ScreenPtr pScreen);
+static void miSpriteRestoreCursor(ScreenPtr pScreen);
/*
* miSpriteInitialize -- called from device-dependent screen
@@ -230,6 +325,9 @@ miSpriteInitialize (pScreen, cursorFuncs, screenFuncs)
{
miSpriteScreenPtr pPriv;
VisualPtr pVisual;
+#ifdef RENDER
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+#endif
if (miSpriteGeneration != serverGeneration)
{
@@ -270,7 +368,14 @@ miSpriteInitialize (pScreen, cursorFuncs, screenFuncs)
pPriv->SaveDoomedAreas = pScreen->SaveDoomedAreas;
pPriv->RestoreAreas = pScreen->RestoreAreas;
-
+#ifdef RENDER
+ if (ps)
+ {
+ pPriv->Composite = ps->Composite;
+ pPriv->Glyphs = ps->Glyphs;
+ }
+#endif
+
pPriv->pCursor = NULL;
pPriv->x = 0;
pPriv->y = 0;
@@ -305,6 +410,13 @@ miSpriteInitialize (pScreen, cursorFuncs, screenFuncs)
pScreen->SaveDoomedAreas = miSpriteSaveDoomedAreas;
pScreen->RestoreAreas = miSpriteRestoreAreas;
+#ifdef RENDER
+ if (ps)
+ {
+ ps->Composite = miSpriteComposite;
+ ps->Glyphs = miSpriteGlyphs;
+ }
+#endif
return TRUE;
}
@@ -320,9 +432,13 @@ miSpriteInitialize (pScreen, cursorFuncs, screenFuncs)
static Bool
miSpriteCloseScreen (i, pScreen)
+ int i;
ScreenPtr pScreen;
{
miSpriteScreenPtr pScreenPriv;
+#ifdef RENDER
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+#endif
pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
@@ -342,7 +458,13 @@ miSpriteCloseScreen (i, pScreen)
pScreen->SaveDoomedAreas = pScreenPriv->SaveDoomedAreas;
pScreen->RestoreAreas = pScreenPriv->RestoreAreas;
-
+#ifdef RENDER
+ if (ps)
+ {
+ ps->Composite = pScreenPriv->Composite;
+ ps->Glyphs = pScreenPriv->Glyphs;
+ }
+#endif
xfree ((pointer) pScreenPriv);
return (*pScreen->CloseScreen) (i, pScreen);
@@ -473,7 +595,7 @@ static void
miSpriteBlockHandler (i, blockData, pTimeout, pReadmask)
int i;
pointer blockData;
- OSTimePtr pTimeout;
+ pointer pTimeout;
pointer pReadmask;
{
ScreenPtr pScreen = screenInfo.screens[i];
@@ -543,7 +665,7 @@ miSpriteStoreColors (pMap, ndef, pdef)
{
/* Direct color - match on any of the subfields */
-#define MaskMatch(a,b,mask) ((a) & (pVisual->mask) == (b) & (pVisual->mask))
+#define MaskMatch(a,b,mask) (((a) & (pVisual->mask)) == ((b) & (pVisual->mask)))
#define UpdateDAC(plane,dac,mask) {\
if (MaskMatch (pPriv->colors[plane].pixel,pdef[i].pixel,mask)) {\
@@ -592,8 +714,7 @@ miSpriteStoreColors (pMap, ndef, pdef)
}
static void
-miSpriteFindColors (pScreen)
- ScreenPtr pScreen;
+miSpriteFindColors (ScreenPtr pScreen)
{
miSpriteScreenPtr pScreenPriv = (miSpriteScreenPtr)
pScreen->devPrivates[miSpriteScreenIndex].ptr;
@@ -798,8 +919,8 @@ miSpriteCopyWindow (pWin, ptOldOrg, pRegion)
static void
miSpriteClearToBackground (pWin, x, y, w, h, generateExposures)
WindowPtr pWin;
- short x,y;
- unsigned short w,h;
+ int x,y;
+ int w,h;
Bool generateExposures;
{
ScreenPtr pScreen;
@@ -836,7 +957,7 @@ miSpriteClearToBackground (pWin, x, y, w, h, generateExposures)
static void
miSpriteValidateGC (pGC, changes, pDrawable)
GCPtr pGC;
- Mask changes;
+ unsigned long changes;
DrawablePtr pDrawable;
{
GC_FUNC_PROLOGUE (pGC);
@@ -1017,6 +1138,7 @@ miSpritePutImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format, pBits)
int y;
int w;
int h;
+ int leftPad;
int format;
char *pBits;
{
@@ -1517,15 +1639,16 @@ miSpritePolyFillArc(pDrawable, pGC, narcs, parcs)
*/
static Bool
-miSpriteTextOverlap (pDraw, font, x, y, n, charinfo, imageblt, w, cursorBox)
- DrawablePtr pDraw;
- FontPtr font;
- int x, y;
- unsigned int n;
- CharInfoPtr *charinfo;
- Bool imageblt;
- unsigned int w;
- BoxPtr cursorBox;
+miSpriteTextOverlap (
+ DrawablePtr pDraw,
+ FontPtr font,
+ int x,
+ int y,
+ unsigned int n,
+ CharInfoPtr *charinfo,
+ Bool imageblt,
+ unsigned int w,
+ BoxPtr cursorBox)
{
ExtentInfoRec extents;
@@ -1599,23 +1722,22 @@ miSpriteTextOverlap (pDraw, font, x, y, n, charinfo, imageblt, w, cursorBox)
#define TT_IMAGE16 3
static int
-miSpriteText (pDraw, pGC, x, y, count, chars, fontEncoding, textType, cursorBox)
- DrawablePtr pDraw;
- GCPtr pGC;
+miSpriteText (
+ DrawablePtr pDraw,
+ GCPtr pGC,
int x,
- y;
- unsigned long count;
- char *chars;
- FontEncoding fontEncoding;
- Bool textType;
- BoxPtr cursorBox;
+ int y,
+ unsigned long count,
+ char *chars,
+ FontEncoding fontEncoding,
+ Bool textType,
+ BoxPtr cursorBox)
{
CharInfoPtr *charinfo;
register CharInfoPtr *info;
unsigned long i;
unsigned int n;
int w;
- void (*drawFunc)();
Bool imageblt;
@@ -1646,27 +1768,33 @@ miSpriteText (pDraw, pGC, x, y, count, chars, fontEncoding, textType, cursorBox)
switch (textType)
{
case TT_POLY8:
- drawFunc = (void (*)())pGC->ops->PolyText8;
+ (*pGC->ops->PolyText8)(pDraw, pGC, x, y, (int)count, chars);
break;
case TT_IMAGE8:
- drawFunc = pGC->ops->ImageText8;
+ (*pGC->ops->ImageText8)(pDraw, pGC, x, y, (int)count, chars);
break;
case TT_POLY16:
- drawFunc = (void (*)())pGC->ops->PolyText16;
+ (*pGC->ops->PolyText16)(pDraw, pGC, x, y, (int)count,
+ (unsigned short *)chars);
break;
case TT_IMAGE16:
- drawFunc = pGC->ops->ImageText16;
+ (*pGC->ops->ImageText16)(pDraw, pGC, x, y, (int)count,
+ (unsigned short *)chars);
break;
}
- (*drawFunc) (pDraw, pGC, x, y, (int) count, chars);
#else /* don't AVOID_GLYPHBLT */
/*
* On the other hand, if the device does use GlyphBlt ultimately to do text, we
* don't want to slow it down by invoking the text functions and having them call
* GetGlyphs all over again, so we go directly to the GlyphBlt functions here.
*/
- drawFunc = imageblt ? pGC->ops->ImageGlyphBlt : pGC->ops->PolyGlyphBlt;
- (*drawFunc) (pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font));
+ if (imageblt) {
+ (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, n, charinfo,
+ FONTGLYPHS(pGC->font));
+ } else {
+ (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, x, y, n, charinfo,
+ FONTGLYPHS(pGC->font));
+ }
#endif /* AVOID_GLYPHBLT */
}
DEALLOCATE_LOCAL(charinfo);
@@ -1848,6 +1976,133 @@ miSpriteLineHelper()
}
#endif
+#ifdef RENDER
+
+# define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
+
+static void
+miSpritePictureOverlap (PicturePtr pPict,
+ INT16 x,
+ INT16 y,
+ CARD16 w,
+ CARD16 h)
+{
+ if (pPict->pDrawable->type == DRAWABLE_WINDOW)
+ {
+ WindowPtr pWin = (WindowPtr) (pPict->pDrawable);
+ miSpriteScreenPtr pScreenPriv = (miSpriteScreenPtr)
+ pPict->pDrawable->pScreen->devPrivates[miSpriteScreenIndex].ptr;
+ if (GC_CHECK(pWin))
+ {
+ if (pPict->repeat)
+ {
+ x = mod(x,pWin->drawable.width);
+ y = mod(y,pWin->drawable.height);
+ }
+ if (ORG_OVERLAP (&pScreenPriv->saved, pWin->drawable.x, pWin->drawable.y,
+ x, y, w, h))
+ miSpriteRemoveCursor (pWin->drawable.pScreen);
+ }
+ }
+}
+
+#define PICTURE_PROLOGUE(ps, pScreenPriv, field) \
+ ps->field = pScreenPriv->field
+
+#define PICTURE_EPILOGUE(ps, field, wrap) \
+ ps->field = wrap
+
+static void
+miSpriteComposite(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ miSpriteScreenPtr pScreenPriv;
+
+ pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
+ PICTURE_PROLOGUE(ps, pScreenPriv, Composite);
+ miSpritePictureOverlap (pSrc, xSrc, ySrc, width, height);
+ if (pMask)
+ miSpritePictureOverlap (pMask, xMask, yMask, width, height);
+ miSpritePictureOverlap (pDst, xDst, yDst, width, height);
+
+ (*ps->Composite) (op,
+ pSrc,
+ pMask,
+ pDst,
+ xSrc,
+ ySrc,
+ xMask,
+ yMask,
+ xDst,
+ yDst,
+ width,
+ height);
+
+ PICTURE_EPILOGUE(ps, Composite, miSpriteComposite);
+}
+
+static void
+miSpriteGlyphs(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int nlist,
+ GlyphListPtr list,
+ GlyphPtr *glyphs)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ miSpriteScreenPtr pScreenPriv;
+
+ pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
+ PICTURE_PROLOGUE(ps, pScreenPriv, Glyphs);
+ if (pSrc->pDrawable->type == DRAWABLE_WINDOW)
+ {
+ WindowPtr pSrcWin = (WindowPtr) (pSrc->pDrawable);
+
+ if (GC_CHECK(pSrcWin))
+ miSpriteRemoveCursor (pScreen);
+ }
+ if (pDst->pDrawable->type == DRAWABLE_WINDOW)
+ {
+ WindowPtr pDstWin = (WindowPtr) (pDst->pDrawable);
+
+ if (GC_CHECK(pDstWin))
+ {
+ BoxRec extents;
+
+ miGlyphExtents (nlist, list, glyphs, &extents);
+ if (BOX_OVERLAP(&pScreenPriv->saved,
+ extents.x1 + pDstWin->drawable.x,
+ extents.y1 + pDstWin->drawable.y,
+ extents.x2 + pDstWin->drawable.x,
+ extents.y2 + pDstWin->drawable.y))
+ {
+ miSpriteRemoveCursor (pScreen);
+ }
+ }
+ }
+
+ (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs);
+
+ PICTURE_EPILOGUE (ps, Glyphs, miSpriteGlyphs);
+}
+#endif
+
/*
* miPointer interface routines
*/
@@ -1882,18 +2137,12 @@ static void
miSpriteSetCursor (pScreen, pCursor, x, y)
ScreenPtr pScreen;
CursorPtr pCursor;
+ int x;
+ int y;
{
miSpriteScreenPtr pScreenPriv;
pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
- pScreenPriv->shouldBeUp = TRUE;
- if (pScreenPriv->x == x &&
- pScreenPriv->y == y &&
- pScreenPriv->pCursor == pCursor &&
- !pScreenPriv->checkPixels)
- {
- return;
- }
if (!pCursor)
{
pScreenPriv->shouldBeUp = FALSE;
@@ -1902,6 +2151,14 @@ miSpriteSetCursor (pScreen, pCursor, x, y)
pScreenPriv->pCursor = 0;
return;
}
+ pScreenPriv->shouldBeUp = TRUE;
+ if (pScreenPriv->x == x &&
+ pScreenPriv->y == y &&
+ pScreenPriv->pCursor == pCursor &&
+ !pScreenPriv->checkPixels)
+ {
+ return;
+ }
pScreenPriv->x = x;
pScreenPriv->y = y;
pScreenPriv->pCacheWin = NullWindow;
diff --git a/mi/misprite.h b/mi/misprite.h
index be2f03e04..a7e19f7cb 100644
--- a/mi/misprite.h
+++ b/mi/misprite.h
@@ -32,50 +32,40 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/misprite.h,v 1.3 2001/12/14 20:00:27 dawes Exp $ */
typedef struct {
Bool (*RealizeCursor)(
-#if NeedNestedPrototypes
ScreenPtr /*pScreen*/,
CursorPtr /*pCursor*/
-#endif
);
Bool (*UnrealizeCursor)(
-#if NeedNestedPrototypes
ScreenPtr /*pScreen*/,
CursorPtr /*pCursor*/
-#endif
);
Bool (*PutUpCursor)(
-#if NeedNestedPrototypes
ScreenPtr /*pScreen*/,
CursorPtr /*pCursor*/,
int /*x*/,
int /*y*/,
unsigned long /*source*/,
unsigned long /*mask*/
-#endif
);
Bool (*SaveUnderCursor)(
-#if NeedNestedPrototypes
ScreenPtr /*pScreen*/,
int /*x*/,
int /*y*/,
int /*w*/,
int /*h*/
-#endif
);
Bool (*RestoreUnderCursor)(
-#if NeedNestedPrototypes
ScreenPtr /*pScreen*/,
int /*x*/,
int /*y*/,
int /*w*/,
int /*h*/
-#endif
);
Bool (*MoveCursor)(
-#if NeedNestedPrototypes
ScreenPtr /*pScreen*/,
CursorPtr /*pCursor*/,
int /*x*/,
@@ -86,10 +76,8 @@ typedef struct {
int /*dy*/,
unsigned long /*source*/,
unsigned long /*mask*/
-#endif
);
Bool (*ChangeSave)(
-#if NeedNestedPrototypes
ScreenPtr /*pScreen*/,
int /*x*/,
int /*y*/,
@@ -97,15 +85,12 @@ typedef struct {
int /*h*/,
int /*dx*/,
int /*dy*/
-#endif
);
} miSpriteCursorFuncRec, *miSpriteCursorFuncPtr;
extern Bool miSpriteInitialize(
-#if NeedFunctionPrototypes
ScreenPtr /*pScreen*/,
miSpriteCursorFuncPtr /*cursorFuncs*/,
miPointerScreenFuncPtr /*screenFuncs*/
-#endif
);
diff --git a/mi/mispritest.h b/mi/mispritest.h
index 1b873ecbd..eddc16c2d 100644
--- a/mi/mispritest.h
+++ b/mi/mispritest.h
@@ -30,8 +30,12 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/mispritest.h,v 1.5 2001/12/14 20:00:27 dawes Exp $ */
# include "misprite.h"
+#ifdef RENDER
+# include "picturestr.h"
+#endif
/*
* per screen information
@@ -52,6 +56,10 @@ typedef struct {
ClearToBackgroundProcPtr ClearToBackground;
SaveDoomedAreasProcPtr SaveDoomedAreas;
RestoreAreasProcPtr RestoreAreas;
+#ifdef RENDER
+ CompositeProcPtr Composite;
+ GlyphsProcPtr Glyphs;
+#endif
CursorPtr pCursor;
int x;
diff --git a/mi/mivaltree.c b/mi/mivaltree.c
index 26819ee45..eb1e01e60 100644
--- a/mi/mivaltree.c
+++ b/mi/mivaltree.c
@@ -51,6 +51,30 @@ in this Software without prior written authorization from The Open Group.
*
******************************************************************/
+/* The panoramix components contained the following notice */
+/****************************************************************
+* *
+* Copyright (c) Digital Equipment Corporation, 1991, 1997 *
+* *
+* All Rights Reserved. Unpublished rights reserved under *
+* the copyright laws of the United States. *
+* *
+* The software contained on this media is proprietary to *
+* and embodies the confidential technology of Digital *
+* Equipment Corporation. Possession, use, duplication or *
+* dissemination of the software and media is authorized only *
+* pursuant to a valid written license from Digital Equipment *
+* Corporation. *
+* *
+* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
+* by the U.S. Government is subject to restrictions as set *
+* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
+* or in FAR 52.227-19, as applicable. *
+* *
+*****************************************************************/
+
+/* $XFree86: xc/programs/Xserver/mi/mivaltree.c,v 1.9 2001/12/14 20:00:27 dawes Exp $ */
+
/*
* Aug '86: Susan Angebranndt -- original code
* July '87: Adam de Boor -- substantially modified and commented
@@ -60,7 +84,6 @@ in this Software without prior written authorization from The Open Group.
* Bob Scheifler -- avoid miComputeClips for unmapped windows,
* valdata changes
*/
-
#include "X.h"
#include "scrnintstr.h"
#include "validate.h"
@@ -69,10 +92,13 @@ in this Software without prior written authorization from The Open Group.
#include "regionstr.h"
#include "mivalidate.h"
+#include "globals.h"
+
#ifdef SHAPE
/*
* Compute the visibility of a shaped window
*/
+int
miShapedWindowIn (pScreen, universe, bounding, rect, x, y)
ScreenPtr pScreen;
RegionPtr universe, bounding;
@@ -137,7 +163,8 @@ miShapedWindowIn (pScreen, universe, bounding, rect, x, y)
HasBorder(w) && \
(w)->backgroundState == ParentRelative)
-/*-
+
+/*
*-----------------------------------------------------------------------
* miComputeClips --
* Recompute the clipList, borderClip, exposed and borderExposed
@@ -153,14 +180,13 @@ miShapedWindowIn (pScreen, universe, bounding, rect, x, y)
*
*-----------------------------------------------------------------------
*/
-
static void
-miComputeClips (pParent, pScreen, universe, kind, exposed)
- register WindowPtr pParent;
- register ScreenPtr pScreen;
- register RegionPtr universe;
- VTKind kind;
- RegionPtr exposed; /* for intermediate calculations */
+miComputeClips (
+ register WindowPtr pParent,
+ register ScreenPtr pScreen,
+ register RegionPtr universe,
+ VTKind kind,
+ RegionPtr exposed ) /* for intermediate calculations */
{
int dx,
dy;
@@ -172,7 +198,6 @@ miComputeClips (pParent, pScreen, universe, kind, exposed)
Bool overlap;
RegionPtr borderVisible;
Bool resized;
-
/*
* Figure out the new visibility of this window.
* The extent of the universe should be the same as the extent of
@@ -181,7 +206,6 @@ miComputeClips (pParent, pScreen, universe, kind, exposed)
* completely). If the window is completely obscured, none of the
* universe will cover the rectangle.
*/
-
borderSize.x1 = pParent->drawable.x - wBorderWidth(pParent);
borderSize.y1 = pParent->drawable.y - wBorderWidth(pParent);
dx = (int) pParent->drawable.x + (int) pParent->drawable.width + wBorderWidth(pParent);
@@ -311,6 +335,10 @@ miComputeClips (pParent, pScreen, universe, kind, exposed)
REGION_TRANSLATE( pScreen, &pParent->clipList, dx, dy);
}
break;
+ case VTBroken:
+ REGION_EMPTY (pScreen, &pParent->borderClip);
+ REGION_EMPTY (pScreen, &pParent->clipList);
+ break;
}
borderVisible = pParent->valdata->before.borderVisible;
@@ -476,8 +504,8 @@ miComputeClips (pParent, pScreen, universe, kind, exposed)
}
static void
-miTreeObscured(pParent)
- register WindowPtr pParent;
+miTreeObscured(
+ register WindowPtr pParent )
{
register WindowPtr pChild;
register int oldVis;
@@ -505,7 +533,7 @@ miTreeObscured(pParent)
}
}
-/*-
+/*
*-----------------------------------------------------------------------
* miValidateTree --
* Recomputes the clip list for pParent and all its inferiors.
@@ -572,39 +600,65 @@ miValidateTree (pParent, pChild, kind)
*/
REGION_INIT(pScreen, &totalClip, NullBox, 0);
viewvals = 0;
- if ((pChild->drawable.y < pParent->lastChild->drawable.y) ||
- ((pChild->drawable.y == pParent->lastChild->drawable.y) &&
- (pChild->drawable.x < pParent->lastChild->drawable.x)))
+ if (REGION_BROKEN (pScreen, &pParent->clipList) &&
+ !REGION_BROKEN (pScreen, &pParent->borderClip))
{
+ kind = VTBroken;
+ /*
+ * When rebuilding clip lists after out of memory,
+ * assume everything is busted.
+ */
forward = TRUE;
+ REGION_COPY (pScreen, &totalClip, &pParent->borderClip);
+ REGION_INTERSECT (pScreen, &totalClip, &totalClip, &pParent->winSize);
+
+ for (pWin = pParent->firstChild; pWin != pChild; pWin = pWin->nextSib)
+ {
+ if (pWin->viewable)
+ REGION_SUBTRACT (pScreen, &totalClip, &totalClip, &pWin->borderSize);
+ }
for (pWin = pChild; pWin; pWin = pWin->nextSib)
+ if (pWin->valdata && pWin->viewable)
+ viewvals++;
+
+ REGION_EMPTY (pScreen, &pParent->clipList);
+ }
+ else
+ {
+ if ((pChild->drawable.y < pParent->lastChild->drawable.y) ||
+ ((pChild->drawable.y == pParent->lastChild->drawable.y) &&
+ (pChild->drawable.x < pParent->lastChild->drawable.x)))
{
- if (pWin->valdata)
+ forward = TRUE;
+ for (pWin = pChild; pWin; pWin = pWin->nextSib)
{
- REGION_APPEND( pScreen, &totalClip, &pWin->borderClip);
- if (pWin->viewable)
- viewvals++;
+ if (pWin->valdata)
+ {
+ REGION_APPEND( pScreen, &totalClip, &pWin->borderClip);
+ if (pWin->viewable)
+ viewvals++;
+ }
}
}
- }
- else
- {
- forward = FALSE;
- pWin = pParent->lastChild;
- while (1)
+ else
{
- if (pWin->valdata)
+ forward = FALSE;
+ pWin = pParent->lastChild;
+ while (1)
{
- REGION_APPEND( pScreen, &totalClip, &pWin->borderClip);
- if (pWin->viewable)
- viewvals++;
+ if (pWin->valdata)
+ {
+ REGION_APPEND( pScreen, &totalClip, &pWin->borderClip);
+ if (pWin->viewable)
+ viewvals++;
+ }
+ if (pWin == pChild)
+ break;
+ pWin = pWin->prevSib;
}
- if (pWin == pChild)
- break;
- pWin = pWin->prevSib;
}
+ REGION_VALIDATE( pScreen, &totalClip, &overlap);
}
- REGION_VALIDATE( pScreen, &totalClip, &overlap);
/*
* Now go through the children of the root and figure their new
diff --git a/mi/miwideline.c b/mi/miwideline.c
index b78435705..4eb365aca 100644
--- a/mi/miwideline.c
+++ b/mi/miwideline.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/miwideline.c,v 1.12 2001/12/14 20:00:28 dawes Exp $ */
/* Author: Keith Packard, MIT X Consortium */
@@ -53,7 +54,12 @@ from The Open Group.
ICEILTEMPDECL
#endif
-static void miLineArc();
+static void miLineArc(DrawablePtr pDraw, register GCPtr pGC,
+ unsigned long pixel, SpanDataPtr spanData,
+ register LineFacePtr leftFace,
+ register LineFacePtr rightFace,
+ double xorg, double yorg, Bool isInt);
+
/*
* spans-based polygon filler
@@ -71,23 +77,23 @@ miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, overall_height,
PolyEdgePtr left, right;
int left_count, right_count;
{
- register int left_x, left_e;
- int left_stepx;
- int left_signdx;
- int left_dy, left_dx;
+ register int left_x = 0, left_e = 0;
+ int left_stepx = 0;
+ int left_signdx = 0;
+ int left_dy = 0, left_dx = 0;
- register int right_x, right_e;
- int right_stepx;
- int right_signdx;
- int right_dy, right_dx;
+ register int right_x = 0, right_e = 0;
+ int right_stepx = 0;
+ int right_signdx = 0;
+ int right_dy = 0, right_dx = 0;
- int height;
- int left_height, right_height;
+ int height = 0;
+ int left_height = 0, right_height = 0;
register DDXPointPtr ppt;
- DDXPointPtr pptInit;
+ DDXPointPtr pptInit = NULL;
register int *pwidth;
- int *pwidthInit;
+ int *pwidthInit = NULL;
XID oldPixel;
int xorg;
Spans spanRec;
@@ -184,12 +190,15 @@ miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, overall_height,
}
static void
-miFillRectPolyHelper (pDrawable, pGC, pixel, spanData, x, y, w, h)
- DrawablePtr pDrawable;
- GCPtr pGC;
- unsigned long pixel;
- SpanDataPtr spanData;
- int x, y, w, h;
+miFillRectPolyHelper (
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ unsigned long pixel,
+ SpanDataPtr spanData,
+ int x,
+ int y,
+ int w,
+ int h)
{
register DDXPointPtr ppt;
register int *pwidth;
@@ -325,7 +334,7 @@ miPolyBuildPoly (vertices, slopes, count, xi, yi, left, right, pnleft, pnright,
int slopeoff;
register int s;
register int nright, nleft;
- int y, lasty, bottomy, topy;
+ int y, lasty = 0, bottomy, topy = 0;
/* find the top of the polygon */
maxy = miny = vertices[0].y;
@@ -418,12 +427,13 @@ miPolyBuildPoly (vertices, slopes, count, xi, yi, left, right, pnleft, pnright,
}
static void
-miLineOnePoint (pDrawable, pGC, pixel, spanData, x, y)
- DrawablePtr pDrawable;
- GCPtr pGC;
- unsigned long pixel;
- SpanDataPtr spanData;
- int x, y;
+miLineOnePoint (
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ unsigned long pixel,
+ SpanDataPtr spanData,
+ int x,
+ int y)
{
DDXPointRec pt;
int wid;
@@ -452,15 +462,16 @@ miLineOnePoint (pDrawable, pGC, pixel, spanData, x, y)
}
static void
-miLineJoin (pDrawable, pGC, pixel, spanData, pLeft, pRight)
- DrawablePtr pDrawable;
- GCPtr pGC;
- unsigned long pixel;
- SpanDataPtr spanData;
- register LineFacePtr pLeft, pRight;
+miLineJoin (
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ unsigned long pixel,
+ SpanDataPtr spanData,
+ register LineFacePtr pLeft,
+ register LineFacePtr pRight)
{
- double mx, my;
- double denom;
+ double mx = 0, my = 0;
+ double denom = 0.0;
PolyVertexRec vertices[4];
PolySlopeRec slopes[4];
int edgecount;
@@ -472,8 +483,10 @@ miLineJoin (pDrawable, pGC, pixel, spanData, pLeft, pRight)
int lw = pGC->lineWidth;
if (lw == 1 && !spanData) {
- /* Lines going in the same direction have no join */
- if (pLeft->dx >= 0 == pRight->dx <= 0)
+ /* See if one of the lines will draw the joining pixel */
+ if (pLeft->dx > 0 || (pLeft->dx == 0 && pLeft->dy > 0))
+ return;
+ if (pRight->dx > 0 || (pRight->dx == 0 && pRight->dy > 0))
return;
if (joinStyle != JoinRound) {
denom = - pLeft->dx * (double)pRight->dy + pRight->dx * (double)pLeft->dy;
@@ -599,12 +612,13 @@ miLineJoin (pDrawable, pGC, pixel, spanData, pLeft, pRight)
}
static int
-miLineArcI (pDraw, pGC, xorg, yorg, points, widths)
- DrawablePtr pDraw;
- GCPtr pGC;
- int xorg, yorg;
- DDXPointPtr points;
- int *widths;
+miLineArcI (
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xorg,
+ int yorg,
+ DDXPointPtr points,
+ int *widths)
{
register DDXPointPtr tpts, bpts;
register int *twids, *bwids;
@@ -685,16 +699,19 @@ miLineArcI (pDraw, pGC, xorg, yorg, points, widths)
}
static int
-miLineArcD (pDraw, pGC, xorg, yorg, points, widths,
- edge1, edgey1, edgeleft1, edge2, edgey2, edgeleft2)
- DrawablePtr pDraw;
- GCPtr pGC;
- double xorg, yorg;
- DDXPointPtr points;
- int *widths;
- PolyEdgePtr edge1, edge2;
- int edgey1, edgey2;
- Bool edgeleft1, edgeleft2;
+miLineArcD (
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ double xorg,
+ double yorg,
+ DDXPointPtr points,
+ int *widths,
+ PolyEdgePtr edge1,
+ int edgey1,
+ Bool edgeleft1,
+ PolyEdgePtr edge2,
+ int edgey2,
+ Bool edgeleft2)
{
register DDXPointPtr pts;
register int *wids;
@@ -873,7 +890,7 @@ miRoundJoinFace (face, edge, leftEdge)
ya = 0.0;
xa = 0.0;
}
- if (dy < 0 || dy == 0 && dx > 0)
+ if (dy < 0 || (dy == 0 && dx > 0))
{
dx = -dx;
dy = -dy;
@@ -946,7 +963,7 @@ miRoundCapClip (face, isInt, edge, leftEdge)
if (!isInt)
k = face->k;
left = 1;
- if (dy < 0 || dy == 0 && dx > 0)
+ if (dy < 0 || (dy == 0 && dx > 0))
{
dx = -dx;
dy = -dy;
@@ -977,18 +994,20 @@ miRoundCapClip (face, isInt, edge, leftEdge)
}
static void
-miLineArc (pDraw, pGC, pixel, spanData, leftFace, rightFace, xorg, yorg, isInt)
- DrawablePtr pDraw;
- register GCPtr pGC;
- unsigned long pixel;
- SpanDataPtr spanData;
- register LineFacePtr leftFace, rightFace;
- double xorg, yorg;
- Bool isInt;
+miLineArc (
+ DrawablePtr pDraw,
+ register GCPtr pGC,
+ unsigned long pixel,
+ SpanDataPtr spanData,
+ register LineFacePtr leftFace,
+ register LineFacePtr rightFace,
+ double xorg,
+ double yorg,
+ Bool isInt)
{
DDXPointPtr points;
int *widths;
- int xorgi, yorgi;
+ int xorgi = 0, yorgi = 0;
XID oldPixel;
Spans spanRec;
int n;
@@ -1010,8 +1029,8 @@ miLineArc (pDraw, pGC, pixel, spanData, leftFace, rightFace, xorg, yorg, isInt)
edgeleft1 = FALSE;
edgeleft2 = FALSE;
if ((pGC->lineStyle != LineSolid || pGC->lineWidth > 2) &&
- (pGC->capStyle == CapRound && pGC->joinStyle != JoinRound ||
- pGC->joinStyle == JoinRound && pGC->capStyle == CapButt))
+ ((pGC->capStyle == CapRound && pGC->joinStyle != JoinRound) ||
+ (pGC->joinStyle == JoinRound && pGC->capStyle == CapButt)))
{
if (isInt)
{
@@ -1101,7 +1120,7 @@ miLineProjectingCap (pDrawable, pGC, pixel, spanData, face, isLeft, xorg, yorg,
double xorg, yorg;
Bool isInt;
{
- int xorgi, yorgi;
+ int xorgi = 0, yorgi = 0;
int lw;
PolyEdgeRec lefts[2], rights[2];
int lefty, righty, topy, bottomy;
@@ -1138,7 +1157,7 @@ miLineProjectingCap (pDrawable, pGC, pixel, spanData, face, isLeft, xorg, yorg,
rights[0].height = lw;
rights[0].x = xorgi;
if (!isLeft)
- rights[0].x += (lw + 1 >> 1);
+ rights[0].x += ((lw + 1) >> 1);
rights[0].stepx = 0;
rights[0].signdx = 1;
rights[0].e = -lw;
@@ -1257,19 +1276,23 @@ miLineProjectingCap (pDrawable, pGC, pixel, spanData, face, isLeft, xorg, yorg,
}
static void
-miWideSegment (pDrawable, pGC, pixel, spanData,
- x1, y1, x2, y2, projectLeft, projectRight, leftFace, rightFace)
- DrawablePtr pDrawable;
- GCPtr pGC;
- unsigned long pixel;
- SpanDataPtr spanData;
- register int x1, y1, x2, y2;
- Bool projectLeft, projectRight;
- register LineFacePtr leftFace, rightFace;
+miWideSegment (
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ unsigned long pixel,
+ SpanDataPtr spanData,
+ register int x1,
+ register int y1,
+ register int x2,
+ register int y2,
+ Bool projectLeft,
+ Bool projectRight,
+ register LineFacePtr leftFace,
+ register LineFacePtr rightFace)
{
double l, L, r;
double xa, ya;
- double projectXoff, projectYoff;
+ double projectXoff = 0.0, projectYoff = 0.0;
double k;
double maxy;
int x, y;
@@ -1284,7 +1307,7 @@ miWideSegment (pDrawable, pGC, pixel, spanData,
int lw = pGC->lineWidth;
/* draw top-to-bottom always */
- if (y2 < y1 || y2 == y1 && x2 < x1)
+ if (y2 < y1 || (y2 == y1 && x2 < x1))
{
x = x1;
x1 = x2;
@@ -1333,7 +1356,7 @@ miWideSegment (pDrawable, pGC, pixel, spanData,
y = y1 - (lw >> 1);
dx = x2 - x;
if (projectRight)
- dx += (lw + 1 >> 1);
+ dx += ((lw + 1) >> 1);
dy = lw;
miFillRectPolyHelper (pDrawable, pGC, pixel, spanData,
x, y, dx, dy);
@@ -1352,7 +1375,7 @@ miWideSegment (pDrawable, pGC, pixel, spanData,
x = x1 - (lw >> 1);
dy = y2 - y;
if (projectRight)
- dy += (lw + 1 >> 1);
+ dy += ((lw + 1) >> 1);
dx = lw;
miFillRectPolyHelper (pDrawable, pGC, pixel, spanData,
x, y, dx, dy);
@@ -1480,7 +1503,7 @@ miSetupSpanData (pGC, spanData, npt)
SpanDataPtr spanData;
int npt;
{
- if (npt < 3 && pGC->capStyle != CapRound || miSpansEasyRop(pGC->alu))
+ if ((npt < 3 && pGC->capStyle != CapRound) || miSpansEasyRop(pGC->alu))
return (SpanDataPtr) NULL;
if (pGC->lineStyle == LineDoubleDash)
miInitSpanGroup (&spanData->bgGroup);
@@ -1659,15 +1682,20 @@ miWideLine (pDrawable, pGC, mode, npt, pPts)
#define V_LEFT 3
static void
-miWideDashSegment (pDrawable, pGC, spanData, pDashOffset, pDashIndex,
- x1, y1, x2, y2, projectLeft, projectRight, leftFace, rightFace)
- DrawablePtr pDrawable;
- register GCPtr pGC;
- int *pDashOffset, *pDashIndex;
- SpanDataPtr spanData;
- int x1, y1, x2, y2;
- Bool projectLeft, projectRight;
- LineFacePtr leftFace, rightFace;
+miWideDashSegment (
+ DrawablePtr pDrawable,
+ register GCPtr pGC,
+ SpanDataPtr spanData,
+ int *pDashOffset,
+ int *pDashIndex,
+ int x1,
+ int y1,
+ int x2,
+ int y2,
+ Bool projectLeft,
+ Bool projectRight,
+ LineFacePtr leftFace,
+ LineFacePtr rightFace)
{
int dashIndex, dashRemain;
unsigned char *pDash;
@@ -1687,9 +1715,9 @@ miWideDashSegment (pDrawable, pGC, spanData, pDashOffset, pDashIndex,
double r;
double rdx, rdy;
double dashDx, dashDy;
- double saveK;
+ double saveK = 0.0;
Bool first = TRUE;
- double lcenterx, lcentery, rcenterx, rcentery;
+ double lcenterx, lcentery, rcenterx = 0.0, rcentery = 0.0;
unsigned long fgPixel, bgPixel;
dx = x2 - x1;
@@ -2030,14 +2058,17 @@ miWideDash (pDrawable, pGC, mode, npt, pPts)
SpanDataPtr spanData;
Bool somethingDrawn = FALSE;
Bool selfJoin;
- Bool endIsFg, startIsFg, firstIsFg = FALSE, prevIsFg;
+ Bool endIsFg = FALSE, startIsFg = FALSE;
+ Bool firstIsFg = FALSE, prevIsFg = FALSE;
+#ifndef XFree86Server
/* XXX backward compatibility */
if (pGC->lineWidth == 0)
{
miZeroDashLine (pDrawable, pGC, mode, npt, pPts);
return;
}
+#endif
if (pGC->lineStyle == LineDoubleDash &&
(pGC->fillStyle == FillOpaqueStippled || pGC->fillStyle == FillTiled))
{
diff --git a/mi/miwideline.h b/mi/miwideline.h
index 71d2c369c..f32a1e8fe 100644
--- a/mi/miwideline.h
+++ b/mi/miwideline.h
@@ -26,10 +26,12 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/mi/miwideline.h,v 1.12 2001/12/14 20:00:28 dawes Exp $ */
/* Author: Keith Packard, MIT X Consortium */
#include "mispans.h"
+#include "mifpoly.h" /* for ICEIL */
/*
* interface data to span-merging polygon filler
@@ -153,24 +155,7 @@ typedef struct _LineFace {
} \
}
-#ifdef NOINLINEICEIL
-#define ICEIL(x) ((int)ceil(x))
-#else
-#ifdef __GNUC__
-static __inline int ICEIL(x)
- double x;
-{
- int _cTmp = x;
- return ((x == _cTmp) || (x < 0.0)) ? _cTmp : _cTmp+1;
-}
-#else
-#define ICEIL(x) ((((x) == (_cTmp = (x))) || ((x) < 0.0)) ? _cTmp : _cTmp+1)
-#define ICEILTEMPDECL static int _cTmp;
-#endif
-#endif
-
extern void miFillPolyHelper(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
unsigned long /*pixel*/,
@@ -181,18 +166,14 @@ extern void miFillPolyHelper(
PolyEdgePtr /*right*/,
int /*left_count*/,
int /*right_count*/
-#endif
);
extern int miRoundJoinFace(
-#if NeedFunctionPrototypes
LineFacePtr /*face*/,
PolyEdgePtr /*edge*/,
Bool * /*leftEdge*/
-#endif
);
extern void miRoundJoinClip(
-#if NeedFunctionPrototypes
LineFacePtr /*pLeft*/,
LineFacePtr /*pRight*/,
PolyEdgePtr /*edge1*/,
@@ -201,20 +182,16 @@ extern void miRoundJoinClip(
int * /*y2*/,
Bool * /*left1*/,
Bool * /*left2*/
-#endif
);
extern int miRoundCapClip(
-#if NeedFunctionPrototypes
LineFacePtr /*face*/,
Bool /*isInt*/,
PolyEdgePtr /*edge*/,
Bool * /*leftEdge*/
-#endif
);
extern void miLineProjectingCap(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
unsigned long /*pixel*/,
@@ -224,21 +201,24 @@ extern void miLineProjectingCap(
double /*xorg*/,
double /*yorg*/,
Bool /*isInt*/
-#endif
);
extern SpanDataPtr miSetupSpanData(
-#if NeedFunctionPrototypes
GCPtr /*pGC*/,
SpanDataPtr /*spanData*/,
int /*npt*/
-#endif
);
extern void miCleanupSpanData(
-#if NeedFunctionPrototypes
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
SpanDataPtr /*spanData*/
-#endif
);
+
+extern int miPolyBuildEdge(double x0, double y0, double k, int dx, int dy,
+ int xi, int yi, int left, PolyEdgePtr edge);
+extern int miPolyBuildPoly(PolyVertexPtr vertices, PolySlopePtr slopes,
+ int count, int xi, int yi, PolyEdgePtr left,
+ PolyEdgePtr right, int *pnleft, int *pnright,
+ int *h);
+
diff --git a/mi/miwindow.c b/mi/miwindow.c
index f9428074c..fbced41c6 100644
--- a/mi/miwindow.c
+++ b/mi/miwindow.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/miwindow.c,v 1.7 2001/12/14 20:00:28 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -156,10 +157,10 @@ miClearToBackground(pWin, x, y, w, h, generateExposures)
*-----------------------------------------------------------------------
*/
static Bool
-miCheckSubSaveUnder(pParent, pFirst, pRegion)
- register WindowPtr pParent; /* Parent to check */
- WindowPtr pFirst; /* first reconfigured window */
- RegionPtr pRegion; /* Initial area obscured by saveUnder */
+miCheckSubSaveUnder(
+ register WindowPtr pParent, /* Parent to check */
+ WindowPtr pFirst, /* first reconfigured window */
+ RegionPtr pRegion) /* Initial area obscured by saveUnder */
{
register WindowPtr pChild; /* Current child */
register ScreenPtr pScreen; /* Screen to use */
@@ -362,8 +363,10 @@ miMarkOverlappedWindows(pWin, pFirst, ppLayerWin)
register BoxPtr box;
register WindowPtr pChild, pLast;
Bool anyMarked = FALSE;
- void (* MarkWindow)() = pWin->drawable.pScreen->MarkWindow;
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ MarkWindowProcPtr MarkWindow = pWin->drawable.pScreen->MarkWindow;
+ ScreenPtr pScreen;
+
+ pScreen = pWin->drawable.pScreen;
/* single layered systems are easy */
if (ppLayerWin) *ppLayerWin = pWin;
@@ -379,6 +382,10 @@ miMarkOverlappedWindows(pWin, pFirst, ppLayerWin)
{
if (pChild->viewable)
{
+ if (REGION_BROKEN (pScreen, &pChild->winSize))
+ SetWinSize (pChild);
+ if (REGION_BROKEN (pScreen, &pChild->borderSize))
+ SetBorderSize (pChild);
(* MarkWindow)(pChild);
if (pChild->firstChild)
{
@@ -401,15 +408,21 @@ miMarkOverlappedWindows(pWin, pFirst, ppLayerWin)
pLast = pChild->parent->lastChild;
while (1)
{
- if (pChild->viewable && RECT_IN_REGION(pScreen, &pChild->borderSize,
- box))
+ if (pChild->viewable)
{
- (* MarkWindow)(pChild);
- anyMarked = TRUE;
- if (pChild->firstChild)
+ if (REGION_BROKEN (pScreen, &pChild->winSize))
+ SetWinSize (pChild);
+ if (REGION_BROKEN (pScreen, &pChild->borderSize))
+ SetBorderSize (pChild);
+ if (RECT_IN_REGION(pScreen, &pChild->borderSize, box))
{
- pChild = pChild->firstChild;
- continue;
+ (* MarkWindow)(pChild);
+ anyMarked = TRUE;
+ if (pChild->firstChild)
+ {
+ pChild = pChild->firstChild;
+ continue;
+ }
}
}
while (!pChild->nextSib && (pChild != pLast))
@@ -436,8 +449,10 @@ miHandleValidateExposures(pWin)
{
register WindowPtr pChild;
register ValidatePtr val;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- void (* WindowExposures)();
+ ScreenPtr pScreen;
+ WindowExposuresProcPtr WindowExposures;
+
+ pScreen = pWin->drawable.pScreen;
pChild = pWin;
WindowExposures = pChild->drawable.pScreen->WindowExposures;
@@ -478,9 +493,9 @@ miMoveWindow(pWin, x, y, pNextSib, kind)
WindowPtr pParent;
Bool WasViewable = (Bool)(pWin->viewable);
short bw;
- RegionPtr oldRegion;
+ RegionPtr oldRegion = NULL;
DDXPointRec oldpt;
- Bool anyMarked;
+ Bool anyMarked = FALSE;
register ScreenPtr pScreen;
WindowPtr windowToValidate;
#ifdef DO_SAVE_UNDERS
@@ -558,9 +573,9 @@ miMoveWindow(pWin, x, y, pNextSib, kind)
*/
static int
-miRecomputeExposures (pWin, value)
- register WindowPtr pWin;
- pointer value; /* must conform to VisitWindowProcPtr */
+miRecomputeExposures (
+ register WindowPtr pWin,
+ pointer value) /* must conform to VisitWindowProcPtr */
{
register ScreenPtr pScreen;
RegionPtr pValid = (RegionPtr)value;
@@ -601,8 +616,8 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
int bw = wBorderWidth (pWin);
short dw, dh;
DDXPointRec oldpt;
- RegionPtr oldRegion;
- Bool anyMarked;
+ RegionPtr oldRegion = NULL;
+ Bool anyMarked = FALSE;
register ScreenPtr pScreen;
WindowPtr pFirstChange;
register WindowPtr pChild;
@@ -610,9 +625,9 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
register unsigned g;
int nx, ny; /* destination x,y */
int newx, newy; /* new inner window position */
- RegionPtr pRegion;
+ RegionPtr pRegion = NULL;
RegionPtr destClip; /* portions of destination already written */
- RegionPtr oldWinClip; /* old clip list for window */
+ RegionPtr oldWinClip = NULL; /* old clip list for window */
RegionPtr borderVisible = NullRegion; /* visible area of the border */
RegionPtr bsExposed = NullRegion; /* backing store exposures */
Bool shrunk = FALSE; /* shrunk in an inner dimension */
@@ -962,9 +977,8 @@ miSetShape(pWin)
{
Bool WasViewable = (Bool)(pWin->viewable);
register ScreenPtr pScreen = pWin->drawable.pScreen;
- Bool anyMarked;
- WindowPtr pParent = pWin->parent;
- RegionPtr pOldClip, bsExposed;
+ Bool anyMarked = FALSE;
+ RegionPtr pOldClip = NULL, bsExposed;
#ifdef DO_SAVE_UNDERS
Bool dosave = FALSE;
#endif
@@ -1064,7 +1078,7 @@ miChangeBorderWidth(pWin, width)
{
WindowPtr pParent;
int oldwidth;
- Bool anyMarked;
+ Bool anyMarked = FALSE;
register ScreenPtr pScreen;
Bool WasViewable = (Bool)(pWin->viewable);
Bool HadBorder;
@@ -1142,3 +1156,21 @@ miMarkUnrealizedWindow(pChild, pWin, fromConfigure)
REGION_EMPTY(pChild->drawable.pScreen, &pChild->borderClip);
}
}
+
+void
+miSegregateChildren(WindowPtr pWin, RegionPtr pReg, int depth)
+{
+ ScreenPtr pScreen;
+ WindowPtr pChild;
+
+ pScreen = pWin->drawable.pScreen;
+
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
+ {
+ if (pChild->drawable.depth == depth)
+ REGION_UNION(pScreen, pReg, pReg, &pChild->borderClip);
+
+ if (pChild->firstChild)
+ miSegregateChildren(pChild, pReg, depth);
+ }
+}
diff --git a/mi/mizerarc.c b/mi/mizerarc.c
index def8d8c51..971e2cb03 100644
--- a/mi/mizerarc.c
+++ b/mi/mizerarc.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mizerarc.c,v 1.6 2001/12/14 20:00:28 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -502,12 +503,14 @@ miZeroArcPts(arc, pts)
}
static void
-miZeroArcDashPts(pGC, arc, dinfo, points, maxPts, evenPts, oddPts)
- GCPtr pGC;
- xArc *arc;
- DashInfo *dinfo;
- int maxPts;
- register DDXPointPtr points, *evenPts, *oddPts;
+miZeroArcDashPts(
+ GCPtr pGC,
+ xArc *arc,
+ DashInfo *dinfo,
+ register DDXPointPtr points,
+ int maxPts,
+ register DDXPointPtr *evenPts,
+ register DDXPointPtr *oddPts )
{
miZeroArcRec info;
register int x, y, a, b, d, mask;
@@ -710,14 +713,14 @@ miZeroPolyArc(pDraw, pGC, narcs, parcs)
xArc *parcs;
{
int maxPts = 0;
- register int n, maxw;
+ register int n, maxw = 0;
register xArc *arc;
register int i;
DDXPointPtr points, pts, oddPts;
register DDXPointPtr pt;
int numPts;
Bool dospans;
- int *widths;
+ int *widths = NULL;
XID fgPixel = pGC->fgPixel;
DashInfo dinfo;
@@ -738,7 +741,7 @@ miZeroPolyArc(pDraw, pGC, narcs, parcs)
if (!maxPts)
return;
numPts = maxPts << 2;
- dospans = (pGC->lineStyle != LineSolid) || (pGC->fillStyle != FillSolid);
+ dospans = (pGC->fillStyle != FillSolid);
if (dospans)
{
widths = (int *)ALLOCATE_LOCAL(sizeof(int) * numPts);
diff --git a/mi/mizerarc.h b/mi/mizerarc.h
index 68c8ce3de..4a52efa29 100644
--- a/mi/mizerarc.h
+++ b/mi/mizerarc.h
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mizerarc.h,v 1.3 2001/12/14 20:00:28 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -121,17 +122,13 @@ typedef struct {
/* mizerarc.c */
extern Bool miZeroArcSetup(
-#if NeedFunctionPrototypes
xArc * /*arc*/,
miZeroArcRec * /*info*/,
Bool /*ok360*/
-#endif
);
extern DDXPointPtr miZeroArcPts(
-#if NeedFunctionPrototypes
xArc * /*arc*/,
DDXPointPtr /*pts*/
-#endif
);
diff --git a/mi/mizerline.c b/mi/mizerline.c
index 2279cb822..d1fbf631e 100644
--- a/mi/mizerline.c
+++ b/mi/mizerline.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/mi/mizerline.c,v 3.7 2001/12/14 20:00:29 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -55,591 +56,6 @@ SOFTWARE.
#include "mi.h"
#include "miline.h"
-/*
-
-The bresenham error equation used in the mi/mfb/cfb line routines is:
-
- e = error
- dx = difference in raw X coordinates
- dy = difference in raw Y coordinates
- M = # of steps in X direction
- N = # of steps in Y direction
- B = 0 to prefer diagonal steps in a given octant,
- 1 to prefer axial steps in a given octant
-
- For X major lines:
- e = 2Mdy - 2Ndx - dx - B
- -2dx <= e < 0
-
- For Y major lines:
- e = 2Ndx - 2Mdy - dy - B
- -2dy <= e < 0
-
-At the start of the line, we have taken 0 X steps and 0 Y steps,
-so M = 0 and N = 0:
-
- X major e = 2Mdy - 2Ndx - dx - B
- = -dx - B
-
- Y major e = 2Ndx - 2Mdy - dy - B
- = -dy - B
-
-At the end of the line, we have taken dx X steps and dy Y steps,
-so M = dx and N = dy:
-
- X major e = 2Mdy - 2Ndx - dx - B
- = 2dxdy - 2dydx - dx - B
- = -dx - B
- Y major e = 2Ndx - 2Mdy - dy - B
- = 2dydx - 2dxdy - dy - B
- = -dy - B
-
-Thus, the error term is the same at the start and end of the line.
-
-Let us consider clipping an X coordinate. There are 4 cases which
-represent the two independent cases of clipping the start vs. the
-end of the line and an X major vs. a Y major line. In any of these
-cases, we know the number of X steps (M) and we wish to find the
-number of Y steps (N). Thus, we will solve our error term equation.
-If we are clipping the start of the line, we will find the smallest
-N that satisfies our error term inequality. If we are clipping the
-end of the line, we will find the largest number of Y steps that
-satisfies the inequality. In that case, since we are representing
-the Y steps as (dy - N), we will actually want to solve for the
-smallest N in that equation.
-
-Case 1: X major, starting X coordinate moved by M steps
-
- -2dx <= 2Mdy - 2Ndx - dx - B < 0
- 2Ndx <= 2Mdy - dx - B + 2dx 2Ndx > 2Mdy - dx - B
- 2Ndx <= 2Mdy + dx - B N > (2Mdy - dx - B) / 2dx
- N <= (2Mdy + dx - B) / 2dx
-
-Since we are trying to find the smallest N that satisfies these
-equations, we should use the > inequality to find the smallest:
-
- N = floor((2Mdy - dx - B) / 2dx) + 1
- = floor((2Mdy - dx - B + 2dx) / 2dx)
- = floor((2Mdy + dx - B) / 2dx)
-
-Case 1b: X major, ending X coordinate moved to M steps
-
-Same derivations as Case 1, but we want the largest N that satisfies
-the equations, so we use the <= inequality:
-
- N = floor((2Mdy + dx - B) / 2dx)
-
-Case 2: X major, ending X coordinate moved by M steps
-
- -2dx <= 2(dx - M)dy - 2(dy - N)dx - dx - B < 0
- -2dx <= 2dxdy - 2Mdy - 2dxdy + 2Ndx - dx - B < 0
- -2dx <= 2Ndx - 2Mdy - dx - B < 0
- 2Ndx >= 2Mdy + dx + B - 2dx 2Ndx < 2Mdy + dx + B
- 2Ndx >= 2Mdy - dx + B N < (2Mdy + dx + B) / 2dx
- N >= (2Mdy - dx + B) / 2dx
-
-Since we are trying to find the highest number of Y steps that
-satisfies these equations, we need to find the smallest N, so
-we should use the >= inequality to find the smallest:
-
- N = ceiling((2Mdy - dx + B) / 2dx)
- = floor((2Mdy - dx + B + 2dx - 1) / 2dx)
- = floor((2Mdy + dx + B - 1) / 2dx)
-
-Case 2b: X major, starting X coordinate moved to M steps from end
-
-Same derivations as Case 2, but we want the smallest number of Y
-steps, so we want the highest N, so we use the < inequality:
-
- N = ceiling((2Mdy + dx + B) / 2dx) - 1
- = floor((2Mdy + dx + B + 2dx - 1) / 2dx) - 1
- = floor((2Mdy + dx + B + 2dx - 1 - 2dx) / 2dx)
- = floor((2Mdy + dx + B - 1) / 2dx)
-
-Case 3: Y major, starting X coordinate moved by M steps
-
- -2dy <= 2Ndx - 2Mdy - dy - B < 0
- 2Ndx >= 2Mdy + dy + B - 2dy 2Ndx < 2Mdy + dy + B
- 2Ndx >= 2Mdy - dy + B N < (2Mdy + dy + B) / 2dx
- N >= (2Mdy - dy + B) / 2dx
-
-Since we are trying to find the smallest N that satisfies these
-equations, we should use the >= inequality to find the smallest:
-
- N = ceiling((2Mdy - dy + B) / 2dx)
- = floor((2Mdy - dy + B + 2dx - 1) / 2dx)
- = floor((2Mdy - dy + B - 1) / 2dx) + 1
-
-Case 3b: Y major, ending X coordinate moved to M steps
-
-Same derivations as Case 3, but we want the largest N that satisfies
-the equations, so we use the < inequality:
-
- N = ceiling((2Mdy + dy + B) / 2dx) - 1
- = floor((2Mdy + dy + B + 2dx - 1) / 2dx) - 1
- = floor((2Mdy + dy + B + 2dx - 1 - 2dx) / 2dx)
- = floor((2Mdy + dy + B - 1) / 2dx)
-
-Case 4: Y major, ending X coordinate moved by M steps
-
- -2dy <= 2(dy - N)dx - 2(dx - M)dy - dy - B < 0
- -2dy <= 2dxdy - 2Ndx - 2dxdy + 2Mdy - dy - B < 0
- -2dy <= 2Mdy - 2Ndx - dy - B < 0
- 2Ndx <= 2Mdy - dy - B + 2dy 2Ndx > 2Mdy - dy - B
- 2Ndx <= 2Mdy + dy - B N > (2Mdy - dy - B) / 2dx
- N <= (2Mdy + dy - B) / 2dx
-
-Since we are trying to find the highest number of Y steps that
-satisfies these equations, we need to find the smallest N, so
-we should use the > inequality to find the smallest:
-
- N = floor((2Mdy - dy - B) / 2dx) + 1
-
-Case 4b: Y major, starting X coordinate moved to M steps from end
-
-Same analysis as Case 4, but we want the smallest number of Y steps
-which means the largest N, so we use the <= inequality:
-
- N = floor((2Mdy + dy - B) / 2dx)
-
-Now let's try the Y coordinates, we have the same 4 cases.
-
-Case 5: X major, starting Y coordinate moved by N steps
-
- -2dx <= 2Mdy - 2Ndx - dx - B < 0
- 2Mdy >= 2Ndx + dx + B - 2dx 2Mdy < 2Ndx + dx + B
- 2Mdy >= 2Ndx - dx + B M < (2Ndx + dx + B) / 2dy
- M >= (2Ndx - dx + B) / 2dy
-
-Since we are trying to find the smallest M, we use the >= inequality:
-
- M = ceiling((2Ndx - dx + B) / 2dy)
- = floor((2Ndx - dx + B + 2dy - 1) / 2dy)
- = floor((2Ndx - dx + B - 1) / 2dy) + 1
-
-Case 5b: X major, ending Y coordinate moved to N steps
-
-Same derivations as Case 5, but we want the largest M that satisfies
-the equations, so we use the < inequality:
-
- M = ceiling((2Ndx + dx + B) / 2dy) - 1
- = floor((2Ndx + dx + B + 2dy - 1) / 2dy) - 1
- = floor((2Ndx + dx + B + 2dy - 1 - 2dy) / 2dy)
- = floor((2Ndx + dx + B - 1) / 2dy)
-
-Case 6: X major, ending Y coordinate moved by N steps
-
- -2dx <= 2(dx - M)dy - 2(dy - N)dx - dx - B < 0
- -2dx <= 2dxdy - 2Mdy - 2dxdy + 2Ndx - dx - B < 0
- -2dx <= 2Ndx - 2Mdy - dx - B < 0
- 2Mdy <= 2Ndx - dx - B + 2dx 2Mdy > 2Ndx - dx - B
- 2Mdy <= 2Ndx + dx - B M > (2Ndx - dx - B) / 2dy
- M <= (2Ndx + dx - B) / 2dy
-
-Largest # of X steps means smallest M, so use the > inequality:
-
- M = floor((2Ndx - dx - B) / 2dy) + 1
-
-Case 6b: X major, starting Y coordinate moved to N steps from end
-
-Same derivations as Case 6, but we want the smallest # of X steps
-which means the largest M, so use the <= inequality:
-
- M = floor((2Ndx + dx - B) / 2dy)
-
-Case 7: Y major, starting Y coordinate moved by N steps
-
- -2dy <= 2Ndx - 2Mdy - dy - B < 0
- 2Mdy <= 2Ndx - dy - B + 2dy 2Mdy > 2Ndx - dy - B
- 2Mdy <= 2Ndx + dy - B M > (2Ndx - dy - B) / 2dy
- M <= (2Ndx + dy - B) / 2dy
-
-To find the smallest M, use the > inequality:
-
- M = floor((2Ndx - dy - B) / 2dy) + 1
- = floor((2Ndx - dy - B + 2dy) / 2dy)
- = floor((2Ndx + dy - B) / 2dy)
-
-Case 7b: Y major, ending Y coordinate moved to N steps
-
-Same derivations as Case 7, but we want the largest M that satisfies
-the equations, so use the <= inequality:
-
- M = floor((2Ndx + dy - B) / 2dy)
-
-Case 8: Y major, ending Y coordinate moved by N steps
-
- -2dy <= 2(dy - N)dx - 2(dx - M)dy - dy - B < 0
- -2dy <= 2dxdy - 2Ndx - 2dxdy + 2Mdy - dy - B < 0
- -2dy <= 2Mdy - 2Ndx - dy - B < 0
- 2Mdy >= 2Ndx + dy + B - 2dy 2Mdy < 2Ndx + dy + B
- 2Mdy >= 2Ndx - dy + B M < (2Ndx + dy + B) / 2dy
- M >= (2Ndx - dy + B) / 2dy
-
-To find the highest X steps, find the smallest M, use the >= inequality:
-
- M = ceiling((2Ndx - dy + B) / 2dy)
- = floor((2Ndx - dy + B + 2dy - 1) / 2dy)
- = floor((2Ndx + dy + B - 1) / 2dy)
-
-Case 8b: Y major, starting Y coordinate moved to N steps from the end
-
-Same derivations as Case 8, but we want to find the smallest # of X
-steps which means the largest M, so we use the < inequality:
-
- M = ceiling((2Ndx + dy + B) / 2dy) - 1
- = floor((2Ndx + dy + B + 2dy - 1) / 2dy) - 1
- = floor((2Ndx + dy + B + 2dy - 1 - 2dy) / 2dy)
- = floor((2Ndx + dy + B - 1) / 2dy)
-
-So, our equations are:
-
- 1: X major move x1 to x1+M floor((2Mdy + dx - B) / 2dx)
- 1b: X major move x2 to x1+M floor((2Mdy + dx - B) / 2dx)
- 2: X major move x2 to x2-M floor((2Mdy + dx + B - 1) / 2dx)
- 2b: X major move x1 to x2-M floor((2Mdy + dx + B - 1) / 2dx)
-
- 3: Y major move x1 to x1+M floor((2Mdy - dy + B - 1) / 2dx) + 1
- 3b: Y major move x2 to x1+M floor((2Mdy + dy + B - 1) / 2dx)
- 4: Y major move x2 to x2-M floor((2Mdy - dy - B) / 2dx) + 1
- 4b: Y major move x1 to x2-M floor((2Mdy + dy - B) / 2dx)
-
- 5: X major move y1 to y1+N floor((2Ndx - dx + B - 1) / 2dy) + 1
- 5b: X major move y2 to y1+N floor((2Ndx + dx + B - 1) / 2dy)
- 6: X major move y2 to y2-N floor((2Ndx - dx - B) / 2dy) + 1
- 6b: X major move y1 to y2-N floor((2Ndx + dx - B) / 2dy)
-
- 7: Y major move y1 to y1+N floor((2Ndx + dy - B) / 2dy)
- 7b: Y major move y2 to y1+N floor((2Ndx + dy - B) / 2dy)
- 8: Y major move y2 to y2-N floor((2Ndx + dy + B - 1) / 2dy)
- 8b: Y major move y1 to y2-N floor((2Ndx + dy + B - 1) / 2dy)
-
-We have the following constraints on all of the above terms:
-
- 0 < M,N <= 2^15 2^15 can be imposed by miZeroClipLine
- 0 <= dx/dy <= 2^16 - 1
- 0 <= B <= 1
-
-The floor in all of the above equations can be accomplished with a
-simple C divide operation provided that both numerator and denominator
-are positive.
-
-Since dx,dy >= 0 and since moving an X coordinate implies that dx != 0
-and moving a Y coordinate implies dy != 0, we know that the denominators
-are all > 0.
-
-For all lines, (-B) and (B-1) are both either 0 or -1, depending on the
-bias. Thus, we have to show that the 2MNdxy +/- dxy terms are all >= 1
-or > 0 to prove that the numerators are positive (or zero).
-
-For X Major lines we know that dx > 0 and since 2Mdy is >= 0 due to the
-constraints, the first four equations all have numerators >= 0.
-
-For the second four equations, M > 0, so 2Mdy >= 2dy so (2Mdy - dy) >= dy
-So (2Mdy - dy) > 0, since they are Y major lines. Also, (2Mdy + dy) >= 3dy
-or (2Mdy + dy) > 0. So all of their numerators are >= 0.
-
-For the third set of four equations, N > 0, so 2Ndx >= 2dx so (2Ndx - dx)
->= dx > 0. Similarly (2Ndx + dx) >= 3dx > 0. So all numerators >= 0.
-
-For the fourth set of equations, dy > 0 and 2Ndx >= 0, so all numerators
-are > 0.
-
-To consider overflow, consider the case of 2 * M,N * dx,dy + dx,dy. This
-is bounded <= 2 * 2^15 * (2^16 - 1) + (2^16 - 1)
- <= 2^16 * (2^16 - 1) + (2^16 - 1)
- <= 2^32 - 2^16 + 2^16 - 1
- <= 2^32 - 1
-Since the (-B) and (B-1) terms are all 0 or -1, the maximum value of
-the numerator is therefore (2^32 - 1), which does not overflow an unsigned
-32 bit variable.
-
-*/
-
-#define MIOUTCODES(outcode, x, y, xmin, ymin, xmax, ymax) \
-{\
- if (x < xmin) outcode |= OUT_LEFT;\
- if (x > xmax) outcode |= OUT_RIGHT;\
- if (y < ymin) outcode |= OUT_ABOVE;\
- if (y > ymax) outcode |= OUT_BELOW;\
-}
-
-/* Bit codes for the terms of the 16 clipping equations defined below. */
-
-#define T_2NDX (1 << 0)
-#define T_2MDY (0) /* implicit term */
-#define T_DXNOTY (1 << 1)
-#define T_DYNOTX (0) /* implicit term */
-#define T_SUBDXORY (1 << 2)
-#define T_ADDDX (T_DXNOTY) /* composite term */
-#define T_SUBDX (T_DXNOTY | T_SUBDXORY) /* composite term */
-#define T_ADDDY (T_DYNOTX) /* composite term */
-#define T_SUBDY (T_DYNOTX | T_SUBDXORY) /* composite term */
-#define T_BIASSUBONE (1 << 3)
-#define T_SUBBIAS (0) /* implicit term */
-#define T_DIV2DX (1 << 4)
-#define T_DIV2DY (0) /* implicit term */
-#define T_ADDONE (1 << 5)
-
-/* Bit masks defining the 16 equations used in miZeroClipLine. */
-
-#define EQN1 (T_2MDY | T_ADDDX | T_SUBBIAS | T_DIV2DX)
-#define EQN1B (T_2MDY | T_ADDDX | T_SUBBIAS | T_DIV2DX)
-#define EQN2 (T_2MDY | T_ADDDX | T_BIASSUBONE | T_DIV2DX)
-#define EQN2B (T_2MDY | T_ADDDX | T_BIASSUBONE | T_DIV2DX)
-
-#define EQN3 (T_2MDY | T_SUBDY | T_BIASSUBONE | T_DIV2DX | T_ADDONE)
-#define EQN3B (T_2MDY | T_ADDDY | T_BIASSUBONE | T_DIV2DX)
-#define EQN4 (T_2MDY | T_SUBDY | T_SUBBIAS | T_DIV2DX | T_ADDONE)
-#define EQN4B (T_2MDY | T_ADDDY | T_SUBBIAS | T_DIV2DX)
-
-#define EQN5 (T_2NDX | T_SUBDX | T_BIASSUBONE | T_DIV2DY | T_ADDONE)
-#define EQN5B (T_2NDX | T_ADDDX | T_BIASSUBONE | T_DIV2DY)
-#define EQN6 (T_2NDX | T_SUBDX | T_SUBBIAS | T_DIV2DY | T_ADDONE)
-#define EQN6B (T_2NDX | T_ADDDX | T_SUBBIAS | T_DIV2DY)
-
-#define EQN7 (T_2NDX | T_ADDDY | T_SUBBIAS | T_DIV2DY)
-#define EQN7B (T_2NDX | T_ADDDY | T_SUBBIAS | T_DIV2DY)
-#define EQN8 (T_2NDX | T_ADDDY | T_BIASSUBONE | T_DIV2DY)
-#define EQN8B (T_2NDX | T_ADDDY | T_BIASSUBONE | T_DIV2DY)
-
-/* miZeroClipLine
- *
- * returns: 1 for partially clipped line
- * -1 for completely clipped line
- *
- */
-int
-miZeroClipLine(xmin, ymin, xmax, ymax,
- new_x1, new_y1, new_x2, new_y2,
- adx, ady,
- pt1_clipped, pt2_clipped, octant, bias, oc1, oc2)
- int xmin, ymin, xmax, ymax;
- int *new_x1, *new_y1, *new_x2, *new_y2;
- int *pt1_clipped, *pt2_clipped;
- unsigned int adx, ady;
- int octant;
- unsigned int bias;
- int oc1, oc2;
-{
- int swapped = 0;
- int clipDone = 0;
- CARD32 utmp;
- int clip1, clip2;
- int x1, y1, x2, y2;
- int x1_orig, y1_orig, x2_orig, y2_orig;
- int xmajor;
- int negslope, anchorval;
- unsigned int eqn;
-
- x1 = x1_orig = *new_x1;
- y1 = y1_orig = *new_y1;
- x2 = x2_orig = *new_x2;
- y2 = y2_orig = *new_y2;
-
- clip1 = 0;
- clip2 = 0;
-
- xmajor = IsXMajorOctant(octant);
- bias = ((bias >> octant) & 1);
-
- while (1)
- {
- if ((oc1 & oc2) != 0) /* trivial reject */
- {
- clipDone = -1;
- clip1 = oc1;
- clip2 = oc2;
- break;
- }
- else if ((oc1 | oc2) == 0) /* trivial accept */
- {
- clipDone = 1;
- if (swapped)
- {
- SWAPINT_PAIR(x1, y1, x2, y2);
- SWAPINT(clip1, clip2);
- }
- break;
- }
- else /* have to clip */
- {
- /* only clip one point at a time */
- if (oc1 == 0)
- {
- SWAPINT_PAIR(x1, y1, x2, y2);
- SWAPINT_PAIR(x1_orig, y1_orig, x2_orig, y2_orig);
- SWAPINT(oc1, oc2);
- SWAPINT(clip1, clip2);
- swapped = !swapped;
- }
-
- clip1 |= oc1;
- if (oc1 & OUT_LEFT)
- {
- negslope = IsYDecreasingOctant(octant);
- utmp = xmin - x1_orig;
- if (utmp <= 32767) /* clip based on near endpt */
- {
- if (xmajor)
- eqn = (swapped) ? EQN2 : EQN1;
- else
- eqn = (swapped) ? EQN4 : EQN3;
- anchorval = y1_orig;
- }
- else /* clip based on far endpt */
- {
- utmp = x2_orig - xmin;
- if (xmajor)
- eqn = (swapped) ? EQN1B : EQN2B;
- else
- eqn = (swapped) ? EQN3B : EQN4B;
- anchorval = y2_orig;
- negslope = !negslope;
- }
- x1 = xmin;
- }
- else if (oc1 & OUT_ABOVE)
- {
- negslope = IsXDecreasingOctant(octant);
- utmp = ymin - y1_orig;
- if (utmp <= 32767) /* clip based on near endpt */
- {
- if (xmajor)
- eqn = (swapped) ? EQN6 : EQN5;
- else
- eqn = (swapped) ? EQN8 : EQN7;
- anchorval = x1_orig;
- }
- else /* clip based on far endpt */
- {
- utmp = y2_orig - ymin;
- if (xmajor)
- eqn = (swapped) ? EQN5B : EQN6B;
- else
- eqn = (swapped) ? EQN7B : EQN8B;
- anchorval = x2_orig;
- negslope = !negslope;
- }
- y1 = ymin;
- }
- else if (oc1 & OUT_RIGHT)
- {
- negslope = IsYDecreasingOctant(octant);
- utmp = x1_orig - xmax;
- if (utmp <= 32767) /* clip based on near endpt */
- {
- if (xmajor)
- eqn = (swapped) ? EQN2 : EQN1;
- else
- eqn = (swapped) ? EQN4 : EQN3;
- anchorval = y1_orig;
- }
- else /* clip based on far endpt */
- {
- /*
- * Technically since the equations can handle
- * utmp == 32768, this overflow code isn't
- * needed since X11 protocol can't generate
- * a line which goes more than 32768 pixels
- * to the right of a clip rectangle.
- */
- utmp = xmax - x2_orig;
- if (xmajor)
- eqn = (swapped) ? EQN1B : EQN2B;
- else
- eqn = (swapped) ? EQN3B : EQN4B;
- anchorval = y2_orig;
- negslope = !negslope;
- }
- x1 = xmax;
- }
- else if (oc1 & OUT_BELOW)
- {
- negslope = IsXDecreasingOctant(octant);
- utmp = y1_orig - ymax;
- if (utmp <= 32767) /* clip based on near endpt */
- {
- if (xmajor)
- eqn = (swapped) ? EQN6 : EQN5;
- else
- eqn = (swapped) ? EQN8 : EQN7;
- anchorval = x1_orig;
- }
- else /* clip based on far endpt */
- {
- /*
- * Technically since the equations can handle
- * utmp == 32768, this overflow code isn't
- * needed since X11 protocol can't generate
- * a line which goes more than 32768 pixels
- * below the bottom of a clip rectangle.
- */
- utmp = ymax - y2_orig;
- if (xmajor)
- eqn = (swapped) ? EQN5B : EQN6B;
- else
- eqn = (swapped) ? EQN7B : EQN8B;
- anchorval = x2_orig;
- negslope = !negslope;
- }
- y1 = ymax;
- }
-
- if (swapped)
- negslope = !negslope;
-
- utmp <<= 1; /* utmp = 2N or 2M */
- if (eqn & T_2NDX)
- utmp = (utmp * adx);
- else /* (eqn & T_2MDY) */
- utmp = (utmp * ady);
- if (eqn & T_DXNOTY)
- if (eqn & T_SUBDXORY)
- utmp -= adx;
- else
- utmp += adx;
- else /* (eqn & T_DYNOTX) */
- if (eqn & T_SUBDXORY)
- utmp -= ady;
- else
- utmp += ady;
- if (eqn & T_BIASSUBONE)
- utmp += bias - 1;
- else /* (eqn & T_SUBBIAS) */
- utmp -= bias;
- if (eqn & T_DIV2DX)
- utmp /= (adx << 1);
- else /* (eqn & T_DIV2DY) */
- utmp /= (ady << 1);
- if (eqn & T_ADDONE)
- utmp++;
-
- if (negslope)
- utmp = -utmp;
-
- if (eqn & T_2NDX) /* We are calculating X steps */
- x1 = anchorval + utmp;
- else /* else, Y steps */
- y1 = anchorval + utmp;
-
- oc1 = 0;
- MIOUTCODES(oc1, x1, y1, xmin, ymin, xmax, ymax);
- }
- }
-
- *new_x1 = x1;
- *new_y1 = y1;
- *new_x2 = x2;
- *new_y2 = y2;
-
- *pt1_clipped = clip1;
- *pt2_clipped = clip2;
-
- return clipDone;
-}
-
-
/* Draw lineSolid, fillStyle-independent zero width lines.
*
* Must keep X and Y coordinates in "ints" at least until after they're
@@ -687,13 +103,13 @@ miZeroLine(pDraw, pGC, mode, npt, pptInit)
int npt; /* number of points */
DDXPointPtr pptInit;
{
- int Nspans, current_y;
+ int Nspans, current_y = 0;
DDXPointPtr ppt;
DDXPointPtr pspanInit, spans;
int *pwidthInit, *widths, list_len;
int xleft, ytop, xright, ybottom;
int new_x1, new_y1, new_x2, new_y2;
- int x, y, x1, y1, x2, y2, xstart, ystart;
+ int x = 0, y = 0, x1, y1, x2, y2, xstart, ystart;
int oc1, oc2;
int result;
int pt1_clipped, pt2_clipped = 0;