[comp.sources.x] v04i088: R3 Sun Server Speedups, Part02/03

argv@island.uu.net (Dan Heller) (08/09/89)

Submitted-by: uunet!inf.rl.ac.uk!taw
Posting-number: Volume 4, Issue 88
Archive-name: ral.speedups/part02



#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 2 (of 3)."
# Contents:  psunfillrct.c.patch psungc.c.patch psunscrinit.c.patch
#   psunwindow.c.patch sun.h.patch
# Wrapped by taw@box on Wed Aug  2 15:44:12 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'psunfillrct.c.patch' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'psunfillrct.c.patch'\"
else
echo shar: Extracting \"'psunfillrct.c.patch'\" \(5305 characters\)
sed "s/^X//" >'psunfillrct.c.patch' <<'END_OF_FILE'
X*** psunfillrct.c.slow	Tue Aug  1 09:49:21 1989
X--- psunfillrct.c	Mon May 15 09:40:21 1989
X***************
X*** 0 ****
X--- 1,176 ----
X+ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
X+ /***********************************************************
X+ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
X+ and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
X+ 
X+                         All Rights Reserved
X+ 
X+ Permission to use, copy, modify, and distribute this software and its 
X+ documentation for any purpose and without fee is hereby granted, 
X+ provided that the above copyright notice appear in all copies and that
X+ both that copyright notice and this permission notice appear in 
X+ supporting documentation, and that the names of Digital or MIT not be
X+ used in advertising or publicity pertaining to distribution of the
X+ software without specific, written prior permission.  
X+ 
X+ DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X+ ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X+ DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X+ ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X+ SOFTWARE.
X+ 
X+ ******************************************************************/
X+ /* $XConsortium: mfbfillrct.c,v 1.37 88/09/06 14:53:57 jim Exp $ */
X+ #include "X.h"
X+ #include "Xprotostr.h"
X+ #include "pixmapstr.h"
X+ #include "gcstruct.h"
X+ #include "windowstr.h"
X+ #include "miscstruct.h"
X+ #include "regionstr.h"
X+ #include "scrnintstr.h"
X+ 
X+ #include "mfb.h"
X+ #include "maskbits.h"
X+ 
X+ #define MODEQ(a, b) ((a) %= (b))
X+ void mfbPaintOddSize();
X+ 
X+ /* 
X+     filled rectangles.
X+     translate the rectangles, clip them, and call the
X+ helper function in the GC.
X+ */
X+ extern int sunTileOrgX, sunTileOrgY;
X+ 
X+ void
X+ psunPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
X+     DrawablePtr pDrawable;
X+     GCPtr	pGC;
X+     int		nrectFill; 	/* number of rectangles to fill */
X+     xRectangle	*prectInit;  	/* Pointer to first rectangle to fill */
X+ {
X+     int xorg, yorg;
X+     register int n;		/* spare counter */
X+     xRectangle *prect;		/* temporary */
X+     RegionPtr prgnClip;
X+     register BoxPtr pbox;	/* used to clip with */
X+     register BoxPtr pboxClipped;
X+     BoxPtr pboxClippedBase;
X+     BoxPtr pextent;
X+ 
X+     int alu;
X+     void (* pfn) ();
X+     PixmapPtr ppix;
X+ 
X+     alu = ((mfbPrivGC *)(pGC->devPriv))->ropFillArea;
X+     pfn = ((mfbPrivGC *)(pGC->devPriv))->FillArea;
X+     ppix = *( ((mfbPrivGC *)(pGC->devPriv))->ppPixmap);
X+     prgnClip = ((mfbPrivGC *)(pGC->devPriv))->pCompositeClip;
X+ 
X+     pboxClippedBase = (BoxPtr)ALLOCATE_LOCAL(prgnClip->numRects * 
X+ 					     sizeof(BoxRec));
X+ 
X+     if (!pboxClippedBase)
X+ 	return;
X+ 
X+ sunTileOrgX = pGC->patOrg.x;
X+ sunTileOrgY = pGC->patOrg.y;	/* can't see how else to do this, caag */
X+ 
X+     prect = prectInit;
X+     if (pDrawable->type == DRAWABLE_WINDOW)
X+     {
X+ 	xorg = ((WindowPtr)pDrawable)->absCorner.x;
X+ 	yorg = ((WindowPtr)pDrawable)->absCorner.y;
X+         prect = prectInit;
X+ 	n = nrectFill;
X+ #ifndef PURDUE
X+         while(n--)
X+         {
X+ 	    prect->x += xorg;
X+ 	    prect->y += yorg;
X+ 	    prect++;
X+         }
X+ #else
X+ 	Duff (n, prect->x += xorg; prect->y += yorg; prect++);
X+ #endif
X+     }
X+ 
X+     prect = prectInit;
X+ 
X+     pextent = (*pGC->pScreen->RegionExtents)(prgnClip);
X+ 
X+     while (nrectFill--)
X+     {
X+ 	BoxRec box;
X+ 	int	x2, y2;
X+ 
X+ 	/*
X+ 	 * clip the box to the extent of the region --
X+ 	 * avoids overflowing shorts and minimizes other
X+ 	 * computations
X+ 	 */
X+ 
X+ 
X+ 	box.x1 = prect->x;
X+ 	if (box.x1 < pextent->x1)
X+ 		box.x1 = pextent->x1;
X+ 
X+ 	box.y1 = prect->y;
X+ 	if (box.y1 < pextent->y1)
X+ 		box.y1 = pextent->y1;
X+ 
X+ 	x2 = (int) prect->x + (int) prect->width;
X+ 	if (x2 > pextent->x2)
X+ 		x2 = pextent->x2;
X+ 	box.x2 = x2;
X+ 
X+ 	y2 = (int) prect->y + (int) prect->height;
X+ 	if (y2 > pextent->y2)
X+ 		y2 = pextent->y2;
X+ 	box.y2 = y2;
X+ 
X+ 	prect++;
X+ 
X+ 	if ((box.x1 >= box.x2) || (box.y1 >= box.y2))
X+ 	    continue;
X+ 
X+ 	switch((*pGC->pScreen->RectIn)(prgnClip, &box))
X+ 	{
X+ 	  case rgnOUT:
X+ 	    break;
X+ 	  case rgnIN:
X+ 	    (*pfn)(pDrawable, 1, &box, alu, ppix);
X+ 	    break;
X+ 	  case rgnPART:
X+ 	    pboxClipped = pboxClippedBase;
X+ 	    pbox = prgnClip->rects;
X+ 	    n = prgnClip->numRects;
X+ 
X+ 	    /* clip the rectangle to each box in the clip region
X+ 	       this is logically equivalent to calling Intersect()
X+ 	    */
X+ 	    while(n--)
X+ 	    {
X+ 	        pboxClipped->x1 = max(box.x1, pbox->x1);
X+ 	        pboxClipped->y1 = max(box.y1, pbox->y1);
X+ 	        pboxClipped->x2 = min(box.x2, pbox->x2);
X+ 	        pboxClipped->y2 = min(box.y2, pbox->y2);
X+ 		pbox++;
X+ 
X+ 	        /* see if clipping left anything */
X+ 	        if(pboxClipped->x1 < pboxClipped->x2 && 
X+ 	           pboxClipped->y1 < pboxClipped->y2)
X+ 	        {
X+ 		    pboxClipped++;
X+ 	        }
X+ 	    }
X+ 	    (*pfn)(pDrawable, pboxClipped-pboxClippedBase, 
X+ 		   pboxClippedBase, alu, ppix);
X+ 	    break;
X+ 	}
X+     }
X+     DEALLOCATE_LOCAL(pboxClippedBase);
X+ }
END_OF_FILE
if test 5305 -ne `wc -c <'psunfillrct.c.patch'`; then
    echo shar: \"'psunfillrct.c.patch'\" unpacked with wrong size!
fi
# end of 'psunfillrct.c.patch'
fi
if test -f 'psungc.c.patch' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'psungc.c.patch'\"
else
echo shar: Extracting \"'psungc.c.patch'\" \(22966 characters\)
sed "s/^X//" >'psungc.c.patch' <<'END_OF_FILE'
X*** psungc.c.slow	Tue Aug  1 09:49:21 1989
X--- psungc.c	Thu Apr 27 11:57:08 1989
X***************
X*** 0 ****
X--- 1,786 ----
X+ /***********************************************************
X+ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
X+ and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
X+ 
X+                         All Rights Reserved
X+ 
X+ Permission to use, copy, modify, and distribute this software and its 
X+ documentation for any purpose and without fee is hereby granted, 
X+ provided that the above copyright notice appear in all copies and that
X+ both that copyright notice and this permission notice appear in 
X+ supporting documentation, and that the names of Digital or MIT not be
X+ used in advertising or publicity pertaining to distribution of the
X+ software without specific, written prior permission.  
X+ 
X+ DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X+ ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X+ DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X+ ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X+ SOFTWARE.
X+ 
X+ ******************************************************************/
X+ /* $XConsortium: mfbgc.c,v 1.124 88/09/06 14:53:16 jim Exp $ */
X+ #include "X.h"
X+ #include "Xmd.h"
X+ #include "Xproto.h"
X+ #include "dixfontstr.h"
X+ #include "fontstruct.h"
X+ #include "gcstruct.h"
X+ #include "windowstr.h"
X+ #include "pixmapstr.h"
X+ #include "scrnintstr.h"
X+ #include "region.h"
X+ 
X+ #include "sun.h"
X+ #include "mistruct.h"
X+ 
X+ #include "maskbits.h"
X+ 
X+ static PixmapPtr BogusPixmap = (PixmapPtr)1;
X+ 
X+ Bool
X+ psunCreateGC(pGC)
X+     register GCPtr pGC;
X+ {
X+     mfbPrivGC 	*pPriv;
X+     GCInterestPtr	pQ;
X+ 
X+     pGC->clientClip = NULL;
X+     pGC->clientClipType = CT_NONE;
X+     
X+     /* some of the output primitives aren't really necessary, since
X+        they will be filled in ValidateGC because of dix/CreateGC()
X+        setting all the change bits.  Others are necessary because although
X+        they depend on being a monochrome frame buffer, they don't change 
X+     */
X+ 
X+     pGC->FillSpans = mfbWhiteSolidFS;
X+     pGC->SetSpans = mfbSetSpans;
X+     pGC->PutImage = mfbPutImage;
X+     pGC->CopyArea = psunCopyArea;
X+     pGC->CopyPlane = psunCopyPlane;
X+     pGC->PolyPoint = mfbPolyPoint;
X+ 
X+     pGC->Polylines = mfbLineSS;
X+     pGC->PolySegment = miPolySegment;
X+     pGC->PolyRectangle = miPolyRectangle;
X+     pGC->PolyArc = miPolyArc;
X+     pGC->FillPolygon = miFillPolygon;
X+     pGC->PolyFillRect = mfbPolyFillRect;
X+     pGC->PolyFillArc = miPolyFillArc;
X+     pGC->PolyText8 = miPolyText8;
X+     pGC->ImageText8 = miImageText8;
X+     pGC->PolyText16 = miPolyText16;
X+     pGC->ImageText16 = miImageText16;
X+     pGC->ImageGlyphBlt = mfbImageGlyphBltWhite;
X+     pGC->PolyGlyphBlt = sunPolyGlyphBltInvert;
X+     pGC->PushPixels = mfbPushPixels;
X+     pGC->LineHelper = miMiter;
X+     pGC->ChangeClip = mfbChangeClip;
X+     pGC->DestroyClip = mfbDestroyClip;
X+     pGC->CopyClip = mfbCopyClip;
X+ 
X+     /* mfb wants to translate before scan convesion */
X+     pGC->miTranslate = 1;
X+ 
X+     pPriv = (mfbPrivGC *)Xalloc(sizeof(mfbPrivGC));
X+     if (!pPriv)
X+ 	return FALSE;
X+     else
X+     {
X+ 	pPriv->rop = ReduceRop(pGC->alu, pGC->fgPixel);
X+ 	pPriv->fExpose = TRUE;
X+ 	pGC->devPriv = (pointer)pPriv;
X+ 	pPriv->pRotatedTile = NullPixmap;
X+ 	pPriv->pRotatedStipple = NullPixmap;
X+ 	pPriv->pAbsClientRegion =(* pGC->pScreen->RegionCreate)(NULL, 1); 
X+ 
X+ 	/* since freeCompClip isn't FREE_CC, we don't need to create
X+ 	   a null region -- no one will try to free the field.
X+ 	*/
X+ 	pPriv->freeCompClip = REPLACE_CC;
X+ 	pPriv->ppPixmap = &BogusPixmap;
X+ 	pPriv->FillArea = sunSolidInvertArea;
X+     }
X+     pGC->devBackingStore = (pointer)NULL;
X+ 
X+     pQ = (GCInterestPtr) Xalloc(sizeof(GCInterestRec));
X+     if(!pQ)
X+     {
X+ 	Xfree(pPriv);
X+ 	return FALSE;
X+     }
X+      
X+     /* Now link this device into the GCque */
X+     pGC->pNextGCInterest = pQ;
X+     pGC->pLastGCInterest = pQ;
X+     pQ->pNextGCInterest = (GCInterestPtr) &pGC->pNextGCInterest;
X+     pQ->pLastGCInterest = (GCInterestPtr) &pGC->pNextGCInterest;
X+     pQ->length = sizeof(GCInterestRec);
X+     pQ->owner = 0;		/* server owns this */
X+     pQ->ValInterestMask = ~0;	/* interested in everything at validate time */
X+     pQ->ValidateGC = psunValidateGC;
X+     pQ->ChangeInterestMask = 0; /* interested in nothing at change time */
X+     pQ->ChangeGC = (int (*) () ) NULL;
X+     pQ->CopyGCSource = (void (*) () ) NULL;
X+     pQ->CopyGCDest = (void (*) () ) NULL;
X+     pQ->DestroyGC = mfbDestroyGC;
X+     return TRUE;
X+ }
X+ /* Clipping conventions
X+ 	if the drawable is a window
X+ 	    CT_REGION ==> pCompositeClip really is the composite
X+ 	    CT_other ==> pCompositeClip is the window clip region
X+ 	if the drawable is a pixmap
X+ 	    CT_REGION ==> pCompositeClip is the translated client region
X+ 		clipped to the pixmap boundary
X+ 	    CT_other ==> pCompositeClip is the pixmap bounding box
X+ */
X+ 
X+ void
X+ psunValidateGC(pGC, pQ, changes, pDrawable)
X+     register GCPtr 	pGC;
X+     GCInterestPtr	pQ;
X+     Mask 		changes;
X+     DrawablePtr 	pDrawable;
X+ {
X+     register mfbPrivGCPtr	devPriv;
X+     WindowPtr pWin;
X+     int mask;			/* stateChanges */
X+     int index;			/* used for stepping through bitfields */
X+     int	xrot, yrot;		/* rotations for tile and stipple pattern */
X+     int rrop;			/* reduced rasterop */
X+ 				/* flags for changing the proc vector 
X+ 				   and updating things in devPriv
X+ 				*/
X+     int new_rotate, new_rrop,  new_line, new_text, new_fill;
X+     DDXPointRec	oldOrg;		/* origin of thing GC was last used with */
X+     Bool win_moved;		/* window has moved since last time */
X+     Mask procChanges = 0;
X+ 
X+     oldOrg = pGC->lastWinOrg;
X+ 
X+     if (pDrawable->type == DRAWABLE_WINDOW)
X+     {
X+ 	pWin = (WindowPtr)pDrawable;
X+ 	pGC->lastWinOrg.x = pWin->absCorner.x;
X+ 	pGC->lastWinOrg.y = pWin->absCorner.y;
X+     }
X+     else
X+     {
X+ 	pWin = (WindowPtr)NULL;
X+ 	pGC->lastWinOrg.x = 0;
X+ 	pGC->lastWinOrg.y = 0;
X+     }
X+     win_moved = (oldOrg.x != pGC->lastWinOrg.x) ||
X+ 		(oldOrg.y != pGC->lastWinOrg.y);
X+ 
X+     devPriv = ((mfbPrivGCPtr) (pGC->devPriv));
X+     /*
X+ 	if the client clip is different or moved OR
X+ 	the subwindowMode has changed OR
X+ 	the window's clip has changed since the last validation
X+ 	we need to recompute the composite clip
X+     */
X+ 
X+     if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask)) ||
X+ 	(changes & GCSubwindowMode) ||
X+ 	(pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
X+        )
X+     {
X+ 
X+         /* if there is a client clip (always a region, for us) AND
X+ 	        it has moved or is different OR
X+ 	        the window has moved
X+            we need to (re)translate it.
X+         */
X+ 	if ((pGC->clientClipType == CT_REGION) &&
X+ 	    ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask)) ||
X+ 	     win_moved
X+ 	    )
X+ 	   )
X+ 	{
X+ 	    /* retranslate client clip */
X+ 	    (* pGC->pScreen->RegionCopy)( devPriv->pAbsClientRegion, 
X+ 			                  pGC->clientClip);
X+ 
X+ 	    (* pGC->pScreen->TranslateRegion)(
X+ 			   devPriv->pAbsClientRegion, 
X+ 			   pGC->lastWinOrg.x + pGC->clipOrg.x,
X+ 			   pGC->lastWinOrg.y + pGC->clipOrg.y);
X+ 	}
X+ 
X+ 	if (pWin)
X+ 	{
X+ 	    int freeTmpClip, freeCompClip;
X+ 	    RegionPtr pregWin;		/* clip for this window, without
X+ 					   client clip */
X+ 
X+ 	    if (pGC->subWindowMode == IncludeInferiors)
X+ 	    {
X+ 	        pregWin = NotClippedByChildren(pWin);
X+ 		freeTmpClip = FREE_CC;
X+ 	    }
X+ 	    else
X+ 	    {
X+ 	        pregWin = pWin->clipList;
X+ 		freeTmpClip = REPLACE_CC;
X+ 	    }
X+ 	    freeCompClip = devPriv->freeCompClip;
X+ 
X+ 	    /* if there is no client clip, we can get by with
X+ 	       just keeping the pointer we got, and remembering
X+ 	       whether or not should destroy (or maybe re-use)
X+ 	       it later.  this way, we avoid unnecessary copying
X+ 	       of regions.  (this wins especially if many clients clip
X+ 	       by children and have no client clip.)
X+ 	    */
X+ 	    if (pGC->clientClipType == CT_NONE)
X+ 	    {
X+ 	        if(freeCompClip == FREE_CC) 
X+ 		{
X+ 		    (* pGC->pScreen->RegionDestroy) (devPriv->pCompositeClip);
X+ 		}
X+ 	        devPriv->pCompositeClip = pregWin;
X+ 	        devPriv->freeCompClip = freeTmpClip;
X+ 	    }
X+ 	    else
X+ 	    {
X+ 		/* we need one 'real' region to put into the composite
X+ 		   clip.
X+ 			if pregWin and the current composite clip 
X+ 		   are real, we can get rid of one.
X+ 			if the current composite clip is real and
X+ 		   pregWin isn't, intersect the client clip and
X+ 		   pregWin into the existing composite clip.
X+ 			if pregWin is real and the current composite
X+ 		   clip isn't, intersect pregWin with the client clip
X+ 		   and replace the composite clip with it.
X+ 			if neither is real, create a new region and
X+ 		   do the intersection into it.
X+ 		*/
X+ 
X+ 		if ((freeTmpClip == FREE_CC) && (freeCompClip == FREE_CC))
X+ 		{
X+ 		    (* pGC->pScreen->Intersect)(
X+ 		        devPriv->pCompositeClip,
X+ 			pregWin,
X+ 			devPriv->pAbsClientRegion);
X+ 		    (* pGC->pScreen->RegionDestroy)(pregWin);
X+ 		}
X+ 		else if ((freeTmpClip == REPLACE_CC) && 
X+ 		        (freeCompClip == FREE_CC))
X+ 		{
X+ 		    (* pGC->pScreen->Intersect)(
X+ 			devPriv->pCompositeClip,
X+ 		        pregWin,
X+ 			devPriv->pAbsClientRegion);
X+ 		}
X+ 		else if ((freeTmpClip == FREE_CC) &&
X+ 		         (freeCompClip == REPLACE_CC))
X+ 		{
X+ 		    (* pGC->pScreen->Intersect)( 
X+ 		       pregWin,
X+ 		       pregWin,
X+ 		       devPriv->pAbsClientRegion);
X+ 		    devPriv->pCompositeClip = pregWin;
X+ 		}
X+ 		else if ((freeTmpClip == REPLACE_CC) &&
X+ 		         (freeCompClip == REPLACE_CC))
X+ 		{
X+ 		    devPriv->pCompositeClip = 
X+ 			(* pGC->pScreen->RegionCreate)(NULL, 1);
X+ 		    (* pGC->pScreen->Intersect)(
X+ 			devPriv->pCompositeClip,
X+ 		        pregWin,
X+ 			devPriv->pAbsClientRegion);
X+ 		}
X+ 		devPriv->freeCompClip = FREE_CC;
X+ 	    }
X+ 	} /* end of composite clip for a window */
X+ 	else
X+ 	{
X+ 	    BoxRec pixbounds;
X+ 
X+ 	    pixbounds.x1 = 0;
X+ 	    pixbounds.y1 = 0;
X+ 	    pixbounds.x2 = ((PixmapPtr)pDrawable)->width;
X+ 	    pixbounds.y2 = ((PixmapPtr)pDrawable)->height;
X+ 
X+ 	    if (devPriv->freeCompClip == FREE_CC)
X+ 	        (* pGC->pScreen->RegionReset)(
X+ 		    devPriv->pCompositeClip, &pixbounds);
X+ 	    else
X+ 	    {
X+ 		devPriv->freeCompClip = FREE_CC;
X+ 		devPriv->pCompositeClip = 
X+ 			(* pGC->pScreen->RegionCreate)(&pixbounds, 1);
X+ 	    }
X+ 
X+ 	    if (pGC->clientClipType == CT_REGION)
X+ 		(* pGC->pScreen->Intersect)(
X+ 		   devPriv->pCompositeClip, 
X+ 		   devPriv->pCompositeClip,
X+ 		   devPriv->pAbsClientRegion);
X+ 	} /* end of composite clip for pixmap */
X+     }
X+ 
X+     /* we need to re-rotate the tile if the previous window/pixmap
X+        origin (oldOrg) differs from the new window/pixmap origin
X+        (pGC->lastWinOrg)
X+     */
X+     if (win_moved)
X+     {
X+ 	new_rotate = TRUE;
X+     }
X+     else
X+     {
X+ 	new_rotate = FALSE;
X+     }
X+ 
X+     new_rrop = FALSE;
X+     new_line = FALSE;
X+     new_text = FALSE;
X+     new_fill = FALSE;
X+ 
X+     mask = changes;
X+     while (mask)
X+     {
X+ 	index = lowbit (mask);
X+ 	mask &= ~index;
X+ 
X+ 	/* this switch acculmulates a list of which procedures
X+ 	   might have to change due to changes in the GC.  in
X+ 	   some cases (e.g. changing one 16 bit tile for another)
X+ 	   we might not really need a change, but the code is
X+ 	   being paranoid.
X+ 	   this sort of batching wins if, for example, the alu
X+ 	   and the font have been changed, or any other pair
X+ 	   of items that both change the same thing.
X+ 	*/
X+ 	switch (index)
X+ 	{
X+ 	  case GCFunction:
X+ 	  case GCForeground:
X+ 	    new_rrop = TRUE;
X+ 	    break;
X+ 	  case GCPlaneMask:
X+ 	    break;
X+ 	  case GCBackground:
X+ 	    new_rrop = TRUE;	/* for opaque stipples */
X+ 	    break;
X+ 	  case GCLineStyle:
X+ 	  case GCLineWidth:
X+ 	  case GCJoinStyle:
X+ 	    new_line = TRUE;
X+         break;
X+       case GCCapStyle:
X+ 	    break;
X+ 	  case GCFillStyle:
X+ 	    new_fill = TRUE;
X+ 	    break;
X+ 	  case GCFillRule:
X+ 	    break;
X+ 	  case GCTile:
X+ 	    if(pGC->tile == (PixmapPtr)NULL)
X+ 		break;
X+ 	    mfbPadPixmap(pGC->tile);
X+ 	    new_rotate = TRUE;
X+ 	    new_fill = TRUE;
X+ 	    break;
X+ 
X+ 	  case GCStipple:
X+ 	    if(pGC->stipple == (PixmapPtr)NULL)
X+ 		break;
X+ 	    mfbPadPixmap(pGC->stipple);
X+ 	    new_rotate = TRUE;
X+ 	    new_fill = TRUE;
X+ 	    break;
X+ 
X+ 	  case GCTileStipXOrigin:
X+ 	    new_rotate = TRUE;
X+ 	    break;
X+ 
X+ 	  case GCTileStipYOrigin:
X+ 	    new_rotate = TRUE;
X+ 	    break;
X+ 
X+ 	  case GCFont:
X+ 	    new_text = TRUE;
X+ 	    break;
X+ 	  case GCSubwindowMode:
X+ 	    break;
X+ 	  case GCGraphicsExposures:
X+ 	    break;
X+ 	  case GCClipXOrigin:
X+ 	    break;
X+ 	  case GCClipYOrigin:
X+ 	    break;
X+ 	  case GCClipMask:
X+ 	    break;
X+ 	  case GCDashOffset:
X+ 	    break;
X+ 	  case GCDashList:
X+ 	    break;
X+ 	  case GCArcMode:
X+ 	    break;
X+ 	  default:
X+ 	    break;
X+ 	}
X+     }
X+ 
X+     /* deal with the changes we've collected .
X+        new_rrop must be done first because subsequent things
X+        depend on it.
X+     */
X+     if (new_rrop || new_fill)
X+     {
X+ 	rrop = ReduceRop(pGC->alu, pGC->fgPixel);
X+ 	devPriv->rop = rrop;
X+ 	new_fill = TRUE;
X+ 	/* FillArea raster op is GC's for tile filling,
X+ 	   and the reduced rop for solid and stipple
X+ 	*/
X+ 	if (pGC->fillStyle == FillTiled)
X+ 	    devPriv->ropFillArea = pGC->alu;
X+ 	else
X+ 	    devPriv->ropFillArea = rrop;
X+ 
X+ 	/* opaque stipples:
X+ 	   fg	bg	ropOpStip	fill style
X+ 	   1	0	alu		tile
X+ 	   0	1	inverseAlu	tile
X+ 	   1	1	rrop(fg, alu)	solid
X+ 	   0	0	rrop(fg, alu)	solid
X+ 	Note that rrop(fg, alu) == mfbPrivGC.rop, so we don't really need to
X+ 	compute it.
X+ 	*/
X+         if (pGC->fillStyle == FillOpaqueStippled)
X+         {
X+ 	    if (pGC->fgPixel != pGC->bgPixel)
X+ 	    {
X+ 	        if (pGC->fgPixel)
X+ 		    devPriv->ropOpStip = pGC->alu;
X+ 	        else
X+ 		    devPriv->ropOpStip = InverseAlu[pGC->alu];
X+ 	    }
X+ 	    else
X+ 	        devPriv->ropOpStip = rrop;
X+ 	    devPriv->ropFillArea = devPriv->ropOpStip;
X+         }
X+     }
X+     else
X+ 	rrop = devPriv->rop;
X+ 
X+     if (new_line || new_fill)
X+     {
X+ 	if (pGC->lineStyle == LineSolid)
X+ 	{
X+ 	    if(pGC->lineWidth == 0)
X+ 	    {
X+ 	        if (pGC->fillStyle == FillSolid)
X+ 		    pGC->Polylines = mfbLineSS;
X+ 	        else
X+ 		    pGC->Polylines = miZeroLine;
X+ 	    }
X+ 	    else
X+ 	    {
X+ 		pGC->Polylines = miWideLine;
X+ 	    }
X+ 	}
X+ 	else
X+ 	    if(pGC->lineWidth == 0)
X+ 	        pGC->Polylines = mfbDashLine;
X+ 	    else
X+ 	        pGC->Polylines = miWideDash;
X+ 
X+ 	procChanges |= MIBS_POLYLINES;
X+ 
X+ 	switch(pGC->joinStyle)
X+ 	{
X+ 	  case JoinMiter:
X+ 	    pGC->LineHelper = miMiter;
X+ 	    break;
X+ 	  case JoinRound:
X+ 	  case JoinBevel:
X+ 	    pGC->LineHelper = miNotMiter;
X+ 	    break;
X+ 	}
X+     }
X+ 
X+     if (new_text || new_fill)
X+     {
X+ 	if ((pGC->font) &&
X+ 	    (pGC->font->pFI->maxbounds.metrics.rightSideBearing -
X+ 	     pGC->font->pFI->minbounds.metrics.leftSideBearing) > 32)
X+ 	{
X+ 	    pGC->PolyGlyphBlt = miPolyGlyphBlt;
X+ 	    pGC->ImageGlyphBlt = miImageGlyphBlt;
X+ 	}
X+ 	else
X+ 	{
X+ 	    /* special case ImageGlyphBlt for terminal emulator fonts */
X+ 	    if ((pGC->font) &&
X+ 		(pGC->font->pFI->terminalFont) &&
X+ 		(pGC->fgPixel != pGC->bgPixel))
X+ 	    {
X+ 		/* pcc bug makes this not compile...
X+ 		pGC->ImageGlyphBlt = (pGC->fgPixel) ? sunTEGlyphBltWhite :
X+ 						      sunTEGlyphBltBlack;
X+ 		*/
X+ 		if (pGC->fgPixel)
X+ 		    pGC->ImageGlyphBlt = mfbTEGlyphBltWhite;
X+ 		else
X+ 		    pGC->ImageGlyphBlt = mfbTEGlyphBltBlack;
X+ 	    }
X+ 	    else
X+ 	    {
X+ 	        if (pGC->fgPixel == 0)
X+ 		    pGC->ImageGlyphBlt = mfbImageGlyphBltBlack;
X+ 	        else
X+ 		    pGC->ImageGlyphBlt = mfbImageGlyphBltWhite;
X+ 	    }
X+ 
X+ 	    /* now do PolyGlyphBlt */
X+ 	    if (pGC->fillStyle == FillSolid ||
X+ 		(pGC->fillStyle == FillOpaqueStippled &&
X+ 		 pGC->fgPixel == pGC->bgPixel
X+ 		)
X+ 	       )
X+ 	    {
X+ 		if (rrop == RROP_WHITE)
X+ 		    pGC->PolyGlyphBlt = sunPolyGlyphBltWhite;
X+ 		else if (rrop == RROP_BLACK)
X+ 		    pGC->PolyGlyphBlt = sunPolyGlyphBltBlack;
X+ 		else if (rrop == RROP_INVERT)
X+ 		    pGC->PolyGlyphBlt = sunPolyGlyphBltInvert;
X+ 		else
X+ 		    pGC->PolyGlyphBlt = NoopDDA;
X+ 	    }
X+ 	    else
X+ 	    {
X+ 		pGC->PolyGlyphBlt = miPolyGlyphBlt;
X+ 	    }
X+ 	}
X+ 	procChanges |= (MIBS_POLYGLYPHBLT|MIBS_IMAGEGLYPHBLT);
X+     }
X+ 
X+     if (new_fill)
X+     {
X+ 	/* install a suitable fillspans */
X+ 	if ((pGC->fillStyle == FillSolid) ||
X+ 	    (pGC->fillStyle == FillOpaqueStippled && pGC->fgPixel==pGC->bgPixel)
X+ 	   )
X+ 	{
X+ 	    switch(devPriv->rop)
X+ 	    {
X+ 	      case RROP_WHITE:
X+ 		pGC->FillSpans = mfbWhiteSolidFS;
X+ 		procChanges |= MIBS_FILLSPANS;
X+ 		break;
X+ 	      case RROP_BLACK:
X+ 		pGC->FillSpans = mfbBlackSolidFS;
X+ 		procChanges |= MIBS_FILLSPANS;
X+ 		break;
X+ 	      case RROP_INVERT:
X+ 		pGC->FillSpans = mfbInvertSolidFS;
X+ 		procChanges |= MIBS_FILLSPANS;
X+ 		break;
X+ 	      case RROP_NOP:
X+ 		pGC->FillSpans = NoopDDA;
X+ 		break;
X+ 	    }
X+ 	}
X+ 	/* beyond this point, opaqueStippled ==> fg != bg */
X+ 	else if ((pGC->fillStyle==FillTiled &&
X+ 		  (!pGC->tile || pGC->tile->width!=32)) ||
X+ 		 (pGC->fillStyle==FillOpaqueStippled &&
X+ 		  (!pGC->stipple || pGC->stipple->width!=32))
X+ 		)
X+ 	{
X+ 	    pGC->FillSpans = mfbUnnaturalTileFS;
X+ 	    procChanges |= MIBS_FILLSPANS;
X+ 	}
X+ 	else if (pGC->fillStyle == FillStippled &&
X+ 		 (!pGC->stipple || pGC->stipple->width != 32))
X+ 	{
X+ 	    pGC->FillSpans = mfbUnnaturalStippleFS;
X+ 	    procChanges |= MIBS_FILLSPANS;
X+ 	}
X+ 	else if (pGC->fillStyle == FillStippled)
X+ 	{
X+ 	    switch(devPriv->rop)
X+ 	    {
X+ 	      case RROP_WHITE:
X+ 		pGC->FillSpans = mfbWhiteStippleFS;
X+ 		procChanges |= MIBS_FILLSPANS;
X+ 		break;
X+ 	      case RROP_BLACK:
X+ 		pGC->FillSpans = mfbBlackStippleFS;
X+ 		procChanges |= MIBS_FILLSPANS;
X+ 		break;
X+ 	      case RROP_INVERT:
X+ 		pGC->FillSpans = mfbInvertStippleFS;
X+ 		procChanges |= MIBS_FILLSPANS;
X+ 		break;
X+ 	      case RROP_NOP:
X+ 		pGC->FillSpans = NoopDDA;
X+ 		break;
X+ 	    }
X+ 	}
X+ 	else /* overload tiles to do parti-colored opaque stipples */
X+ 	{
X+ 	    pGC->FillSpans = mfbTileFS;
X+ 	    procChanges |= MIBS_FILLSPANS;
X+ 	}
X+ 
X+ 	/* the rectangle code doesn't deal with opaque stipples that
X+ 	   are two colors -- we can fool it for fg==bg, though
X+ 	 */
X+ 	if (((pGC->fillStyle == FillTiled) &&
X+ 	      (!pGC->tile )) ||
X+ 	    ((pGC->fillStyle == FillStippled) &&
X+ 	     (!pGC->stipple )) ||
X+ 	    ((pGC->fillStyle == FillOpaqueStippled) &&
X+ 	     (pGC->fgPixel != pGC->bgPixel))
X+ 	   )
X+ 	{
X+ 	    pGC->PolyFillRect = miPolyFillRect;
X+ 	    devPriv->ppPixmap = &BogusPixmap;
X+ 	}
X+ 	else /* deal with solids and natural stipples and tiles */
X+ 	{
X+ 	    pGC->PolyFillRect = psunPolyFillRect;
X+ 
X+ 	    if ((pGC->fillStyle == FillSolid) ||
X+ 		(pGC->fillStyle == FillOpaqueStippled &&
X+ 		 pGC->fgPixel == pGC->bgPixel)
X+ 	       )
X+ 	    {
X+ 	        devPriv->ppPixmap = &BogusPixmap;
X+ 		switch(devPriv->rop)
X+ 		{
X+ 		  case RROP_WHITE:
X+ 		    devPriv->FillArea = sunSolidWhiteArea;
X+ 		    break;
X+ 		  case RROP_BLACK:
X+ 		    devPriv->FillArea = sunSolidBlackArea;
X+ 		    break;
X+ 		  case RROP_INVERT:
X+ 		    devPriv->FillArea = sunSolidInvertArea;
X+ 		    break;
X+ 		  case RROP_NOP:
X+ 		    devPriv->FillArea = NoopDDA;
X+ 		    break;
X+ 		}
X+ 	    }
X+ 	    else if (pGC->fillStyle == FillStippled)
X+ 	    {
X+ 		devPriv->ppPixmap = &devPriv->pRotatedStipple;
X+ 		switch(devPriv->rop)
X+ 		{
X+ 		  case RROP_WHITE:
X+ 		    devPriv->FillArea = sunStippleWhiteArea;
X+ 		    break;
X+ 		  case RROP_BLACK:
X+ 		    devPriv->FillArea = sunStippleBlackArea;
X+ 		    break;
X+ 		  case RROP_INVERT:
X+ 		    devPriv->FillArea = sunStippleInvertArea;
X+ 		    break;
X+ 		  case RROP_NOP:
X+ 		    devPriv->FillArea = NoopDDA;
X+ 		    break;
X+ 		}
X+ 	    }
X+ 	    else /* deal with tiles */
X+ 	    {
X+ 		if (pGC->fillStyle == FillTiled)
X+ 		    devPriv->ppPixmap = &pGC->tile;
X+ 		else
X+ 		    devPriv->ppPixmap = &pGC->stipple;
X+ 		devPriv->FillArea = sunTileArea;
X+ 	    }
X+ 	} /* end of natural rectangles */
X+ 	procChanges |= MIBS_POLYFILLRECT;
X+     } /* end of new_fill */
X+ 
X+ 
X+     if(new_rotate)
X+     {
X+ 	/* figure out how much to rotate */
X+         xrot = pGC->patOrg.x;
X+         yrot = pGC->patOrg.y;
X+ 	if (pWin)
X+ 	{
X+ 	    xrot += pWin->absCorner.x;
X+ 	    yrot += pWin->absCorner.y;
X+ 	}
X+ 
X+ 	/* destroy any previously rotated tile or stipple */
X+ 	if(devPriv->pRotatedTile)
X+ 	{
X+ 	    mfbDestroyPixmap(devPriv->pRotatedTile);
X+ 	    devPriv->pRotatedTile = (PixmapPtr)NULL;
X+ 	}
X+ 	if(devPriv->pRotatedStipple)
X+ 	{
X+ 	    mfbDestroyPixmap(devPriv->pRotatedStipple);
X+ 	    devPriv->pRotatedStipple = (PixmapPtr)NULL;
X+ 	}
X+ 
X+ 	/* copy current tile and stipple */
X+         if(pGC->tile &&
X+ 	   (pGC->tile->width == 32) &&
X+ 	   (devPriv->pRotatedTile = mfbCopyPixmap(pGC->tile)) ==
X+ 	       (PixmapPtr)NULL)
X+ 	    return ;           /* shouldn't happen, internal error */
X+         if(pGC->stipple &&
X+ 	   (pGC->stipple->width == 32) &&
X+ 	   (devPriv->pRotatedStipple = mfbCopyPixmap(pGC->stipple)) ==
X+ 	       (PixmapPtr)NULL)
X+ 	    return ;          /* shouldn't happen, internal error */
X+ 
X+         if(xrot)
X+         {
X+ 	    if (pGC->tile && pGC->tile->width == 32 && 
X+ 	        devPriv->pRotatedTile)
X+ 	        mfbXRotatePixmap(devPriv->pRotatedTile, xrot); 
X+ 	    if (pGC->stipple && pGC->stipple->width == 32 && 
X+ 	        devPriv->pRotatedStipple)
X+ 	        mfbXRotatePixmap(devPriv->pRotatedStipple, xrot); 
X+         }
X+         if(yrot)
X+         {
X+ 	    if (pGC->tile && pGC->tile->width == 32 && 
X+ 	        devPriv->pRotatedTile)
X+ 	        mfbYRotatePixmap(devPriv->pRotatedTile, yrot); 
X+ 	    if (pGC->stipple && pGC->stipple->width == 32 &&
X+ 	        devPriv->pRotatedStipple)
X+ 	        mfbYRotatePixmap(devPriv->pRotatedStipple, yrot); 
X+         }
X+     }
X+    if (pGC->fillStyle == FillSolid && pGC->clientClipType == CT_NONE)
X+      pGC->PushPixels = psunPushPixels;
X+ 
X+ 
X+     /*
X+      * If this GC has ever been used with a window with backing-store enabled,
X+      * we must call miVaidateBackingStore to keep the backing-store module
X+      * up-to-date, should this GC be used with that drawable again. In addition,
X+      * if the current drawable is a window and has backing-store enabled, we
X+      * also call miValidateBackingStore to give it a chance to get its hooks in.
X+      */
X+     if (pGC->devBackingStore ||
X+ 	(pWin && (pWin->backingStore != NotUseful)))
X+     {
X+ 	miValidateBackingStore(pDrawable, pGC, procChanges);
X+     }
X+ 
X+ 
X+     return ;
X+ }
X+ 
X+ 
END_OF_FILE
if test 22966 -ne `wc -c <'psungc.c.patch'`; then
    echo shar: \"'psungc.c.patch'\" unpacked with wrong size!
fi
# end of 'psungc.c.patch'
fi
if test -f 'psunscrinit.c.patch' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'psunscrinit.c.patch'\"
else
echo shar: Extracting \"'psunscrinit.c.patch'\" \(6373 characters\)
sed "s/^X//" >'psunscrinit.c.patch' <<'END_OF_FILE'
X*** psunscrinit.c.slow	Tue Aug  1 09:49:21 1989
X--- psunscrinit.c	Tue Apr 25 13:35:44 1989
X***************
X*** 0 ****
X--- 1,170 ----
X+ /***********************************************************
X+ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
X+ and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
X+ 
X+                         All Rights Reserved
X+ 
X+ Permission to use, copy, modify, and distribute this software and its 
X+ documentation for any purpose and without fee is hereby granted, 
X+ provided that the above copyright notice appear in all copies and that
X+ both that copyright notice and this permission notice appear in 
X+ supporting documentation, and that the names of Digital or MIT not be
X+ used in advertising or publicity pertaining to distribution of the
X+ software without specific, written prior permission.  
X+ 
X+ DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X+ ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X+ DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X+ ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X+ SOFTWARE.
X+ 
X+ ******************************************************************/
X+ /* $XConsortium: mfbscrinit.c,v 1.57 88/10/02 15:08:27 rws Exp $ */
X+ 
X+ #include "X.h"
X+ #include "Xproto.h"	/* for xColorItem */
X+ #include "Xmd.h"
X+ #include "scrnintstr.h"
X+ #include "pixmapstr.h"
X+ #include "resource.h"
X+ #include "colormap.h"
X+ #include "sun.h"
X+ #include "mistruct.h"
X+ #include "dix.h"
X+ 
X+ #include "servermd.h"
X+ 
X+ /*ARGSUSED*/
X+ static 
X+ mfbFreeVisual(p, id)
X+     pointer p;
X+     int id;
X+ {
X+     xfree(p);
X+ }
X+ 
X+ /* dts * (inch/dot) * (25.4 mm / inch) = mm */
X+ Bool
X+ psunScreenInit(index, pScreen, pbits, xsize, ysize, dpix, dpiy)
X+     int index;
X+     register ScreenPtr pScreen;
X+     pointer pbits;		/* pointer to screen bitmap */
X+     int xsize, ysize;		/* in pixels */
X+     int dpix, dpiy;		/* dots per inch */
X+ {
X+     DepthPtr	pDepth;
X+     VisualPtr	pVisual;
X+     VisualID	*pVids;
X+     register PixmapPtr pPixmap;
X+ 
X+     pScreen->myNum = index;
X+     pScreen->width = xsize;
X+     pScreen->height = ysize;
X+     pScreen->mmWidth = (xsize * 254) / (dpix * 10);
X+     pScreen->mmHeight = (ysize * 254) / (dpiy * 10);
X+     pScreen->numDepths = 1;
X+     pScreen->allowedDepths = pDepth = (DepthPtr) xalloc(sizeof(DepthRec));
X+ 
X+     pScreen->rootDepth = 1;
X+     pScreen->rootVisual = FakeClientID(0);
X+     pScreen->defColormap = (Colormap) FakeClientID(0);
X+     pScreen->minInstalledCmaps = 1;
X+     pScreen->maxInstalledCmaps = 1;
X+     pScreen->whitePixel = 1;
X+     pScreen->blackPixel = 0;
X+     pScreen->backingStoreSupport = Always;
X+     pScreen->saveUnderSupport = NotUseful;
X+ 
X+     /* cursmin and cursmax are device specific */
X+ 
X+     pScreen->numVisuals = 1;
X+     pScreen->visuals = pVisual = (VisualPtr) xalloc(sizeof (VisualRec));
X+ 
X+     pPixmap = (PixmapPtr )xalloc(sizeof(PixmapRec));
X+     pPixmap->drawable.type = DRAWABLE_PIXMAP;
X+     pPixmap->drawable.depth = 1;
X+     pPixmap->drawable.pScreen = pScreen;
X+     pPixmap->drawable.serialNumber = 0;
X+     pPixmap->width = xsize;
X+     pPixmap->height = ysize;
X+     pPixmap->refcnt = 1;
X+     pPixmap->devPrivate = pbits;
X+     pPixmap->devKind = PixmapBytePad(xsize, 1);
X+     pScreen->devPrivate = (pointer)pPixmap;
X+ 
X+     /* anything that mfb doesn't know about is assumed to be done
X+        elsewhere.  (we put in no-op only for things that we KNOW
X+        are really no-op.
X+     */
X+     /*	pScreen->CreateWindow = mfbCreateWindow;
X+     **	use a faster, sun-specific routine -- CMC
X+     */
X+     {	extern Bool psunCreateWindow();
X+ 	pScreen->CreateWindow = psunCreateWindow;
X+     }
X+     pScreen->DestroyWindow = mfbDestroyWindow;
X+     pScreen->PositionWindow = mfbPositionWindow;
X+     pScreen->ChangeWindowAttributes = mfbChangeWindowAttributes;
X+     pScreen->RealizeWindow = mfbMapWindow;
X+     pScreen->UnrealizeWindow = mfbUnmapWindow;
X+ 
X+     pScreen->RealizeFont = mfbRealizeFont;
X+     pScreen->UnrealizeFont = mfbUnrealizeFont;
X+     pScreen->GetImage = mfbGetImage;
X+     pScreen->GetSpans = mfbGetSpans;
X+     pScreen->CreateGC = psunCreateGC;
X+     pScreen->CreatePixmap = mfbCreatePixmap;
X+     pScreen->DestroyPixmap = mfbDestroyPixmap;
X+     pScreen->ValidateTree = miValidateTree;
X+ 
X+     pScreen->InstallColormap = mfbInstallColormap;
X+     pScreen->UninstallColormap = mfbUninstallColormap;
X+     pScreen->ListInstalledColormaps = mfbListInstalledColormaps;
X+     pScreen->StoreColors = NoopDDA;
X+ 
X+     pScreen->RegionCreate = miRegionCreate;
X+     pScreen->RegionCopy = miRegionCopy;
X+     pScreen->RegionDestroy = miRegionDestroy;
X+     pScreen->Intersect = miIntersect;
X+     pScreen->Inverse = miInverse;
X+     pScreen->Union = miUnion;
X+     pScreen->Subtract = miSubtract;
X+     pScreen->RegionReset = miRegionReset;
X+     pScreen->TranslateRegion = miTranslateRegion;
X+     pScreen->RectIn = miRectIn;
X+     pScreen->PointInRegion = miPointInRegion;
X+     pScreen->WindowExposures = miWindowExposures;
X+     pScreen->RegionNotEmpty = miRegionNotEmpty;
X+     pScreen->RegionEmpty = miRegionEmpty;
X+     pScreen->RegionExtents = miRegionExtents;
X+     pScreen->SendGraphicsExpose = miSendGraphicsExpose;
X+ 
X+     pScreen->BlockHandler = NoopDDA;
X+     pScreen->WakeupHandler = NoopDDA;
X+     pScreen->blockData = (pointer)0;
X+     pScreen->wakeupData = (pointer)0;
X+ 
X+     pVisual->vid = pScreen->rootVisual;
X+     pVisual->screen = index;
X+     pVisual->class = StaticGray;
X+     pVisual->redMask = 0;
X+     pVisual->greenMask = 0;
X+     pVisual->blueMask = 0;
X+     pVisual->bitsPerRGBValue = 1;
X+     pVisual->ColormapEntries = 2;
X+ 
X+     pDepth->depth = 1;
X+     pDepth->numVids = 1;
X+     pDepth->vids = pVids = (VisualID *) xalloc(sizeof (VisualID));
X+     pVids[0] = pScreen->rootVisual;	/* our one and only visual */
X+     AddResource(
X+ 	pScreen->rootVisual, RT_VISUALID, (pointer)pVisual, mfbFreeVisual, RC_CORE);
X+ 
X+     /* we MIGHT return 0 if we had been keeping track of potential
X+        allocation failures.  one day someone will clean this up.
X+     */
X+     return 1;
X+ }
X+ 
END_OF_FILE
if test 6373 -ne `wc -c <'psunscrinit.c.patch'`; then
    echo shar: \"'psunscrinit.c.patch'\" unpacked with wrong size!
fi
# end of 'psunscrinit.c.patch'
fi
if test -f 'psunwindow.c.patch' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'psunwindow.c.patch'\"
else
echo shar: Extracting \"'psunwindow.c.patch'\" \(2304 characters\)
sed "s/^X//" >'psunwindow.c.patch' <<'END_OF_FILE'
X*** psunwindow.c.slow	Tue Aug  1 09:49:21 1989
X--- psunwindow.c	Tue Apr 25 13:43:50 1989
X***************
X*** 0 ****
X--- 1,55 ----
X+ /* $XConsortium: mfbwindow.c,v 1.10 88/10/20 20:02:34 keith Exp $ */
X+ /***********************************************************
X+ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
X+ and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
X+ 
X+                         All Rights Reserved
X+ 
X+ Permission to use, copy, modify, and distribute this software and its 
X+ documentation for any purpose and without fee is hereby granted, 
X+ provided that the above copyright notice appear in all copies and that
X+ both that copyright notice and this permission notice appear in 
X+ supporting documentation, and that the names of Digital or MIT not be
X+ used in advertising or publicity pertaining to distribution of the
X+ software without specific, written prior permission.  
X+ 
X+ DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X+ ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
X+ DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X+ ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X+ SOFTWARE.
X+ 
X+ ******************************************************************/
X+ 
X+ #include "X.h"
X+ #include "scrnintstr.h"
X+ #include "windowstr.h"
X+ #include "sun.h"
X+ #include "mistruct.h"
X+ #include "regionstr.h"
X+ 
X+ extern WindowRec WindowTable[];
X+ 
X+ Bool psunCreateWindow(pWin)
X+ register WindowPtr pWin;
X+ {
X+     register mfbPrivWin *pPrivWin;
X+ 
X+     pWin->ClearToBackground = miClearToBackground;
X+     pWin->PaintWindowBackground = mfbPaintWindowNone;
X+     pWin->PaintWindowBorder = mfbPaintWindowPR;
X+ 
X+ 	pWin->CopyWindow = psunCopyWindow;	/* faster BW2 version -- CMC */
X+ 
X+     if(!(pPrivWin = (mfbPrivWin *)Xalloc(sizeof(mfbPrivWin))))
X+ 	 return (FALSE);
X+     pWin->devPrivate = (pointer)pPrivWin;
X+     pPrivWin->pRotatedBorder = NullPixmap;
X+     pPrivWin->pRotatedBackground = NullPixmap;
X+     pPrivWin->fastBackground = 0;
X+     pPrivWin->fastBorder = 0;
X+ 
X+     return (TRUE);
X+ }
END_OF_FILE
if test 2304 -ne `wc -c <'psunwindow.c.patch'`; then
    echo shar: \"'psunwindow.c.patch'\" unpacked with wrong size!
fi
# end of 'psunwindow.c.patch'
fi
if test -f 'sun.h.patch' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'sun.h.patch'\"
else
echo shar: Extracting \"'sun.h.patch'\" \(2241 characters\)
sed "s/^X//" >'sun.h.patch' <<'END_OF_FILE'
X*** sun.h.slow	Tue Apr 25 10:04:41 1989
X--- sun.h	Tue Apr 25 15:34:23 1989
X***************
X*** 212,217 ****
X--- 212,231 ----
X      pointer 	  	fbPriv;	    /* Frame-buffer-dependent data */
X  } fbFd;
X  
X+ 
X+ #ifdef RAL
X+ /* Private GC for sun. There is a fill area routine which takes advantage
X+  * of the Suns pixrect routines. The sunPrivGC struct has a pointer to this
X+  * in addition to the original GC pointer.
X+  */
X+ typedef struct {
X+     void 	(* FillArea)();		/* fills regions; look at the code */
X+     GCPtr   	  	pGC;	    /* GC for realizing cursors */
X+     } sunPrivGC;
X+ 
X+ typedef sunPrivGC	*sunPrivGCPtr;
X+ #endif RAL
X+ 
X  /*
X   * Data describing each type of frame buffer. The probeProc is called to
X   * see if such a device exists and to do what needs doing if it does. devName
X***************
X*** 252,257 ****
X--- 266,275 ----
X  extern void 	  sunRemoveCursor();
X  extern void	  sunRestoreCursor();
X  extern void 	  sunMoveCursor();
X+ #ifdef RAL
X+  extern Bool 	  psunScreenInit();
X+ extern void 	psunCopyWindow();
X+ #endif
X  
X  /*
X   * Initialization
X***************
X*** 270,275 ****
X--- 288,322 ----
X  extern void 	  sunGetImage();
X  extern unsigned int *sunGetSpans();
X  
X+ #ifdef RAL
X+ /* Set of routines to handle the extended private Sun gc.
X+  */
X+ extern Bool	  psunCreateGC();
X+ extern RegionPtr	psunCopyArea();
X+ extern RegionPtr	psunCopyPlane();
X+ extern void	psunPolyFillRect();
X+ extern void	sunSolidInvertArea();
X+ extern void	sunSolidWhiteArea();
X+ extern void	sunSolidBlackArea();
X+ extern void	sunStippleWhiteArea();
X+ extern void	sunStippleBlackArea();
X+ extern void	sunStippleInvertArea();
X+ extern void	psunValidateGC();
X+ extern void	sunTEGlyphBltWhite();
X+ extern void	sunTEGlyphBltBlack();
X+ extern void	sunPolyGlyphBltWhite();
X+ extern void	sunPolyGlyphBltBlack();
X+ extern void	sunPolyGlyphBltInvert();
X+ extern void	psunPushPixels();
X+ 
X+ /* Faster Sun functions that use pixrects on monochrome */
X+ extern void	sunSolidWhiteArea();
X+ extern void	sunSolidBlackArea();
X+ extern void     sunSolidInvertArea();
X+ extern void	sunTileArea();
X+ extern void	psunFillRect();
X+   
X+ #endif RAL
X  extern int	  isItTimeToYield;
X  extern int  	  sunCheckInput;    /* Non-zero if input is available */
X  
END_OF_FILE
if test 2241 -ne `wc -c <'sun.h.patch'`; then
    echo shar: \"'sun.h.patch'\" unpacked with wrong size!
fi
# end of 'sun.h.patch'
fi
echo shar: End of archive 2 \(of 3\).
cp /dev/null ark2isdone
MISSING=""
for I in 1 2 3 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 3 archives.
    echo "Now read README.ral"
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0