spaf@PURDUE.EDU (Gene Spafford) (10/08/88)
Index: gcc 1.29 + fix in reload1.c from RMS, Sun 3/280, SunOS 3.4 The -O option in the following causes gcc to dump core with a signal 6 when compiling X windows code server/ddx/mi/mibstore.c gcc -c -O -m68881 -traditional -fcombine-regs -finline-functions -fstrength-reduce -I. -I../../include -I./../../../X11 -DCOMPRESSED_FONTS -DPURDUE mibstore.c The core file is corrupted and neither gdb nor dbx can do a "where". Code follows: # 1 "mibstore.c" static char rcsid[] = "$Header: mibstore.c,v 1.9 88/02/26 18:34:21 deboor Exp $ SPRITE (Berkeley)"; # 1 "./../../../X11/X.h" typedef unsigned long XID; typedef XID Window; typedef XID Drawable; typedef XID Font; typedef XID Pixmap; typedef XID Cursor; typedef XID Colormap; typedef XID GContext; typedef XID KeySym; typedef unsigned long Mask; typedef unsigned long Atom; typedef unsigned long VisualID; typedef unsigned long Time; typedef unsigned char KeyCode; # 311 "./../../../X11/X.h" # 31 "mibstore.c" # 1 "./../../../X11/Xmd.h" typedef long INT32; typedef short INT16; typedef char INT8; typedef unsigned long CARD32; typedef unsigned short CARD16; typedef unsigned char CARD8; typedef unsigned long BITS32; typedef unsigned short BITS16; typedef unsigned char BYTE; typedef unsigned char BOOL; # 32 "mibstore.c" # 1 "./../../../X11/Xproto.h" # 1 "./../../../X11/Xmd.h" # 60 "./../../../X11/Xmd.h" # 53 "./../../../X11/Xproto.h" # 1 "./../../../X11/Xprotostr.h" # 1 "./../../../X11/Xmd.h" # 60 "./../../../X11/Xmd.h" # 28 "./../../../X11/Xprotostr.h" typedef struct _xSegment { INT16 x1 , y1 , x2 , y2 ; } xSegment; typedef struct _xPoint { INT16 x , y ; } xPoint; typedef struct _xRectangle { INT16 x , y ; CARD16 width , height ; } xRectangle; typedef struct _xArc { INT16 x , y ; CARD16 width , height ; INT16 angle1 , angle2 ; } xArc; # 54 "./../../../X11/Xproto.h" typedef CARD16 KeyButMask; typedef struct { CARD8 byteOrder; BYTE pad; CARD16 majorVersion , minorVersion ; CARD16 nbytesAuthProto ; CARD16 nbytesAuthString ; CARD16 pad2; } xConnClientPrefix; typedef struct { BOOL success; BYTE lengthReason; CARD16 majorVersion , minorVersion ; CARD16 length ; } xConnSetupPrefix; typedef struct { CARD32 release ; CARD32 ridBase , ridMask ; CARD32 motionBufferSize ; CARD16 nbytesVendor ; CARD16 maxRequestSize ; CARD8 numRoots; CARD8 numFormats; CARD8 imageByteOrder; CARD8 bitmapBitOrder; CARD8 bitmapScanlineUnit, bitmapScanlinePad; CARD8 minKeyCode, maxKeyCode; CARD32 pad2 ; } xConnSetup; typedef struct { CARD8 depth; CARD8 bitsPerPixel; CARD8 scanLinePad; CARD8 pad1; CARD32 pad2 ; } xPixmapFormat; typedef struct { CARD8 depth; CARD8 pad1; CARD16 nVisuals ; CARD32 pad2 ; } xDepth; typedef struct { CARD32 visualID ; CARD8 class; CARD8 bitsPerRGB; CARD16 colormapEntries ; CARD32 redMask , greenMask , blueMask ; CARD32 pad ; } xVisualType; typedef struct { CARD32 windowId ; CARD32 defaultColormap ; CARD32 whitePixel , blackPixel ; CARD32 currentInputMask ; CARD16 pixWidth , pixHeight ; CARD16 mmWidth , mmHeight ; CARD16 minInstalledMaps , maxInstalledMaps ; CARD32 rootVisualID ; CARD8 backingStore; BOOL saveUnders; CARD8 rootDepth; CARD8 nDepths; } xWindowRoot; typedef struct { CARD32 time ; CARD16 x , y ; } xTimecoord; typedef struct { CARD8 family; BYTE pad; CARD16 length ; } xHostEntry; typedef struct { INT16 leftSideBearing , rightSideBearing , characterWidth , ascent , descent ; CARD16 attributes ; } xCharInfo; typedef struct { CARD32 name ; CARD32 value ; } xFontProp; typedef struct { CARD8 len; INT8 delta; } xTextElt; typedef struct { CARD32 pixel ; CARD16 red , green , blue ; CARD8 flags; CARD8 pad; } xColorItem; typedef struct { CARD16 red , green , blue , pad ; } xrgb; typedef CARD8 KEYCODE; # 778 "./../../../X11/Xproto.h" typedef struct { BYTE type; BYTE errorCode; CARD16 sequenceNumber ; CARD32 resourceID ; CARD16 minorCode ; CARD8 majorCode; BYTE pad1; CARD32 pad3 ; CARD32 pad4 ; CARD32 pad5 ; CARD32 pad6 ; CARD32 pad7 ; } xError; typedef struct { union { struct { BYTE type; BYTE detail; CARD16 sequenceNumber ; } u; struct { CARD32 pad00 ; CARD32 time ; CARD32 root , event , child ; INT16 rootX , rootY , eventX , eventY ; KeyButMask state ; BOOL sameScreen; BYTE pad1; } keyButtonPointer; struct { CARD32 pad00 ; CARD32 time ; CARD32 root , event , child ; INT16 rootX , rootY , eventX , eventY ; KeyButMask state ; BYTE mode; BYTE flags; } enterLeave; struct { CARD32 pad00 ; CARD32 window ; BYTE mode; BYTE pad1, pad2, pad3; } focus; struct { CARD32 pad00 ; CARD32 window ; CARD16 x , y , width , height ; CARD16 count ; CARD16 pad2 ; } expose; struct { CARD32 pad00 ; CARD32 drawable ; CARD16 x , y , width , height ; CARD16 minorEvent ; CARD16 count ; BYTE majorEvent; BYTE pad1, pad2, pad3; } graphicsExposure; struct { CARD32 pad00 ; CARD32 drawable ; CARD16 minorEvent ; BYTE majorEvent; BYTE bpad; } noExposure; struct { CARD32 pad00 ; CARD32 window ; CARD8 state; BYTE pad1, pad2, pad3; } visibility; struct { CARD32 pad00 ; CARD32 parent , window ; INT16 x , y ; CARD16 width , height , borderWidth ; BOOL override; BYTE bpad; } createNotify; struct { CARD32 pad00 ; CARD32 event , window ; } destroyNotify; struct { CARD32 pad00 ; CARD32 event , window ; BOOL fromConfigure; BYTE pad1, pad2, pad3; } unmapNotify; struct { CARD32 pad00 ; CARD32 event , window ; BOOL override; BYTE pad1, pad2, pad3; } mapNotify; struct { CARD32 pad00 ; CARD32 parent , window ; } mapRequest; struct { CARD32 pad00 ; CARD32 event , window , parent ; INT16 x , y ; BOOL override; BYTE pad1, pad2, pad3; } reparent; struct { CARD32 pad00 ; CARD32 event , window , aboveSibling ; INT16 x , y ; CARD16 width , height , borderWidth ; BOOL override; BYTE bpad; } configureNotify; struct { CARD32 pad00 ; CARD32 parent , window , sibling ; INT16 x , y ; CARD16 width , height , borderWidth ; CARD16 valueMask ; CARD32 pad1 ; } configureRequest; struct { CARD32 pad00 ; CARD32 event , window ; INT16 x , y ; CARD32 pad1, pad2, pad3, pad4; } gravity; struct { CARD32 pad00 ; CARD32 window ; CARD16 width , height ; } resizeRequest; struct { CARD32 pad00 ; CARD32 event , window , parent ; BYTE place; BYTE pad1, pad2, pad3; } circulate; struct { CARD32 pad00 ; CARD32 window ; CARD32 atom ; CARD32 time ; BYTE state; BYTE pad1; CARD16 pad2 ; } property; struct { CARD32 pad00 ; CARD32 time ; CARD32 window ; CARD32 atom ; } selectionClear; struct { CARD32 pad00 ; CARD32 time ; CARD32 owner , requestor ; CARD32 selection , target , property ; } selectionRequest; struct { CARD32 pad00 ; CARD32 time ; CARD32 requestor ; CARD32 selection , target , property ; } selectionNotify; struct { CARD32 pad00 ; CARD32 window ; CARD32 colormap ; BOOL new; BYTE state; BYTE pad1, pad2; } colormap; struct { CARD32 pad00 ; CARD8 request; CARD8 firstKeyCode; CARD8 count; BYTE pad1; } mappingNotify; struct { CARD32 pad00 ; CARD32 window ; union { struct { CARD32 type ; INT32 longs0 ; INT32 longs1 ; INT32 longs2 ; INT32 longs3 ; INT32 longs4 ; } l; struct { CARD32 type ; INT16 shorts0 ; INT16 shorts1 ; INT16 shorts2 ; INT16 shorts3 ; INT16 shorts4 ; INT16 shorts5 ; INT16 shorts6 ; INT16 shorts7 ; INT16 shorts8 ; INT16 shorts9 ; } s; struct { CARD32 type ; INT8 bytes[20]; } b; } u; } clientMessage; } u; } xEvent; typedef struct { BYTE type; BYTE map[31]; } xKeymapEvent; # 1091 "./../../../X11/Xproto.h" typedef struct { CARD8 reqType; CARD8 data; CARD16 length ; } xReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 id ; } xResourceReq; typedef struct { CARD8 reqType; CARD8 depth; CARD16 length ; CARD32 wid , parent ; INT16 x , y ; CARD16 width , height , borderWidth ; CARD16 class ; CARD32 visual ; CARD32 mask ; } xCreateWindowReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 window ; CARD32 valueMask ; } xChangeWindowAttributesReq; typedef struct { CARD8 reqType; BYTE mode; CARD16 length ; CARD32 window ; } xChangeSaveSetReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 window , parent ; INT16 x , y ; } xReparentWindowReq; typedef struct { CARD8 reqType; CARD8 pad; CARD16 length ; CARD32 window ; CARD16 mask ; CARD16 pad2 ; } xConfigureWindowReq; typedef struct { CARD8 reqType; CARD8 direction; CARD16 length ; CARD32 window ; } xCirculateWindowReq; typedef struct { CARD8 reqType; BOOL onlyIfExists; CARD16 length ; CARD16 nbytes ; CARD16 pad ; } xInternAtomReq; typedef struct { CARD8 reqType; CARD8 mode; CARD16 length ; CARD32 window ; CARD32 property , type ; CARD8 format; BYTE pad[3]; CARD32 nUnits ; } xChangePropertyReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 window ; CARD32 property ; } xDeletePropertyReq; typedef struct { CARD8 reqType; BOOL delete; CARD16 length ; CARD32 window ; CARD32 property , type ; CARD32 longOffset ; CARD32 longLength ; } xGetPropertyReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 window ; CARD32 selection ; CARD32 time ; } xSetSelectionOwnerReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 requestor ; CARD32 selection , target , property ; CARD32 time ; } xConvertSelectionReq; typedef struct { CARD8 reqType; BOOL propagate; CARD16 length ; CARD32 destination ; CARD32 eventMask ; xEvent event; } xSendEventReq; typedef struct { CARD8 reqType; BOOL ownerEvents; CARD16 length ; CARD32 grabWindow ; CARD16 eventMask ; BYTE pointerMode, keyboardMode; CARD32 confineTo ; CARD32 cursor ; CARD32 time ; } xGrabPointerReq; typedef struct { CARD8 reqType; BOOL ownerEvents; CARD16 length ; CARD32 grabWindow ; CARD16 eventMask ; BYTE pointerMode, keyboardMode; CARD32 confineTo ; CARD32 cursor ; CARD8 button; BYTE pad; CARD16 modifiers ; } xGrabButtonReq; typedef struct { CARD8 reqType; CARD8 button; CARD16 length ; CARD32 grabWindow ; CARD16 modifiers ; CARD16 pad ; } xUngrabButtonReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 cursor ; CARD32 time ; CARD16 eventMask ; CARD16 pad2 ; } xChangeActivePointerGrabReq; typedef struct { CARD8 reqType; BOOL ownerEvents; CARD16 length ; CARD32 grabWindow ; CARD32 time ; BYTE pointerMode, keyboardMode; CARD16 pad ; } xGrabKeyboardReq; typedef struct { CARD8 reqType; BOOL ownerEvents; CARD16 length ; CARD32 grabWindow ; CARD16 modifiers ; CARD8 key; BYTE pointerMode, keyboardMode; BYTE pad1, pad2, pad3; } xGrabKeyReq; typedef struct { CARD8 reqType; CARD8 key; CARD16 length ; CARD32 grabWindow ; CARD16 modifiers ; CARD16 pad ; } xUngrabKeyReq; typedef struct { CARD8 reqType; CARD8 mode; CARD16 length ; CARD32 time ; } xAllowEventsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 window ; CARD32 start , stop ; } xGetMotionEventsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 srcWid , dstWid ; INT16 srcX , srcY ; } xTranslateCoordsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 srcWid , dstWid ; INT16 srcX , srcY ; CARD16 srcWidth , srcHeight ; INT16 dstX , dstY ; } xWarpPointerReq; typedef struct { CARD8 reqType; CARD8 revertTo; CARD16 length ; CARD32 focus ; CARD32 time ; } xSetInputFocusReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 fid ; CARD16 nbytes ; BYTE pad1, pad2; } xOpenFontReq; typedef struct { CARD8 reqType; BOOL oddLength; CARD16 length ; CARD32 fid ; } xQueryTextExtentsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD16 maxNames ; CARD16 nbytes ; } xListFontsReq; typedef xListFontsReq xListFontsWithInfoReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD16 nFonts ; BYTE pad1, pad2; } xSetFontPathReq; typedef struct { CARD8 reqType; CARD8 depth; CARD16 length ; CARD32 pid ; CARD32 drawable ; CARD16 width , height ; } xCreatePixmapReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 gc ; CARD32 drawable ; CARD32 mask ; } xCreateGCReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 gc ; CARD32 mask ; } xChangeGCReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 srcGC , dstGC ; CARD32 mask ; } xCopyGCReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 gc ; CARD16 dashOffset ; CARD16 nDashes ; } xSetDashesReq; typedef struct { CARD8 reqType; BYTE ordering; CARD16 length ; CARD32 gc ; INT16 xOrigin , yOrigin ; } xSetClipRectanglesReq; typedef struct { CARD8 reqType; BOOL exposures; CARD16 length ; CARD32 window ; INT16 x , y ; CARD16 width , height ; } xClearAreaReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 srcDrawable , dstDrawable ; CARD32 gc ; INT16 srcX , srcY , dstX , dstY ; CARD16 width , height ; } xCopyAreaReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 srcDrawable , dstDrawable ; CARD32 gc ; INT16 srcX , srcY , dstX , dstY ; CARD16 width , height ; CARD32 bitPlane ; } xCopyPlaneReq; typedef struct { CARD8 reqType; BYTE coordMode; CARD16 length ; CARD32 drawable ; CARD32 gc ; } xPolyPointReq; typedef xPolyPointReq xPolyLineReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 drawable ; CARD32 gc ; } xPolySegmentReq; typedef xPolySegmentReq xPolyArcReq; typedef xPolySegmentReq xPolyRectangleReq; typedef xPolySegmentReq xPolyFillRectangleReq; typedef xPolySegmentReq xPolyFillArcReq; typedef struct _FillPolyReq { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 drawable ; CARD32 gc ; BYTE shape; BYTE coordMode; CARD16 pad1 ; } xFillPolyReq; typedef struct _PutImageReq { CARD8 reqType; CARD8 format; CARD16 length ; CARD32 drawable ; CARD32 gc ; CARD16 width , height ; INT16 dstX , dstY ; CARD8 leftPad; CARD8 depth; CARD16 pad ; } xPutImageReq; typedef struct { CARD8 reqType; CARD8 format; CARD16 length ; CARD32 drawable ; INT16 x , y ; CARD16 width , height ; CARD32 planeMask ; } xGetImageReq; typedef struct { CARD8 reqType; CARD8 pad; CARD16 length ; CARD32 drawable ; CARD32 gc ; INT16 x , y ; } xPolyTextReq; typedef xPolyTextReq xPolyText8Req; typedef xPolyTextReq xPolyText16Req; typedef struct { CARD8 reqType; BYTE nChars; CARD16 length ; CARD32 drawable ; CARD32 gc ; INT16 x , y ; } xImageTextReq; typedef xImageTextReq xImageText8Req; typedef xImageTextReq xImageText16Req; typedef struct { CARD8 reqType; BYTE alloc; CARD16 length ; CARD32 mid ; CARD32 window ; CARD32 visual ; } xCreateColormapReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 mid ; CARD32 srcCmap ; } xCopyColormapAndFreeReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 cmap ; CARD16 red , green , blue ; CARD16 pad2 ; } xAllocColorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 cmap ; CARD16 nbytes ; BYTE pad1, pad2; } xAllocNamedColorReq; typedef struct { CARD8 reqType; BOOL contiguous; CARD16 length ; CARD32 cmap ; CARD16 colors , planes ; } xAllocColorCellsReq; typedef struct { CARD8 reqType; BOOL contiguous; CARD16 length ; CARD32 cmap ; CARD16 colors , red , green , blue ; } xAllocColorPlanesReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 cmap ; CARD32 planeMask ; } xFreeColorsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 cmap ; } xStoreColorsReq; typedef struct { CARD8 reqType; CARD8 flags; CARD16 length ; CARD32 cmap ; CARD32 pixel ; CARD16 nbytes ; BYTE pad1, pad2; } xStoreNamedColorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 cmap ; } xQueryColorsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 cmap ; CARD16 nbytes ; BYTE pad1, pad2; } xLookupColorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 cid ; CARD32 source , mask ; CARD16 foreRed , foreGreen , foreBlue ; CARD16 backRed , backGreen , backBlue ; CARD16 x , y ; } xCreateCursorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 cid ; CARD32 source , mask ; CARD16 sourceChar , maskChar ; CARD16 foreRed , foreGreen , foreBlue ; CARD16 backRed , backGreen , backBlue ; } xCreateGlyphCursorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 cursor ; CARD16 foreRed , foreGreen , foreBlue ; CARD16 backRed , backGreen , backBlue ; } xRecolorCursorReq; typedef struct { CARD8 reqType; CARD8 class; CARD16 length ; CARD32 drawable ; CARD16 width , height ; } xQueryBestSizeReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD16 nbytes ; BYTE pad1, pad2; } xQueryExtensionReq; typedef struct { CARD8 reqType; CARD8 numKeyPerModifier; CARD16 length ; } xSetModifierMappingReq; typedef struct { CARD8 reqType; CARD8 nElts; CARD16 length ; } xSetPointerMappingReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD8 firstKeyCode; CARD8 count; CARD16 pad1 ; } xGetKeyboardMappingReq; typedef struct { CARD8 reqType; CARD8 keyCodes; CARD16 length ; CARD8 firstKeyCode; CARD8 keySymsPerKeyCode; CARD16 pad1 ; } xChangeKeyboardMappingReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 mask ; } xChangeKeyboardControlReq; typedef struct { CARD8 reqType; INT8 percent; CARD16 length ; } xBellReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; INT16 accelNum , accelDenum ; INT16 threshold ; BOOL doAccel, doThresh; } xChangePointerControlReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; INT16 timeout , interval ; BYTE preferBlank, allowExpose; CARD16 pad2 ; } xSetScreenSaverReq; typedef struct { CARD8 reqType; BYTE mode; CARD16 length ; CARD8 hostFamily; BYTE pad; CARD16 hostLength ; } xChangeHostsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; } xListHostsReq; typedef struct { CARD8 reqType; BYTE mode; CARD16 length ; } xChangeModeReq; typedef xChangeModeReq xSetAccessControlReq; typedef xChangeModeReq xSetCloseDownModeReq; typedef xChangeModeReq xForceScreenSaverReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length ; CARD32 window ; CARD16 nAtoms ; INT16 nPositions ; } xRotatePropertiesReq; # 33 "mibstore.c" # 1 "../../include/misc.h" extern unsigned long globalSerialNumber; typedef unsigned char *pointer; typedef int Bool; typedef unsigned long PIXEL; typedef unsigned long ATOM; # 1 "../../include/os.h" # 1 "../../include/misc.h" # 105 "../../include/misc.h" # 29 "../../include/os.h" typedef pointer FID; typedef struct _FontPathRec *FontPathPtr; typedef struct _NewClientRec *NewClientPtr; # 60 "../../include/os.h" char *malloc(); char *ReadRequestFromClient(); Bool CloseDownConnection(); void CreateWellKnownSockets(); void SetDefaultFontPath(); void FreeFontRecord(); void SetFontPath(); FontPathPtr GetFontPath(); FontPathPtr ExpandFontNamePattern(); FID FiOpenForRead(); void AbortServer(); void ErrorF(); unsigned long *Xalloc(); unsigned long *Xrealloc(); void Xfree(); char *strcat(); char *strncat(); char *strcpy(); char *strncpy(); # 54 "../../include/misc.h" typedef struct _DDXPoint *DDXPointPtr; typedef struct _Box *BoxPtr; # 34 "mibstore.c" # 1 "../../include/regionstr.h" # 1 "../../include/region.h" typedef struct _Region *RegionPtr; extern int SingleRectRegionEqual(); # 28 "../../include/regionstr.h" # 1 "../../include/miscstruct.h" # 1 "../../include/misc.h" # 105 "../../include/misc.h" # 28 "../../include/miscstruct.h" extern unsigned long globalSerialNumber; typedef struct _DDXPoint { short x, y; } DDXPointRec; typedef struct _Box { short x1, y1, x2, y2; } BoxRec; # 29 "../../include/regionstr.h" typedef struct _Region { short size; short numRects; BoxPtr rects; BoxRec extents; } RegionRec; # 77 "../../include/regionstr.h" # 92 "../../include/regionstr.h" extern RegionPtr miRegionCreate(); extern void miprintRects(); extern void miRegionCopy(); extern int miInverse(); extern int miIntersect(); extern int miUnion(); extern int miSubtract(); extern int miRectIn(); extern void miTranslateRegion(); extern void miRegionDestroy(); extern void miRegionReset(); extern Bool miPointInRegion(); # 35 "mibstore.c" # 1 "../../include/scrnintstr.h" # 1 "../../include/screenint.h" typedef struct _PixmapFormat *PixmapFormatPtr; typedef struct _Visual *VisualPtr; typedef struct _Depth *DepthPtr; typedef struct _Screen *ScreenPtr; # 28 "../../include/scrnintstr.h" # 1 "../../include/misc.h" # 105 "../../include/misc.h" # 29 "../../include/scrnintstr.h" # 1 "../../include/region.h" # 41 "../../include/region.h" # 30 "../../include/scrnintstr.h" # 1 "../../include/pixmap.h" typedef struct _DrawInfo *DrawablePtr; typedef struct _Pixmap *PixmapPtr; # 31 "../../include/scrnintstr.h" # 1 "../../include/gc.h" typedef struct _GCInterest *GCInterestPtr; typedef struct _GC *GCPtr; extern void ValidateGC(); extern int ChangeGC(); extern GCPtr CreateGC(); extern void CopyGC(); extern int FreeGC(); extern void SetGCMask(); extern GCPtr GetScratchGC(); extern void FreeScratchGC(); # 32 "../../include/scrnintstr.h" # 1 "../../include/colormap.h" # 55 "../../include/colormap.h" typedef unsigned long Pixel; typedef struct _CMEntry *EntryPtr; typedef struct _ColormapRec *ColormapPtr; extern int CreateColormap(); extern Pixel FindColor(); extern int FreeColormap(); extern int TellNoMap(); extern int TellLostMap(); extern int TellGainedMap(); extern int IsMapInstalled(); extern void UninstallColormap(); # 33 "../../include/scrnintstr.h" typedef struct _PixmapFormat { unsigned char depth; unsigned char bitsPerPixel; unsigned char scanlinePad; } PixmapFormatRec; typedef struct _Visual { unsigned long vid; short screen; short class; unsigned long redMask, greenMask, blueMask; int offsetRed, offsetGreen, offsetBlue; short bitsPerRGBValue; short ColormapEntries; short nplanes; } VisualRec; typedef struct _Depth { int depth; int numVids; unsigned long *vids; } DepthRec; typedef struct _Screen { int myNum; ATOM id; short width, height; short mmWidth, mmHeight; short numDepths; DepthPtr allowedDepths; short rootDepth; unsigned long rootVisual; unsigned long defColormap; short minInstalledCmaps, maxInstalledCmaps; char backingStoreSupport, saveUnderSupport; unsigned long whitePixel, blackPixel; unsigned long rgf; GCPtr GCperDepth[8+1]; PixmapPtr PixmapPerDepth[1]; pointer devPrivate; short numVisuals; VisualPtr visuals; Bool (* CloseScreen)(); void (* QueryBestSize)(); Bool (* SaveScreen)(); void (* GetImage)(); unsigned int *(* GetSpans)(); void (* PointerNonInterestBox)(); Bool (* CreateWindow)(); Bool (* DestroyWindow)(); Bool (* PositionWindow)(); Bool (* ChangeWindowAttributes)(); Bool (* RealizeWindow)(); Bool (* UnrealizeWindow)(); int (* ValidateTree)(); void (* WindowExposures)(); PixmapPtr (* CreatePixmap)(); Bool (* DestroyPixmap)(); Bool (* RealizeFont)(); Bool (* UnrealizeFont)(); void (* ConstrainCursor)(); void (* CursorLimits)(); Bool (* DisplayCursor)(); Bool (* RealizeCursor)(); Bool (* UnrealizeCursor)(); void (* RecolorCursor)(); Bool (* SetCursorPosition)(); Bool (* CreateGC)(); void (* CreateColormap)(); void (* DestroyColormap)(); void (* InstallColormap)(); void (* UninstallColormap)(); int (* ListInstalledColormaps) (); void (* StoreColors)(); void (* ResolveColor)(); RegionPtr (* RegionCreate)(); void (* RegionCopy)(); void (* RegionDestroy)(); int (* Intersect)(); int (* Union)(); int (* Subtract)(); int (* Inverse)(); void (* RegionReset)(); void (* TranslateRegion)(); int (* RectIn)(); Bool (* PointInRegion)(); Bool (* RegionNotEmpty)(); void (* RegionEmpty)(); BoxPtr (*RegionExtents)(); void (* BlockHandler)(); void (* WakeupHandler)(); pointer blockData; pointer wakeupData; } ScreenRec; typedef struct _ScreenInfo { int imageByteOrder; int bitmapScanlineUnit; int bitmapScanlinePad; int bitmapBitOrder; int numPixmapFormats; PixmapFormatRec formats[8]; int arraySize; int numScreens; ScreenPtr screen; } ScreenInfo; extern ScreenInfo screenInfo; # 36 "mibstore.c" # 1 "../../include/gcstruct.h" # 1 "../../include/gc.h" # 65 "../../include/gc.h" # 29 "../../include/gcstruct.h" # 1 "../../include/miscstruct.h" # 38 "../../include/miscstruct.h" # 31 "../../include/gcstruct.h" # 1 "../../include/region.h" # 41 "../../include/region.h" # 32 "../../include/gcstruct.h" # 1 "../../include/pixmap.h" # 45 "../../include/pixmap.h" # 33 "../../include/gcstruct.h" # 1 "../../include/screenint.h" # 33 "../../include/screenint.h" # 34 "../../include/gcstruct.h" # 1 "../../include/dixfont.h" typedef struct _DIXFontProp *DIXFontPropPtr; typedef struct _Font *FontPtr; typedef enum {Linear8Bit, TwoD8Bit, Linear16Bit, TwoD16Bit} FontEncoding; typedef struct _FontData *FontDataPtr; extern FontPtr OpenFont(); # 35 "../../include/gcstruct.h" typedef struct _GCInterest { struct _GCInterest *pNextGCInterest; struct _GCInterest *pLastGCInterest; int length; ATOM owner; unsigned long ValInterestMask; void (* ValidateGC) (); unsigned long ChangeInterestMask; int (* ChangeGC) (); void (* CopyGCSource) (); void (* CopyGCDest) (); void (* DestroyGC) (); pointer extPriv; } GCInterestRec; typedef struct _GC{ ScreenPtr pScreen; pointer devPriv; pointer devBackingStore; int depth; unsigned long serialNumber; GCInterestPtr pNextGCInterest; GCInterestPtr pLastGCInterest; int alu; unsigned long planemask; unsigned long fgPixel, bgPixel; int lineWidth; int lineStyle; int capStyle; int joinStyle; int fillStyle; int fillRule; int arcMode; PixmapPtr tile; PixmapPtr stipple; DDXPointRec patOrg; FontPtr font; int subWindowMode; Bool graphicsExposures; DDXPointRec clipOrg; pointer clientClip; int clientClipType; int dashOffset; int numInDashList; unsigned char *dash; unsigned long stateChanges; DDXPointRec lastWinOrg; int miTranslate:1; void (* FillSpans)(); void (* SetSpans)(); void (* PutImage)(); void (* CopyArea)(); void (* CopyPlane)(); void (* PolyPoint)(); void (* Polylines)(); void (* PolySegment)(); void (* PolyRectangle)(); void (* PolyArc)(); void (* FillPolygon)(); void (* PolyFillRect)(); void (* PolyFillArc)(); int (* PolyText8)(); int (* PolyText16)(); void (* ImageText8)(); void (* ImageText16)(); void (* ImageGlyphBlt)(); void (* PolyGlyphBlt)(); void (* PushPixels)(); void (* LineHelper)(); void (* ChangeClip) (); void (* DestroyClip) (); void (* CopyClip)(); } GC; # 37 "mibstore.c" # 1 "../../include/extnsionst.h" # 1 "../../include/extension.h" # 106 "../../include/extension.h" # 27 "../../include/extnsionst.h" typedef struct _ExtensionEntry { int index; void (* CloseDown)(); char *name; int base; int eventBase; int eventLast; int errorBase; int errorLast; pointer extPrivate; } ExtensionEntry; typedef void (* ExtensionLookupProc)(); typedef struct _ProcEntry { char *name; ExtensionLookupProc proc; } ProcEntryRec, *ProcEntryPtr; typedef struct _ScreenProcEntry { int num; ProcEntryPtr procList; } ScreenProcEntry; extern void InitExtensions(); extern int ProcQueryExtension(); extern int ProcListExtensions(); extern ExtensionEntry *AddExtension(); extern ExtensionLookupProc LookupProc(); extern void RegisterProc(); extern void RegisterScreenProc(); # 38 "mibstore.c" # 1 "../../include/windowstr.h" # 1 "../../include/window.h" typedef struct _BackingStore *BackingStorePtr; typedef struct _Window *WindowPtr; # 29 "../../include/windowstr.h" # 1 "../../include/pixmapstr.h" # 1 "../../include/pixmap.h" # 45 "../../include/pixmap.h" # 28 "../../include/pixmapstr.h" # 1 "../../include/screenint.h" # 33 "../../include/screenint.h" # 29 "../../include/pixmapstr.h" # 1 "../../include/misc.h" # 105 "../../include/misc.h" # 30 "../../include/pixmapstr.h" typedef struct _DrawInfo { short type; ScreenPtr pScreen; int depth; unsigned long serialNumber; } DrawableRec; typedef struct _Pixmap { DrawableRec drawable; int width, height; int refcnt; int devKind; pointer devPrivate; } PixmapRec; # 30 "../../include/windowstr.h" # 1 "../../include/region.h" # 41 "../../include/region.h" # 31 "../../include/windowstr.h" # 1 "../../include/cursor.h" typedef struct _Cursor *CursorPtr; typedef struct _CursorMetric *CursorMetricPtr; extern CursorPtr rootCursor; # 32 "../../include/windowstr.h" # 1 "../../include/property.h" typedef struct _Property *PropertyPtr; # 33 "../../include/windowstr.h" # 1 "../../include/resource.h" # 1 "../../include/misc.h" # 105 "../../include/misc.h" # 27 "../../include/resource.h" unsigned short CreateNewResourceType(); short CreateNewResourceClass(); unsigned long FakeClientID(); void AddResource(); void FreeResource(); void FreeClientResources(); pointer LookupID(); # 34 "../../include/windowstr.h" # 1 "../../include/dix.h" # 1 "../../include/gc.h" # 65 "../../include/gc.h" # 29 "../../include/dix.h" # 1 "../../include/window.h" # 53 "../../include/window.h" # 30 "../../include/dix.h" typedef struct _TimeStamp *TimeStampPtr; typedef struct _Client *ClientPtr; extern ClientPtr requestingClient; extern ClientPtr *clients; extern ClientPtr serverClient; extern int currentMaxClients; extern int ProcAllowEvents(); extern int ProcBell(); extern int ProcChangeActivePointerGrab(); extern int ProcChangeKeyboardControl(); extern int ProcChangePointerControl(); extern int ProcGetKeyboardMapping(); extern int ProcGetPointerMapping(); extern int ProcGetInputFocus(); extern int ProcGetKeyboardControl(); extern int ProcGetMotionEvents(); extern int ProcGetPointerControl(); extern int ProcGrabButton(); extern int ProcGrabKey(); extern int ProcGrabKeyboard(); extern int ProcGrabPointer(); extern int ProcQueryKeymap(); extern int ProcQueryPointer(); extern int ProcSetInputFocus(); extern int ProcSetKeyboardMapping(); extern int ProcSetPointerMapping(); extern int ProcSendEvent(); extern int ProcUngrabButton(); extern int ProcUngrabKey(); extern int ProcUngrabKeyboard(); extern int ProcUngrabPointer(); extern int ProcWarpPointer(); extern int ProcRecolorCursor(); extern WindowPtr LookupWindow(); extern pointer LookupDrawable(); extern void NoopDDA(); # 35 "../../include/windowstr.h" # 1 "../../include/miscstruct.h" # 38 "../../include/miscstruct.h" # 36 "../../include/windowstr.h" # 1 "./../../../X11/Xprotostr.h" # 55 "./../../../X11/Xprotostr.h" # 37 "../../include/windowstr.h" typedef struct _BackingStore { RegionPtr obscured; DDXPointRec oldAbsCorner; void (* SaveDoomedAreas)(); void (* RestoreAreas)(); void (* ExposeCopy)(); void (* TranslateBackingStore)(); void (* ClearToBackground)(); } BackingStoreRec; typedef struct _Window { DrawableRec drawable; VisualID visual; struct _Window *parent; struct _Window *nextSib; struct _Window *prevSib; struct _Window *firstChild; struct _Window *lastChild; CursorPtr cursor; ClientPtr client; Window wid; RegionPtr clipList; RegionPtr winSize; RegionPtr borderClip; RegionPtr borderSize; RegionPtr exposed; RegionPtr borderExposed; xRectangle clientWinSize; DDXPointRec absCorner; DDXPointRec oldAbsCorner; int class; Mask eventMask; Mask dontPropagateMask; Mask allEventMasks; Mask deliverableEvents; pointer otherClients; pointer passiveGrabs; PropertyPtr userProps; XID nolongerused; PixmapPtr backgroundTile; unsigned long backgroundPixel; PixmapPtr borderTile; unsigned long borderPixel; int borderWidth; void (* PaintWindowBackground)(); void (* PaintWindowBorder)(); void (* CopyWindow)(); void (* ClearToBackground)(); unsigned long backingBitPlanes; unsigned long backingPixel; int backingStore; BackingStorePtr backStorage; char bitGravity; char winGravity; Colormap colormap; Bool saveUnder:1; unsigned visibility:2; unsigned mapped:1; unsigned realized:1; unsigned viewable:1; unsigned overrideRedirect:1; unsigned marked:1; pointer devBackingStore; pointer devPrivate; } WindowRec; extern int DeleteWindow(); extern int ChangeWindowAttributes(); extern int WalkTree(); extern CreateRootWindow(); extern WindowPtr CreateWindow(); extern int DeleteWindow(); extern int DestroySubwindows(); extern int ChangeWindowAttributes(); extern int GetWindowAttributes(); extern int ConfigureWindow(); extern int ReparentWindow(); extern int MapWindow(); extern int MapSubwindow(); extern int UnmapWindow(); extern int UnmapSubwindow(); extern RegionPtr NotClippedByChildren(); # 39 "mibstore.c" # 1 "../../include/pixmapstr.h" # 50 "../../include/pixmapstr.h" # 40 "mibstore.c" # 1 "../../include/fontstruct.h" # 1 "../../include/font.h" # 1 "../../include/servermd.h" # 130 "../../include/servermd.h" typedef struct _PaddingInfo { int scanlinePad; int bitmapPadLog2; } PaddingInfo; extern PaddingInfo PixmapWidthPaddingInfo[]; # 28 "../../include/font.h" typedef struct _FontProp *FontPropPtr; typedef struct _CharInfo *CharInfoPtr; typedef struct _FontInfo *FontInfoPtr; typedef unsigned int DrawDirection; typedef struct _ExtentInfo *ExtentInfoPtr; # 26 "../../include/fontstruct.h" # 1 "../../include/misc.h" # 105 "../../include/misc.h" # 27 "../../include/fontstruct.h" typedef struct _FontProp { CARD32 name; INT32 value; Bool indirect; } FontPropRec; typedef struct _CharInfo { xCharInfo metrics; unsigned byteOffset:24; Bool exists:1; unsigned pad:7; } CharInfoRec; typedef struct _FontInfo { unsigned int version1; unsigned int allExist; unsigned int drawDirection; unsigned int noOverlap; unsigned int constantMetrics; unsigned int terminalFont; unsigned int linear:1; unsigned int constantWidth:1; unsigned int inkInside:1; unsigned int padding:29; unsigned int firstCol; unsigned int lastCol; unsigned int firstRow; unsigned int lastRow; unsigned int nProps; unsigned int lenStrings; unsigned int chDefault; unsigned int fontDescent; unsigned int fontAscent; CharInfoRec minbounds; CharInfoRec maxbounds; unsigned int pixDepth; unsigned int glyphSets; unsigned int version2; } FontInfoRec; typedef struct _ExtentInfo { DrawDirection drawDirection; int fontAscent; int fontDescent; int overallAscent; int overallDescent; int overallWidth; int overallLeft; int overallRight; } ExtentInfoRec; # 41 "mibstore.c" # 1 "../../include/dixfontstr.h" # 1 "../../include/dixfont.h" # 40 "../../include/dixfont.h" # 29 "../../include/dixfontstr.h" # 1 "../../include/font.h" # 115 "../../include/font.h" # 30 "../../include/dixfontstr.h" # 1 "../../include/misc.h" # 105 "../../include/misc.h" # 31 "../../include/dixfontstr.h" typedef struct _DIXFontProp { ATOM name; INT32 value; } DIXFontProp; typedef struct _Font { FontInfoPtr pFI; DIXFontProp *pFP; CharInfoPtr pCI; char *pGlyphs; int lenpname; char *pathname; struct _Font *next; int refcnt; pointer devPriv[3]; } FontRec; extern FontPtr OpenFont(); extern Bool SetDefaultFont(); extern int CloseFont(); extern FontPtr ReadNFont(); extern Bool DescribeFont(); extern void ServerBitmapFromGlyph(); extern Bool CursorMetricsFromGlyph(); extern void GetGlyphs(); extern void QueryTextExtents(); # 42 "mibstore.c" # 1 "../../include/dixstruct.h" # 1 "../../include/dix.h" # 100 "../../include/dix.h" # 29 "../../include/dixstruct.h" # 1 "../../include/resource.h" # 74 "../../include/resource.h" # 30 "../../include/dixstruct.h" # 1 "../../include/cursor.h" # 33 "../../include/cursor.h" # 31 "../../include/dixstruct.h" # 1 "../../include/gc.h" # 65 "../../include/gc.h" # 32 "../../include/dixstruct.h" # 1 "../../include/pixmap.h" # 45 "../../include/pixmap.h" # 33 "../../include/dixstruct.h" typedef struct _TimeStamp { unsigned long months; unsigned long milliseconds; } TimeStamp; typedef struct _Client { int index; Mask clientAsMask; pointer requestBuffer; pointer osPrivate; Bool swapped; void (* pSwapReplyFunc)(); XID errorValue; int sequence; int closeDownMode; int clientGone; int noClientException; DrawablePtr lastDrawable; Drawable lastDrawableID; GCPtr lastGC; GContext lastGCID; pointer *saveSet; int numSaved; int requestLog[100]; int requestLogIndex; pointer screenPrivate[3]; } ClientRec; extern TimeStamp currentTime; extern void CloseDownClient(); extern TimeStamp ClientTimeToServerTime(); # 43 "mibstore.c" # 1 "../../include/mi.h" # 1 "../../include/region.h" # 41 "../../include/region.h" # 27 "../../include/mi.h" typedef struct _miDash *miDashPtr; extern void miPutImage(); extern void miGetImage(); extern void miCopyArea(); extern void miCopyPlane(); extern void miClearToBackground(); extern int miValidateTree(); extern void miPolySegment(); extern void miPolyRectangle(); extern void miFillPolygon(); extern int miPolyText8(); extern int miPolyText16(); extern void miImageText8(); extern void miImageText16(); extern int miFillConvexPoly(); extern int miFillGeneralPoly(); extern void miNotMiter(); extern void miMiter(); extern void miWideLine(); extern void miWideDash(); extern void miPolyArc(); extern void miPolyFillRect(); extern void miPolyFillArc(); extern void miPolyGlyphBlt(); extern void miImageGlyphBlt(); extern void miZeroLine(); extern void miPaintWindow(); extern miDashPtr miDashLine(); extern void miPushPixels(); extern void miGetPts(), miRoundCap(), miOneSegWide(); extern int miPtToAngle(); extern RegionPtr miRegionCreate(); extern void miRegionCopy(); extern void miRegionDestroy(); extern int miIntersect(); extern int miInverse(); extern int miUnion(); extern int miSubtract(); extern void miRegionReset(); extern void miTranslateRegion(); extern int miRectIn(); extern RegionPtr miRectsToRegion(); extern Bool miPointInRegion(); extern Bool miRegionNotEmpty(); extern void miRegionEmpty(); extern int miNumberRectsInRegion(); extern void miWindowExposures(); extern BoxPtr miRegionExtents(); # 44 "mibstore.c" # 1 "../../include/mibstore.h" typedef struct { GCPtr pgcBlt; PixmapPtr pBackingPixmap; RegionPtr pSavedRegion; unsigned long serialNumber; Bool viewable; Bool clean; RegionPtr background; void (*SaveAreas)(); void (*RestoreAreas)(); } MIBackingStoreRec, *MIBackingStorePtr; extern void miSaveAreas(); extern void miTranslateBackingStore(); extern void miRestoreAreas(); extern void miExposeCopy(); extern void miBSClearToBackground(); extern void miInitBackingStore(); extern void miFreeBackingStore(); extern void miValidateBackingStore(); extern void miBSGetImage(); extern void miBSGetSpans(); # 45 "mibstore.c" typedef struct { GCPtr pBackingGC; Bool inUse; Bool gcHooked; RegionPtr pTransClientClip; unsigned long changes; void (* FillSpans)(); void (* SetSpans)(); void (* PutImage)(); void (* CopyArea)(); void (* CopyPlane)(); void (* PolyPoint)(); void (* Polylines)(); void (* PolySegment)(); void (* PolyRectangle)(); void (* PolyArc)(); void (* FillPolygon)(); void (* PolyFillRect)(); void (* PolyFillArc)(); int (* PolyText8)(); int (* PolyText16)(); void (* ImageText8)(); void (* ImageText16)(); void (* ImageGlyphBlt)(); void (* PolyGlyphBlt)(); void (* PushPixels)(); } MIBSGCPrivRec, *MIBSGCPrivPtr; static void miBSFillSpans(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GCPtr pGC; int nInit; DDXPointPtr pptInit; int *pwidthInit; int fSorted; { MIBackingStorePtr pBackingStore = (MIBackingStorePtr)((WindowPtr)pDrawable)->devBackingStore; MIBSGCPrivPtr pPriv = (MIBSGCPrivPtr)pGC->devBackingStore; GCPtr pBackingGC = pPriv->pBackingGC; if (!pPriv->inUse) { pPriv->inUse = 1; if ((*pDrawable->pScreen->RegionNotEmpty)(pBackingStore->pSavedRegion)) { DDXPointPtr pptCopy; int *pwidthCopy; pptCopy = (DDXPointPtr)malloc((unsigned)(nInit*sizeof(DDXPointRec))); pwidthCopy=(int *)malloc((unsigned)(nInit*sizeof(int))); bcopy(pptInit,pptCopy,nInit*sizeof(DDXPointRec)); bcopy(pwidthInit,pwidthCopy,nInit*sizeof(int)); (* pPriv->FillSpans)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); (* pBackingGC->FillSpans)(pBackingStore->pBackingPixmap, pBackingGC, nInit, pptCopy, pwidthCopy, fSorted); free((char *)(pptCopy)); free((char *)(pwidthCopy)); } else { (* pPriv->FillSpans)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); } pPriv->inUse = 0; } else { (* pPriv->FillSpans)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); } } static void miBSSetSpans(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted) DrawablePtr pDrawable; GCPtr pGC; int *psrc; register DDXPointPtr ppt; int *pwidth; int nspans; int fSorted; { MIBackingStorePtr pBackingStore = (MIBackingStorePtr)((WindowPtr)pDrawable)->devBackingStore; MIBSGCPrivPtr pPriv = (MIBSGCPrivPtr)pGC->devBackingStore; GCPtr pBackingGC = pPriv->pBackingGC; if (!pPriv->inUse) { pPriv->inUse = 1; if ((*pDrawable->pScreen->RegionNotEmpty)(pBackingStore->pSavedRegion)) { DDXPointPtr pptCopy; int *pwidthCopy; pptCopy = (DDXPointPtr)malloc((unsigned)(nspans*sizeof(DDXPointRec))); pwidthCopy=(int *)malloc((unsigned)(nspans*sizeof(int))); bcopy(ppt,pptCopy,nspans*sizeof(DDXPointRec)); bcopy(pwidth,pwidthCopy,nspans*sizeof(int)); (* pPriv->SetSpans)(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted); (* pBackingGC->SetSpans)(pBackingStore->pBackingPixmap, pBackingGC, psrc, pptCopy, pwidthCopy, nspans, fSorted); free((char *)(pptCopy)); free((char *)(pwidthCopy)); } else { (* pPriv->SetSpans)(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted); } pPriv->inUse = 0; } else { (* pPriv->SetSpans)(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted); } } void miBSGetSpans(pDrawable, pPixmap, wMax, ppt, pwidth, pwidthPadded, nspans) DrawablePtr pDrawable; PixmapPtr pPixmap; int wMax; register DDXPointPtr ppt; int *pwidth; int *pwidthPadded; int nspans; { int n; DDXPointPtr pptClipped; DDXPointPtr pptDest; int *pwidthClipped; register int i, j; DDXPointRec pt; register int k; register WindowPtr pWin; MIBackingStorePtr pBackingStore; GCPtr pGC; unsigned int *pBits; int xorg; pWin = (WindowPtr)pDrawable; pBackingStore = (MIBackingStorePtr)pWin->devBackingStore; n = miFindMaxBand(pBackingStore->pSavedRegion) * nspans; pptClipped = (DDXPointPtr) malloc((unsigned)(n * sizeof(DDXPointRec))); pptDest = (DDXPointPtr)malloc((unsigned)(n * sizeof(DDXPointRec))); pwidthClipped = (int *)malloc((unsigned)(n * sizeof(int))); if(!pptClipped || !pwidthClipped || !pptDest) { free((char *)(pptClipped)); free((char *)(pwidthClipped)); free((char *)(pptDest)); return; } pGC = GetScratchGC(pDrawable->depth, pDrawable->pScreen); ValidateGC(pPixmap, pGC); xorg = 0; for (k = wMax = i = 0; i < nspans; i++) { pt.x = ppt[i].x - pWin->absCorner.x; pt.y = ppt[i].y - pWin->absCorner.y; n = miClipSpans(pBackingStore->pSavedRegion, &pt, &pwidth[i], 1, &pptClipped[k], &pwidthClipped[k], 1); if (n != 0) { for (j = n-1 ; j >= 0; j--) { if (pwidthClipped[k+j] > wMax) { wMax = pwidthClipped[k+j]; } } for (j = n-1; j >= 0; j--) { pptDest[k+j].x = pptClipped[k+j].x - pt.x + xorg; pptDest[k+j].y = 0; } } xorg += pwidthPadded[i]; k += n; } if (k != 0) { pBits = (*pDrawable->pScreen->GetSpans) (pBackingStore->pBackingPixmap, wMax, pptClipped, pwidthClipped, k); (* pGC->SetSpans) (pPixmap, pGC, pBits, pptDest, pwidthClipped, k, 0); Xfree((pointer)pBits); } FreeScratchGC(pGC); free((char *)(pptClipped)); free((char *)(pwidthClipped)); free((char *)(pptDest)); } static void miBSPutImage(pDst, pGC, depth, x, y, w, h, leftPad, format, pBits) DrawablePtr pDst; GCPtr pGC; int depth; int x; int y; int w; int h; int format; char *pBits; { MIBackingStorePtr pBackingStore = (MIBackingStorePtr)((WindowPtr)pDst)->devBackingStore; MIBSGCPrivPtr pPriv = (MIBSGCPrivPtr)pGC->devBackingStore; GCPtr pBackingGC = pPriv->pBackingGC; if (!pPriv->inUse) { pPriv->inUse = 1; (*pPriv->PutImage)(pDst, pGC, depth, x, y, w, h, leftPad, format, pBits); if ((*pDst->pScreen->RegionNotEmpty)(pBackingStore->pSavedRegion)) { (*pBackingGC->PutImage)(pBackingStore->pBackingPixmap, pBackingGC, depth, x, y, w, h, leftPad, format, pBits); } pPriv->inUse = 0; } else { (*pPriv->PutImage)(pDst, pGC, depth, x, y, w, h, leftPad, format, pBits); } } void miBSGetImage (pWin, pPixmap, x, y, w, h, format, planeMask) WindowPtr pWin; PixmapPtr pPixmap; int x; int y; int w; int h; unsigned int format; unsigned int planeMask; { MIBackingStorePtr pBackingStore; ScreenPtr pScreen; RegionPtr pRgn; BoxRec box; DDXPointPtr pPts; int *pWidths; int nSpans; register BoxPtr pBox; GCPtr pGC; unsigned int *pBits; int wMax; register DDXPointPtr pPt; register int n; pScreen = pWin->drawable.pScreen; pBackingStore = (MIBackingStorePtr)pWin->devBackingStore; pRgn = (* pScreen->RegionCreate) ( 0, 1); box.x1 = x; box.y1 = y; box.x2 = x + w; box.y2 = y + h; (* pScreen->Inverse)(pRgn, pWin->borderClip, &box); (* pScreen->TranslateRegion) (pRgn, -pWin->absCorner.x, -pWin->absCorner.y); (* pScreen->Intersect) (pRgn, pBackingStore->pSavedRegion, pRgn); if (!(* pScreen->RegionNotEmpty) (pRgn)) { (* pScreen->RegionDestroy) (pRgn); return; } nSpans = miRegionToSpans(pRgn, 0, &pPts, &pWidths, &wMax); pBits = (* pScreen->GetSpans) (pBackingStore->pBackingPixmap, wMax, pPts, pWidths, nSpans); x -= pWin->absCorner.x; y -= pWin->absCorner.y; for (pPt = pPts, n = nSpans; n > 0; pPt++, n--) { pPt->x -= x; pPt->y -= y; } pGC = GetScratchGC(pWin->drawable.depth, pScreen); ChangeGC(pGC, (1L<<1), &planeMask); ValidateGC(pPixmap, pGC); (* pGC->SetSpans) (pPixmap, pGC, pBits, pPts, pWidths, nSpans, 1); Xfree((pointer)pBits); FreeScratchGC(pGC); } static Bool miBSDoCopy(pWin, pGC, srcx, srcy, w, h, dstx, dsty, plane, copyProc) WindowPtr pWin; GCPtr pGC; int srcx; int srcy; int w; int h; int dstx; int dsty; unsigned long plane; void (*copyProc)(); { RegionPtr pRgnExp; RegionPtr pRgnObs; BoxRec box; MIBackingStorePtr pBackingStore = (MIBackingStorePtr)((WindowPtr)pWin)->devBackingStore; MIBSGCPrivPtr pPriv = (MIBSGCPrivPtr)pGC->devBackingStore; GCPtr pBackingGC = pPriv->pBackingGC; struct BoxDraw { BoxPtr pBox; enum { win, pix } source; } *boxes; int *sequence; register int i, j, k, l, y; register BoxPtr pBox; PixmapPtr pBackingPixmap; int dx, dy, nrects; Bool graphicsExposures; void (*pixCopyProc)(); box.x1 = srcx + pWin->absCorner.x; box.x2 = box.x1 + w; box.y1 = srcy + pWin->absCorner.y; box.y2 = box.y1 + h; pRgnExp = (*pGC->pScreen->RegionCreate) (&box, 1); (*pGC->pScreen->Intersect) (pRgnExp, pRgnExp, pWin->clipList); pRgnObs = (*pGC->pScreen->RegionCreate) ( 0, 1); (* pGC->pScreen->Inverse) (pRgnObs, pRgnExp, &box); (*pGC->pScreen->TranslateRegion) (pRgnExp, -pWin->absCorner.x, -pWin->absCorner.y); (*pGC->pScreen->TranslateRegion) (pRgnObs, -pWin->absCorner.x, -pWin->absCorner.y); (*pGC->pScreen->Intersect) (pRgnObs, pRgnObs, pBackingStore->pSavedRegion); if (!(*pGC->pScreen->RegionNotEmpty) (pRgnObs)) { return (0); } pBackingPixmap = pBackingStore->pBackingPixmap; nrects = pRgnExp->numRects + pRgnObs->numRects; boxes = (struct BoxDraw *)malloc((unsigned)(nrects * sizeof(struct BoxDraw))); sequence = (int *) malloc((unsigned)(nrects * sizeof(int))); if ((boxes == (struct BoxDraw *) 0) || (sequence == (int *) 0)) { return(1); } else { for (i = 0, j = 0, k = 0; (i < pRgnExp->numRects) && (j < pRgnObs->numRects); k++) { if (pRgnExp->rects[i].y1 < pRgnObs->rects[j].y1) { boxes[k].pBox = &pRgnExp->rects[i]; boxes[k].source = win; i++; } else if ((pRgnObs->rects[j].y1 < pRgnExp->rects[i].y1) || (pRgnObs->rects[j].x1 < pRgnExp->rects[i].x1)) { boxes[k].pBox = &pRgnObs->rects[j]; boxes[k].source = pix; j++; } else { boxes[k].pBox = &pRgnExp->rects[i]; boxes[k].source = win; i++; } } if (i != pRgnExp->numRects) { do { boxes[k].pBox = &pRgnExp->rects[i]; boxes[k].source = win; i++; k++; } while (i < pRgnExp->numRects); } else { do { boxes[k].pBox = &pRgnObs->rects[j]; boxes[k].source = pix; j++; k++; } while (j < pRgnObs->numRects); } } if (dsty <= srcy) { if (dstx <= srcx) { for (i = 0; i < nrects; i++) { sequence[i] = i; } } else { for (i = 0, j = 1, k = 0; i < nrects; j = i + 1, k = i) { y = boxes[i].pBox->y1; while ((j < nrects) && (boxes[j].pBox->y1 == y)) { j++; } for (j--; j >= k; j--, i++) { sequence[i] = j; } } } } else { if (dstx < srcx) { for (i = nrects - 1, j = i - 1, k = i, l = 0; i >= 0; j = i - 1, k = i) { y = boxes[i].pBox->y1; while ((j >= 0) && (boxes[j].pBox->y1 == y)) { j--; } for (j++; j <= k; j++, i--, l++) { sequence[l] = j; } } } else { for (i = 0, j = nrects - 1; i < nrects; i++, j--) { sequence[i] = j; } } } graphicsExposures = pGC->graphicsExposures; pGC->graphicsExposures = 0; dx = dstx - srcx; dy = dsty - srcy; if (plane != 0) { pixCopyProc = pBackingGC->CopyPlane; } else { pixCopyProc = pBackingGC->CopyArea; } for (i = 0; i < nrects; i++) { pBox = boxes[sequence[i]].pBox; if (boxes[sequence[i]].source == pix) { (* copyProc) (pBackingPixmap, pWin, pGC, pBox->x1, pBox->y1, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, pBox->x1 + dx, pBox->y1 + dy, plane); (* pixCopyProc) (pBackingPixmap, pBackingPixmap, pBackingGC, pBox->x1, pBox->y1, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, pBox->x1 + dx, pBox->y1 + dy, plane); } else { (* pixCopyProc) (pWin, pBackingPixmap, pBackingGC, pBox->x1, pBox->y1, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, pBox->x1 + dx, pBox->y1 + dy, plane); (* copyProc) (pWin, pWin, pGC, pBox->x1, pBox->y1, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, pBox->x1 + dx, pBox->y1 + dy, plane); } } free((char *)(boxes)); free((char *)(sequence)); pGC->graphicsExposures = graphicsExposures; if (graphicsExposures) { (* pGC->pScreen->Union) (pRgnExp, pRgnExp, pRgnObs); box.x1 = srcx; box.x2 = srcx + w; box.y1 = srcy; box.y2 = srcy + h; if ((* pGC->pScreen->RectIn) (pRgnExp, &box) == 1) { miSendNoExpose(pGC); } else { xEvent *events, *ev; (* pGC->pScreen->Inverse) (pRgnExp, pRgnExp, &box); events=(xEvent *)malloc((unsigned)(pRgnExp->numRects*sizeof(xEvent))); if (events != (xEvent *) 0) { for (i = pRgnExp->numRects, pBox = pRgnExp->rects, ev = events; i > 0; i--, pBox++, ev++) { ev->u.u.type = 13; ev->u.graphicsExposure.drawable = requestingClient->lastDrawableID; ev->u.graphicsExposure.x = pBox->x1; ev->u.graphicsExposure.y = pBox->y1; ev->u.graphicsExposure.width = pBox->x2 - pBox->x1; ev->u.graphicsExposure.height = pBox->y2 - pBox->y1; ev->u.graphicsExposure.count = i - 1; } TryClientEvents(requestingClient, events, pRgnExp->numRects, 0, 0L, 0); free((char *)(events)); } } } return (1); } static void miBSCopyArea (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty) DrawablePtr pSrc; DrawablePtr pDst; GCPtr pGC; int srcx; int srcy; int w; int h; int dstx; int dsty; { MIBackingStorePtr pBackingStore = (MIBackingStorePtr)((WindowPtr)pDst)->devBackingStore; MIBSGCPrivPtr pPriv = (MIBSGCPrivPtr)pGC->devBackingStore; GCPtr pBackingGC = pPriv->pBackingGC; if (!pPriv->inUse) { pPriv->inUse = 1; if ((pSrc != pDst) || (!miBSDoCopy(pSrc, pGC, srcx, srcy, w, h, dstx, dsty, 0, pPriv->CopyArea))) { (* pPriv->CopyArea) (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty); if ((*pDst->pScreen->RegionNotEmpty)(pBackingStore->pSavedRegion)) { (* pBackingGC->CopyArea) (pSrc, pBackingStore->pBackingPixmap, pBackingGC, srcx, srcy, w, h, dstx, dsty); } } pPriv->inUse = 0; } else { (* pPriv->CopyArea) (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty); } } static void miBSCopyPlane (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, plane) DrawablePtr pSrc; DrawablePtr pDst; register GC *pGC; int srcx, srcy; int w, h; int dstx, dsty; unsigned int plane; { MIBackingStorePtr pBackingStore = (MIBackingStorePtr)((WindowPtr)pDst)->devBackingStore; MIBSGCPrivPtr pPriv = (MIBSGCPrivPtr)pGC->devBackingStore; GCPtr pBackingGC = pPriv->pBackingGC; if (!pPriv->inUse) { pPriv->inUse = 1; if ((pSrc != pDst) || (!miBSDoCopy(pSrc, pGC, srcx, srcy, w, h, dstx, dsty, plane, pPriv->CopyPlane))) { (* pPriv->CopyPlane) (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, plane); if ((*pDst->pScreen->RegionNotEmpty)(pBackingStore->pSavedRegion)) { (* pBackingGC->CopyPlane) (pSrc, pBackingStore->pBackingPixmap, pBackingGC, srcx, srcy, w, h, dstx, dsty, plane); } } pPriv->inUse = 0; } else { (* pPriv->CopyPlane) (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, plane); } } static void miBSPolyPoint (pDrawable, pGC, mode, npt, pptInit) DrawablePtr pDrawable; GCPtr pGC; int mode; int npt; xPoint *pptInit; { MIBackingStorePtr pBackingStore = (MIBackingStorePtr)((WindowPtr)pDrawable)->devBackingStore; MIBSGCPrivPtr pPriv = (MIBSGCPrivPtr)pGC->devBackingStore; GCPtr pBackingGC = pPriv->pBackingGC; if (!pPriv->inUse) { pPriv->inUse = 1; if ((*pDrawable->pScreen->RegionNotEmpty)(pBackingStore->pSavedRegion)) { xPoint *pptCopy; pptCopy = (xPoint *)malloc((unsigned)(npt*sizeof(xPoint))); bcopy(pptInit,pptCopy,npt*sizeof(xPoint)); (* pPriv->PolyPoint) (pDrawable, pGC, mode, npt, pptInit); (* pBackingGC->PolyPoint) (pBackingStore->pBackingPixmap, pBackingGC, mode, npt, pptCopy); free((char *)(pptCopy)); } else { (* pPriv->PolyPoint) (pDrawable, pGC, mode, npt, pptInit); } pPriv->inUse = 0; } else { (* pPriv->PolyPoint) (pDrawable, pGC, mode, npt, pptInit); } } static void miBSPolylines (pDrawable, pGC, mode, npt, pptInit) DrawablePtr pDrawable; GCPtr pGC; int mode; int npt; DDXPointPtr pptInit; { MIBackingStorePtr pBackingStore = (MIBackingStorePtr)((WindowPtr)pDrawable)->devBackingStore; MIBSGCPrivPtr pPriv = (MIBSGCPrivPtr)pGC->devBackingStore; GCPtr pBackingGC = pPriv->pBackingGC; if (!pPriv->inUse) { pPriv->inUse = 1; if ((*pDrawable->pScreen->RegionNotEmpty)(pBackingStore->pSavedRegion)) { DDXPointPtr pptCopy; pptCopy = (DDXPointPtr)malloc((unsigned)(npt*sizeof(DDXPointRec))); bcopy(pptInit,pptCopy,npt*sizeof(DDXPointRec)); (* pPriv->Polylines)(pDrawable, pGC, mode, npt, pptInit); (* pBackingGC->Polylines)(pBackingStore->pBackingPixmap, pBackingGC, mode, npt, pptCopy); free((char *)(pptCopy)); } else { (* pPriv->Polylines)(pDrawable, pGC, mode, npt, pptInit); } pPriv->inUse = 0; } else { (* pPriv->Polylines)(pDrawable, pGC, mode, npt, pptInit); } } static void miBSPolySegment(pDraw, pGC, nseg, pSegs) DrawablePtr pDraw; GCPtr pGC; int nseg; xSegment *pSegs; { MIBackingStorePtr pBackingStore = (MIBackingStorePtr)((WindowPtr)pDraw)->devBackingStore; MIBSGCPrivPtr pPriv = (MIBSGCPrivPtr)pGC->devBackingStore; GCPtr pBackingGC = pPriv->pBackingGC; if (!pPriv->inUse) { pPriv->inUse = 1; if ((*pDraw->pScreen->RegionNotEmpty)(pBackingStore->pSavedRegion)) { xSegment *pSegsCopy; pSegsCopy = (xSegment *)malloc((unsigned)(nseg*sizeof(xSegment))); bcopy(pSegs,pSegsCopy,nseg*sizeof(xSegment)); (* pPriv->PolySegment)(pDraw, pGC, nseg, pSegs); (* pBackingGC->PolySegment)(pBackingStore->pBackingPixmap, pBackingGC, nseg, pSegsCopy); free((char *)(pSegsCopy)); } else { (* pPriv->PolySegment)(pDraw, pGC, nseg, pSegs); } pPriv->inUse = 0; } else { (* pPriv->PolySegment)(pDraw, pGC, nseg, pSegs); } } static void miBSPolyRectangle(pDraw, pGC, nrects, pRects) DrawablePtr pDraw; GCPtr pGC; int nrects; xRectangle *pRects; { MIBackingStorePtr pBackingStore = (MIBackingStorePtr)((WindowPtr)pDraw)->devBackingStore; MIBSGCPrivPtr pPriv = (MIBSGCPrivPtr)pGC->devBackingStore; GCPtr pBackingGC = pPriv->pBackingGC; if (!pPriv->inUse) { pPriv->inUse = 1; if ((*pDraw->pScreen->RegionNotEmpty)(pBackingStore->pSavedRegion)) { xRectangle *pRectsCopy; pRectsCopy =(xRectangle *)malloc((unsigned)(nrects*sizeof(xRectangle))); bcopy(pRects,pRectsCopy,nrects*sizeof(xRectangle)); (* pPriv->PolyRectangle)(pDraw, pGC, nrects, pRects); (* pBackingGC->PolyRectangle)(pBackingStore->pBackingPixmap, pBackingGC, nrects, pRectsCopy); free((char *)(pRectsCopy)); } else { (* pPriv->PolyRectangle)(pDraw, pGC, nrects, pRects); } pPriv->inUse = 0; } else { (* pPriv->PolyRectangle)(pDraw, pGC, nrects, pRects); } } static void miBSPolyArc(pDraw, pGC, narcs, parcs) DrawablePtr pDraw; GCPtr pGC; int narcs; xArc *parcs; { MIBackingStorePtr pBackingStore = (MIBackingStorePtr)((WindowPtr)pDraw)->devBackingStore; MIBSGCPrivPtr pPriv = (MIBSGCPrivPtr)pGC->devBackingStore; GCPtr pBackingGC = pPriv->pBackingGC; if (!pPriv->inUse) { pPriv->inUse = 1; if ((*pDraw->pScreen->RegionNotEmpty)(pBackingStore->pSavedRegion)) { xArc *pArcsCopy; pArcsCopy = (xArc *)malloc((unsigned)(narcs*sizeof(xArc))); bcopy(parcs,pArcsCopy,narcs*sizeof(xArc)); (* pPriv->PolyArc)(pDraw, pGC, narcs, parcs); (* pBackingGC->PolyArc)(pBackingStore->pBackingPixmap, pBackingGC, narcs, pArcsCopy); free((char *)(pArcsCopy)); } else { (* pPriv->PolyArc)(pDraw, pGC, narcs, parcs); } pPriv->inUse = 0; } else { (* pPriv->PolyArc)(pDraw, pGC, narcs, parcs); } } static void miBSFillPolygon(pDraw, pGC, shape, mode, count, pPts) DrawablePtr pDraw; register GCPtr pGC; int shape, mode; register int count; DDXPointPtr pPts; { MIBackingStorePtr pBackingStore = (MIBackingStorePtr)((WindowPtr)pDraw)->devBackingStore; MIBSGCPrivPtr pPriv = (MIBSGCPrivPtr)pGC->devBackingStore; GCPtr pBackingGC = pPriv->pBackingGC; if (!pPriv->inUse) { pPriv->inUse = 1; if ((*pDraw->pScreen->RegionNotEmpty)(pBackingStore->pSavedRegion)) { DDXPointPtr pPtsCopy; pPtsCopy = (DDXPointPtr)malloc((unsigned)(count*sizeof(DDXPointRec))); bcopy(pPts,pPtsCopy,count*sizeof(DDXPointRec)); (* pPriv->FillPolygon)(pDraw, pGC, shape, mode, count, pPts); (* pBackingGC->FillPolygon)(pBackingStore->pBackingPixmap, pBackingGC, shape, mode, count, pPtsCopy); free((char *)(pPtsCopy)); } else { (* pPriv->FillPolygon)(pDraw, pGC, shape, mode, count, pPts); } pPriv->inUse = 0; } else { (* pPriv->FillPolygon)(pDraw, pGC, shape, mode, count, pPts); } } static void miBSPolyFillRect(pDrawable, pGC, nrectFill, prectInit) DrawablePtr pDrawable; GCPtr pGC; int nrectFill; xRectangle *prectInit; { MIBackingStorePtr pBackingStore = (MIBackingStorePtr)((WindowPtr)pDrawable)->devBackingStore; MIBSGCPrivPtr pPriv = (MIBSGCPrivPtr)pGC->devBackingStore; GCPtr pBackingGC = pPriv->pBackingGC; if (!pPriv->inUse) { pPriv->inUse = 1; if ((*pDrawable->pScreen->RegionNotEmpty)(pBackingStore->pSavedRegion)) { xRectangle *pRectCopy; pRectCopy = (xRectangle *)malloc((unsigned)(nrectFill*sizeof(xRectangle))); bcopy(prectInit,pRectCopy,nrectFill*sizeof(xRectangle)); (* pPriv->PolyFillRect)(pDrawable, pGC, nrectFill, prectInit); (* pBackingGC->PolyFillRect)(pBackingStore->pBackingPixmap, pBackingGC, nrectFill, pRectCopy); free((char *)(pRectCopy)); } else { (* pPriv->PolyFillRect)(pDrawable, pGC, nrectFill, prectInit); } pPriv->inUse = 0; } else { (* pPriv->PolyFillRect)(pDrawable, pGC, nrectFill, prectInit); } } static void miBSPolyFillArc(pDraw, pGC, narcs, parcs) DrawablePtr pDraw; GCPtr pGC; int narcs; xArc *parcs; { MIBackingStorePtr pBackingStore = (MIBackingStorePtr)((WindowPtr)pDraw)->devBackingStore; MIBSGCPrivPtr pPriv = (MIBSGCPrivPtr)pGC->devBackingStore; GCPtr pBackingGC = pPriv->pBackingGC; if (!pPriv->inUse) { pPriv->inUse = 1; if ((*pDraw->pScreen->RegionNotEmpty)(pBackingStore->pSavedRegion)) { xArc *pArcsCopy; pArcsCopy = (xArc *)malloc((unsigned)(narcs*sizeof(xArc))); bcopy(parcs,pArcsCopy,narcs*sizeof(xArc)); (* pPriv->PolyFillArc)(pDraw, pGC, narcs, parcs); (* pBackingGC->PolyFillArc)(pBackingStore->pBackingPixmap, pBackingGC, narcs, pArcsCopy); free((char *)(pArcsCopy)); } else { (* pPriv->PolyFillArc)(pDraw, pGC, narcs, parcs); } pPriv->inUse = 0; } else { (* pPriv->PolyFillArc)(pDraw, pGC, narcs, parcs); } } static int miBSPolyText8(pDraw, pGC, x, y, count, chars) DrawablePtr pDraw; GCPtr pGC; int x, y; int count; char *chars; { MIBackingStorePtr pBackingStore = (MIBackingStorePtr)((WindowPtr)pDraw)->devBackingStore; MIBSGCPrivPtr pPriv = (MIBSGCPrivPtr)pGC->devBackingStore; GCPtr pBackingGC = pPriv->pBackingGC; if (!pPriv->inUse) { pPriv->inUse = 1; (* pPriv->PolyText8)(pDraw, pGC, x, y, count, chars); if ((*pDraw->pScreen->RegionNotEmpty)(pBackingStore->pSavedRegion)) { (* pBackingGC->PolyText8)(pBackingStore->pBackingPixmap, pBackingGC, x, y, count, chars); } pPriv->inUse = 0; } else { (* pPriv->PolyText8)(pDraw, pGC, x, y, count, chars); } } static int miBSPolyText16(pDraw, pGC, x, y, count, chars) DrawablePtr pDraw; GCPtr pGC; int x, y; int count; unsigned short *chars; { MIBackingStorePtr pBackingStore = (MIBackingStorePtr)((WindowPtr)pDraw)->devBackingStore; MIBSGCPrivPtr pPriv = (MIBSGCPrivPtr)pGC->devBackingStore; GCPtr pBackingGC = pPriv->pBackingGC; if (!pPriv->inUse) { pPriv->inUse = 1; (* pPriv->PolyText16)(pDraw, pGC, x, y, count, chars); if ((*pDraw->pScreen->RegionNotEmpty)(pBackingStore->pSavedRegion)) { (* pBackingGC->PolyText16)(pBackingStore->pBackingPixmap, pBackingGC, x, y, count, chars); } pPriv->inUse = 0; } else { (* pPriv->PolyText16)(pDraw, pGC, x, y, count, chars); } } static void miBSImageText8(pDraw, pGC, x, y, count, chars) DrawablePtr pDraw; GCPtr pGC; int x, y; int count; char *chars; { MIBackingStorePtr pBackingStore = (MIBackingStorePtr)((WindowPtr)pDraw)->devBackingStore; MIBSGCPrivPtr pPriv = (MIBSGCPrivPtr)pGC->devBackingStore; GCPtr pBackingGC = pPriv->pBackingGC; if (!pPriv->inUse) { pPriv->inUse = 1; (* pPriv->ImageText8)(pDraw, pGC, x, y, count, chars); if ((*pDraw->pScreen->RegionNotEmpty)(pBackingStore->pSavedRegion)) { (* pBackingGC->ImageText8)(pBackingStore->pBackingPixmap, pBackingGC, x, y, count, chars); } pPriv->inUse = 0; } else { (* pPriv->ImageText8)(pDraw, pGC, x, y, count, chars); } } static void miBSImageText16(pDraw, pGC, x, y, count, chars) DrawablePtr pDraw; GCPtr pGC; int x, y; int count; unsigned short *chars; { MIBackingStorePtr pBackingStore = (MIBackingStorePtr)((WindowPtr)pDraw)->devBackingStore; MIBSGCPrivPtr pPriv = (MIBSGCPrivPtr)pGC->devBackingStore; GCPtr pBackingGC = pPriv->pBackingGC; if (!pPriv->inUse) { pPriv->inUse = 1; (* pPriv->ImageText16)(pDraw, pGC, x, y, count, chars); if ((*pDraw->pScreen->RegionNotEmpty)(pBackingStore->pSavedRegion)) { (* pBackingGC->ImageText16)(pBackingStore->pBackingPixmap, pBackingGC, x, y, count, chars); } pPriv->inUse = 0; } else { (* pPriv->ImageText16)(pDraw, pGC, x, y, count, chars); } } static void miBSImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GC *pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; pointer pglyphBase; { MIBackingStorePtr pBackingStore = (MIBackingStorePtr)((WindowPtr)pDrawable)->devBackingStore; MIBSGCPrivPtr pPriv = (MIBSGCPrivPtr)pGC->devBackingStore; GCPtr pBackingGC = pPriv->pBackingGC; if (!pPriv->inUse) { pPriv->inUse = 1; (* pPriv->ImageGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); if ((*pDrawable->pScreen->RegionNotEmpty)(pBackingStore->pSavedRegion)) { (* pBackingGC->ImageGlyphBlt)(pBackingStore->pBackingPixmap, pBackingGC, x, y, nglyph, ppci, pglyphBase); } pPriv->inUse = 0; } else { (* pPriv->ImageGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); } } static void miBSPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GCPtr pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; char *pglyphBase; { MIBackingStorePtr pBackingStore = (MIBackingStorePtr)((WindowPtr)pDrawable)->devBackingStore; MIBSGCPrivPtr pPriv = (MIBSGCPrivPtr)pGC->devBackingStore; GCPtr pBackingGC = pPriv->pBackingGC; if (!pPriv->inUse) { pPriv->inUse = 1; (* pPriv->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); if ((*pDrawable->pScreen->RegionNotEmpty)(pBackingStore->pSavedRegion)) { (* pBackingGC->PolyGlyphBlt)(pBackingStore->pBackingPixmap, pBackingGC, x, y, nglyph, ppci, pglyphBase); } pPriv->inUse = 0; } else { (* pPriv->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); } } static void miBSPushPixels(pGC, pBitMap, pDst, w, h, x, y) GCPtr pGC; PixmapPtr pBitMap; DrawablePtr pDst; int w, h, x, y; { MIBackingStorePtr pBackingStore = (MIBackingStorePtr)((WindowPtr)pDst)->devBackingStore; MIBSGCPrivPtr pPriv = (MIBSGCPrivPtr)pGC->devBackingStore; GCPtr pBackingGC = pPriv->pBackingGC; if (!pPriv->inUse) { pPriv->inUse = 1; (* pPriv->PushPixels)(pGC, pBitMap, pDst, w, h, x, y); if ((*pDst->pScreen->RegionNotEmpty)(pBackingStore->pSavedRegion)) { (* pBackingGC->PushPixels)(pBackingGC, pBitMap, pBackingStore->pBackingPixmap, w, h, x, y); } pPriv->inUse = 0; } else { (* pPriv->PushPixels)(pGC, pBitMap, pDst, w, h, x, y); } } void miInitBackingStore(pWin, SaveAreas, RestoreAreas) WindowPtr pWin; void (*SaveAreas)(); void (*RestoreAreas)(); { register MIBackingStorePtr pBackingStore; register ScreenPtr pScreen; int status; BackingStorePtr pBS; RegionPtr pSavedRegion; BoxPtr extents; BoxRec box; if (pWin->devBackingStore == (pointer) 0) { int false = 0; pScreen = pWin->drawable.pScreen; pBackingStore = (MIBackingStorePtr)Xalloc(sizeof(MIBackingStoreRec)); pBackingStore->pBackingPixmap = (PixmapPtr)(* pScreen->CreatePixmap)(pScreen, pWin->clientWinSize.width, pWin->clientWinSize.height, pWin->drawable.depth, 2 ); pBackingStore->pSavedRegion = (* pScreen->RegionCreate)(((BoxPtr)0), 1); pBackingStore->pgcBlt = CreateGC(pWin, (1L<<16), &false, &status); pBackingStore->serialNumber = 0; pBackingStore->SaveAreas = SaveAreas; pBackingStore->RestoreAreas = RestoreAreas; pBackingStore->viewable = (Bool)pWin->viewable; pBackingStore->clean = 0; pBackingStore->background = (* pScreen->RegionCreate) ( 0, 1); pWin->devBackingStore = (pointer)pBackingStore; pBS = (BackingStorePtr) Xalloc(sizeof(BackingStoreRec)); pBS->obscured = (* pScreen->RegionCreate) ( 0, 1); pBS->SaveDoomedAreas = miSaveAreas; pBS->RestoreAreas = miRestoreAreas; pBS->ExposeCopy = miExposeCopy; pBS->TranslateBackingStore = miTranslateBackingStore; pBS->ClearToBackground = miBSClearToBackground; pWin->backStorage = pBS; box.x1 = pWin->absCorner.x; box.x2 = box.x1 + pWin->clientWinSize.width; box.y1 = pWin->absCorner.y; box.y2 = pWin->absCorner.y + pWin->clientWinSize.height; (* pScreen->Inverse)(pBackingStore->background, pWin->clipList, &box); (* pScreen->TranslateRegion)(pBackingStore->background, -pWin->absCorner.x, -pWin->absCorner.y); pSavedRegion = pBackingStore->pSavedRegion; extents = (* pScreen->RegionExtents)(pBackingStore->background); pBackingStore->pSavedRegion = pBackingStore->background; miBSClearToBackground(pWin, extents->x1, extents->y1, extents->x2 - extents->x1, extents->y2 - extents->y1, 0); pBackingStore->pSavedRegion = pSavedRegion; (* pScreen->Union)(pSavedRegion, pSavedRegion, pBackingStore->background); } } void miFreeBackingStore(pWin) WindowPtr pWin; { MIBackingStorePtr pBackingStore; register ScreenPtr pScreen = pWin->drawable.pScreen; pBackingStore = (MIBackingStorePtr)pWin->devBackingStore; if (pBackingStore != (MIBackingStorePtr) 0) { FreeGC(pBackingStore->pgcBlt); if (pBackingStore->pBackingPixmap) { (* pScreen->DestroyPixmap)(pBackingStore->pBackingPixmap); } (* pScreen->RegionDestroy)(pBackingStore->pSavedRegion); (* pScreen->RegionDestroy)(pBackingStore->background); Xfree((pointer)pBackingStore); pWin->devBackingStore = (pointer) 0; } } static PixmapPtr miResizeBackingStore(pWin, dx, dy) WindowPtr pWin; int dx, dy; { MIBackingStorePtr pBackingStore; PixmapPtr pNewPixmap; PixmapPtr pBackingPixmap; ScreenPtr pScreen; GC *pGC; BoxPtr extents; BoxRec pixbounds; RegionPtr prgnTmp; pBackingStore = (MIBackingStorePtr)(pWin->devBackingStore); pGC = pBackingStore->pgcBlt; pScreen = pWin->drawable.pScreen; pBackingPixmap = pBackingStore->pBackingPixmap; pNewPixmap = (PixmapPtr)(*pScreen->CreatePixmap)(pScreen, pWin->clientWinSize.width, pWin->clientWinSize.height, pWin->drawable.depth, 2 ); ValidateGC(pNewPixmap, pGC); if ((* pScreen->RegionNotEmpty) (pBackingStore->pSavedRegion)) { extents = (*pScreen->RegionExtents)(pBackingStore->pSavedRegion); (*pGC->CopyArea)(pBackingPixmap, pNewPixmap, pGC, extents->x1, extents->y1, extents->x2 - extents->x1, extents->y2 - extents->y1, extents->x1 + dx, extents->y1 + dy); } pBackingStore->pBackingPixmap = pNewPixmap; if (dx || dy) { (* pWin->drawable.pScreen->TranslateRegion)(pBackingStore->pSavedRegion, dx, dy); } pixbounds.x1 = 0; pixbounds.x2 = pNewPixmap->width; pixbounds.y1 = 0; pixbounds.y2 = pNewPixmap->height; prgnTmp = (* pScreen->RegionCreate)(&pixbounds, 1); (* pScreen->Intersect)(pBackingStore->pSavedRegion, pBackingStore->pSavedRegion, prgnTmp); (* pScreen->RegionDestroy)(prgnTmp); (* pScreen->DestroyPixmap)(pBackingPixmap); return (pNewPixmap); } static void miSaveAreas(pWin) register WindowPtr pWin; { MIBackingStorePtr pBackingStore; RegionPtr prgnDoomed; BoxRec winBox; RegionPtr winSize; ScreenPtr pScreen; pBackingStore = (MIBackingStorePtr)pWin->devBackingStore; pScreen = pWin->drawable.pScreen; if (!pWin->realized && ((pWin->backingStore & 3) != 2)) { pBackingStore->viewable = pWin->viewable; (* pScreen->RegionEmpty) (pBackingStore->pSavedRegion); (* pScreen->RegionEmpty) (pBackingStore->background); return; } if (pBackingStore->pBackingPixmap == ((PixmapPtr)0)) { pBackingStore->pBackingPixmap = (PixmapPtr)(*pScreen->CreatePixmap)(pScreen, pWin->clientWinSize.width, pWin->clientWinSize.height, pWin->drawable.depth, 2 ); } prgnDoomed = pWin->backStorage->obscured; (* pScreen->TranslateRegion)(prgnDoomed, -pWin->absCorner.x, -pWin->absCorner.y); winBox.x1 = 0; winBox.y1 = 0; winBox.x2 = pWin->clientWinSize.width; winBox.y2 = pWin->clientWinSize.height; winSize = (* pScreen->RegionCreate) (&winBox, 1); (* pScreen->Intersect) (prgnDoomed, prgnDoomed, winSize); (* pScreen->RegionDestroy) (winSize); (* pBackingStore->SaveAreas) (pBackingStore->pBackingPixmap, prgnDoomed, pWin->backStorage->oldAbsCorner.x, pWin->backStorage->oldAbsCorner.y); (* pScreen->Union)(pBackingStore->pSavedRegion, pBackingStore->pSavedRegion, prgnDoomed); pBackingStore->viewable = (int)pWin->viewable; pBackingStore->pBackingPixmap->drawable.serialNumber = ((++globalSerialNumber) > (1L<<28) ? (globalSerialNumber = 1): globalSerialNumber);; } static void miRestoreAreas(pWin) register WindowPtr pWin; { PixmapPtr pBackingPixmap; GC *pGC; MIBackingStorePtr pBackingStore; RegionPtr prgnSaved; RegionPtr prgnExposed; RegionPtr prgnRestored; register BoxPtr pbox; register int nbox; register ScreenPtr pScreen; pScreen = pWin->drawable.pScreen; pBackingStore = (MIBackingStorePtr)pWin->devBackingStore; pBackingPixmap = pBackingStore->pBackingPixmap; prgnExposed = pWin->exposed; if (pBackingPixmap != ((PixmapPtr)0)) { prgnSaved = pBackingStore->pSavedRegion; prgnRestored = (* pScreen->RegionCreate)((BoxPtr) 0, 1); if ((pWin->clientWinSize.width != pBackingPixmap->width) || (pWin->clientWinSize.height != pBackingPixmap->height)) { pBackingPixmap = miResizeBackingStore(pWin, 0, 0); } (* pScreen->Intersect)(prgnRestored, prgnSaved, prgnExposed); (* pScreen->Subtract)(prgnSaved, prgnSaved, prgnExposed); (* pScreen->Subtract)(prgnExposed, prgnExposed, prgnRestored); pBackingPixmap->drawable.serialNumber = ((++globalSerialNumber) > (1L<<28) ? (globalSerialNumber = 1): globalSerialNumber);; (* pScreen->TranslateRegion) (prgnRestored, pWin->absCorner.x, pWin->absCorner.y); (* pBackingStore->RestoreAreas) (pBackingPixmap, prgnRestored, pWin->absCorner.x, pWin->absCorner.y); (* pScreen->RegionDestroy)(prgnRestored); } if ((pWin->viewable != pBackingStore->viewable) && (((pWin->backingStore & 3) != 2) || ! (* pScreen->RegionNotEmpty) (pBackingStore->pSavedRegion))) { BoxPtr extents; BoxRec box; box.x1 = pWin->absCorner.x; box.x2 = box.x1 + pWin->clientWinSize.width; box.y1 = pWin->absCorner.y; box.y2 = pWin->absCorner.y + pWin->clientWinSize.height; (* pScreen->Inverse)(pBackingStore->background, pWin->clipList, &box); (* pScreen->TranslateRegion) (pBackingStore->background, -pWin->absCorner.x, -pWin->absCorner.y); pBackingStore->clean = 1; } pBackingStore->viewable = (int)pWin->viewable; } static void miTranslateBackingStore(pWin, dx, dy, oldClip) WindowPtr pWin; int dx; int dy; RegionPtr oldClip; { register MIBackingStorePtr pBackingStore; register PixmapPtr pBackingPixmap; register RegionPtr prgnSaved; register RegionPtr exposed; register GC *pGC; if ((dx == 0) && (dy == 0)) { return; } pBackingStore = (MIBackingStorePtr)(pWin->devBackingStore); prgnSaved = pBackingStore->pSavedRegion; pBackingPixmap = pBackingStore->pBackingPixmap; pGC = pBackingStore->pgcBlt; if (pBackingPixmap != ((PixmapPtr)0)) { exposed = (* pWin->drawable.pScreen->RegionCreate) (((BoxPtr)0), 1); (* pWin->drawable.pScreen->RegionCopy) (exposed, prgnSaved); if ((pWin->clientWinSize.width != pBackingPixmap->width) || (pWin->clientWinSize.height != pBackingPixmap->height)) { pBackingStore->pBackingPixmap = miResizeBackingStore(pWin, dx, dy); } else if (prgnSaved->numRects) { ValidateGC(pBackingPixmap, pGC); (* pGC->CopyArea)(pBackingPixmap, pBackingPixmap, pGC, prgnSaved->extents.x1, prgnSaved->extents.x2, prgnSaved->extents.x2 - prgnSaved->extents.x1, prgnSaved->extents.y2 - prgnSaved->extents.y1, prgnSaved->extents.x1 + dx, prgnSaved->extents.y1 + dy); (* pGC->pScreen->TranslateRegion) (prgnSaved, dx, dy); } } else { exposed = (* pWin->drawable.pScreen->RegionCreate)(((BoxPtr)0), 1); (* pWin->drawable.pScreen->RegionCopy) (exposed, pBackingStore->background); } (* pWin->drawable.pScreen->Subtract) (exposed, exposed, prgnSaved); if ((* pWin->drawable.pScreen->RegionNotEmpty) (exposed)) { RegionPtr prgnCopy; prgnCopy = pWin->backStorage->obscured; (* pWin->drawable.pScreen->Union) (prgnSaved, exposed, prgnSaved); (* pWin->drawable.pScreen->TranslateRegion)(exposed, pWin->absCorner.x-dx, pWin->absCorner.y-dy); (* pWin->drawable.pScreen->Intersect) (prgnCopy, exposed, oldClip); (* pWin->drawable.pScreen->TranslateRegion) (prgnCopy, dx, dy); pWin->backStorage->oldAbsCorner.x = pWin->absCorner.x - dx; pWin->backStorage->oldAbsCorner.y = pWin->absCorner.y - dy; miSaveAreas(pWin); (* pWin->drawable.pScreen->TranslateRegion) (exposed, -(pWin->absCorner.x-dx), -(pWin->absCorner.y-dy)); (* pWin->drawable.pScreen->Subtract) (exposed, exposed, prgnCopy); (* pWin->drawable.pScreen->RegionEmpty) (prgnCopy); if ((* pWin->drawable.pScreen->RegionNotEmpty) (exposed)) { BoxPtr extents; extents = (* pWin->drawable.pScreen->RegionExtents) (exposed); pBackingStore->pSavedRegion = exposed; miBSClearToBackground(pWin, extents->x1, extents->y1, extents->x2 - extents->x1, extents->y2 - extents->y1, 1); pBackingStore->pSavedRegion = prgnSaved; } } (* pWin->drawable.pScreen->RegionDestroy) (exposed); } static void miBSDestroyGC (pGC, pGCI) GCPtr pGC; GCInterestPtr pGCI; { MIBSGCPrivPtr pPriv = (MIBSGCPrivPtr) pGC->devBackingStore; (* pGC->pScreen->RegionDestroy) (pPriv->pTransClientClip); FreeGC(pPriv->pBackingGC); Xfree(pGC->devBackingStore); Xfree(pGCI); } void miValidateBackingStore(pWin, pGC, procChanges) WindowPtr pWin; GCPtr pGC; int procChanges; { GCPtr pBackingGC; MIBackingStorePtr pBackingStore; MIBSGCPrivPtr pPriv; int stateChanges; register int index, mask; pBackingStore = (MIBackingStorePtr)pWin->devBackingStore; pPriv = (MIBSGCPrivPtr)pGC->devBackingStore; if (pPriv != (MIBSGCPrivPtr) 0) { stateChanges = pGC->stateChanges; pBackingGC = pPriv->pBackingGC; } else { BITS32 status; GCInterestPtr pGCI; pPriv = (MIBSGCPrivPtr)Xalloc(sizeof(MIBSGCPrivRec)); pBackingGC = pPriv->pBackingGC = CreateGC(pWin, 0, (long *)0, &status); pPriv->inUse = 0; pPriv->gcHooked = 0; pPriv->pTransClientClip = (* pGC->pScreen->RegionCreate)( 0, 1); pPriv->changes = 0; pGC->devBackingStore = (pointer)pPriv; pGCI = (GCInterestPtr)Xalloc(sizeof(GCInterestRec)); pGCI->length = sizeof(GCInterestRec); pGCI->owner = 0; pGCI->ValInterestMask = 0; pGCI->CopyGCSource = pGCI->CopyGCDest = pGCI->ValidateGC = (void (*)()) 0; pGCI->ChangeGC = (int (*)()) 0; pGCI->ChangeInterestMask = 0; pGCI->DestroyGC = miBSDestroyGC; pGCI->extPriv = (pointer) 0; { pGCI->pNextGCInterest = pGC->pNextGCInterest; pGCI->pLastGCInterest = (GCInterestPtr)&pGC->pNextGCInterest; pGC->pNextGCInterest->pLastGCInterest = pGCI; pGC->pNextGCInterest= pGCI; } ; stateChanges = (1 << ( 22+1)) - 1; procChanges = ((1L<<20)-1); } if ((pWin->drawable.type != 0) || (((pWin->backingStore & 3) != 2) && ((pWin->backingStore == 0) || (!pWin->viewable)))) { pPriv->changes |= stateChanges; if (pPriv->gcHooked) { mask = (~procChanges) & ((1L<<20)-1); while (mask) { index = ffs(mask) - 1; index = (1 << index); mask &= ~index; switch(index) { case (1L<<0) : pGC->FillSpans = pPriv->FillSpans; break; case (1L<<1) : pGC->SetSpans = pPriv->SetSpans; break; case (1L<<2) : pGC->PutImage = pPriv->PutImage; break; case (1L<<3) : pGC->CopyArea = pPriv->CopyArea; break; case (1L<<4) : pGC->CopyPlane = pPriv->CopyPlane; break; case (1L<<5) : pGC->PolyPoint = pPriv->PolyPoint; break; case (1L<<6) : pGC->Polylines = pPriv->Polylines; break; case (1L<<7) : pGC->PolySegment = pPriv->PolySegment; break; case (1L<<8) : pGC->PolyRectangle = pPriv->PolyRectangle; break; case (1L<<9) : pGC->PolyArc = pPriv->PolyArc; break; case (1L<<10): pGC->FillPolygon = pPriv->FillPolygon; break; case (1L<<11): pGC->PolyFillRect = pPriv->PolyFillRect; break; case (1L<<12): pGC->PolyFillArc = pPriv->PolyFillArc; break; case (1L<<13): pGC->PolyText8 = pPriv->PolyText8; break; case (1L<<14): pGC->PolyText16 = pPriv->PolyText16; break; case (1L<<15): pGC->ImageText8 = pPriv->ImageText8; break; case (1L<<16): pGC->ImageText16 = pPriv->ImageText16; break; case (1L<<17): pGC->ImageGlyphBlt = pPriv->ImageGlyphBlt; break; case (1L<<18): pGC->PolyGlyphBlt = pPriv->PolyGlyphBlt; break; case (1L<<19): pGC->PushPixels = pPriv->PushPixels; break; } } pPriv->gcHooked = 0; } return; } else { stateChanges |= pPriv->changes; pPriv->changes = 0; CopyGC(pGC, pBackingGC, stateChanges); if (!pPriv->gcHooked) { procChanges = ((1L<<20)-1); } pPriv->gcHooked = 1; } if (pBackingStore->pBackingPixmap == ((PixmapPtr)0)) { pBackingStore->pBackingPixmap = (PixmapPtr)(* pGC->pScreen->CreatePixmap) (pGC->pScreen, pWin->clientWinSize.width, pWin->clientWinSize.height, pWin->drawable.depth, 2 ); } if (pBackingStore->clean) { RegionPtr pSavedRegion; BoxPtr extents; pSavedRegion = pBackingStore->pSavedRegion; extents = (* pGC->pScreen->RegionExtents) (pBackingStore->background); pBackingStore->pSavedRegion = pBackingStore->background; miBSClearToBackground(pWin, extents->x1, extents->y1, extents->x2 - extents->x1, extents->y2 - extents->y1, 0); pBackingStore->pSavedRegion = pSavedRegion; (* pGC->pScreen->Union) (pSavedRegion, pSavedRegion, pBackingStore->background); pBackingStore->clean = 0; } mask = procChanges; while (mask) { index = ffs(mask) - 1; index = (1 << index); mask &= ~index; switch(index) { case (1L<<0) : pPriv->FillSpans = pGC->FillSpans; pGC->FillSpans = miBSFillSpans; break; case (1L<<1) : pPriv->SetSpans = pGC->SetSpans; pGC->SetSpans = miBSSetSpans; break; case (1L<<2) : pPriv->PutImage = pGC->PutImage; pGC->PutImage = miBSPutImage; break; case (1L<<3) : pPriv->CopyArea = pGC->CopyArea; pGC->CopyArea = miBSCopyArea; break; case (1L<<4) : pPriv->CopyPlane = pGC->CopyPlane; pGC->CopyPlane = miBSCopyPlane; break; case (1L<<5) : pPriv->PolyPoint = pGC->PolyPoint; pGC->PolyPoint = miBSPolyPoint; break; case (1L<<6) : pPriv->Polylines = pGC->Polylines; pGC->Polylines = miBSPolylines; break; case (1L<<7) : pPriv->PolySegment = pGC->PolySegment; pGC->PolySegment = miBSPolySegment; break; case (1L<<8) : pPriv->PolyRectangle = pGC->PolyRectangle; pGC->PolyRectangle = miBSPolyRectangle; break; case (1L<<9) : pPriv->PolyArc = pGC->PolyArc; pGC->PolyArc = miBSPolyArc; break; case (1L<<10): pPriv->FillPolygon = pGC->FillPolygon; pGC->FillPolygon = miBSFillPolygon; break; case (1L<<11): pPriv->PolyFillRect = pGC->PolyFillRect; pGC->PolyFillRect = miBSPolyFillRect; break; case (1L<<12): pPriv->PolyFillArc = pGC->PolyFillArc; pGC->PolyFillArc = miBSPolyFillArc; break; case (1L<<13): pPriv->PolyText8 = pGC->PolyText8; pGC->PolyText8 = miBSPolyText8; break; case (1L<<14): pPriv->PolyText16 = pGC->PolyText16; pGC->PolyText16 = miBSPolyText16; break; case (1L<<15): pPriv->ImageText8 = pGC->ImageText8; pGC->ImageText8 = miBSImageText8; break; case (1L<<16): pPriv->ImageText16 = pGC->ImageText16; pGC->ImageText16 = miBSImageText16; break; case (1L<<17): pPriv->ImageGlyphBlt = pGC->ImageGlyphBlt; pGC->ImageGlyphBlt = miBSImageGlyphBlt; break; case (1L<<18): pPriv->PolyGlyphBlt = pGC->PolyGlyphBlt; pGC->PolyGlyphBlt = miBSPolyGlyphBlt; break; case (1L<<19): pPriv->PushPixels = pGC->PushPixels; pGC->PushPixels = miBSPushPixels; break; } } { RegionPtr tempRgn; BoxRec winBounds; pBackingStore->serialNumber = pWin->drawable.serialNumber; if (pGC->clientClipType == 0) { BoxRec bounds; bounds.x1 = bounds.y1 = 0; bounds.x2 = pWin->clientWinSize.width; bounds.y2 = pWin->clientWinSize.height; (*pGC->pScreen->RegionReset) (pPriv->pTransClientClip, &bounds); } else if (stateChanges & ( (1L<<17)| (1L<<18)| (1L<<19))) { if (pGC->clientClipType != 2) { FatalError("miValidateBackingStore: client clip not a region"); } (*pGC->pScreen->RegionCopy) (pPriv->pTransClientClip, pGC->clientClip); if (stateChanges & ( (1L<<17)| (1L<<18))) { (*pGC->pScreen->TranslateRegion) (pPriv->pTransClientClip, pGC->clipOrg.x, pGC->clipOrg.y); } } tempRgn = (*pGC->pScreen->RegionCreate) ( 0, 1); winBounds.x1 = pWin->absCorner.x; winBounds.x2 = pWin->absCorner.x + pWin->clientWinSize.width; winBounds.y1 = pWin->absCorner.y; winBounds.y2 = pWin->absCorner.y + pWin->clientWinSize.height; (*pGC->pScreen->Inverse) (tempRgn, pWin->clipList, &winBounds); (*pGC->pScreen->TranslateRegion) (tempRgn, -pWin->absCorner.x, -pWin->absCorner.y); (*pGC->pScreen->Intersect) (tempRgn, tempRgn, pPriv->pTransClientClip); (*pBackingGC->ChangeClip) (pBackingGC, 2, tempRgn, 0); } if (stateChanges & (1L<<16)) { int false = 0; ChangeGC(pBackingGC, (1L<<16), &false); } ValidateGC(pBackingStore->pBackingPixmap, pBackingGC); } static void miExposeCopy (pSrc, pDst, pGC, prgnExposed, srcx, srcy, dstx, dsty, plane) WindowPtr pSrc; DrawablePtr pDst; GCPtr pGC; RegionPtr prgnExposed; int srcx, srcy; int dstx, dsty; unsigned long plane; { RegionPtr tempRgn; MIBackingStorePtr pBackingStore; void (*copyProc)(); register BoxPtr pBox; register int i; register int dx, dy; pBackingStore = (MIBackingStorePtr)pSrc->devBackingStore; tempRgn = (* pGC->pScreen->RegionCreate) ( 0, 1); (* pGC->pScreen->Intersect) (tempRgn, prgnExposed, pBackingStore->pSavedRegion); (* pGC->pScreen->Subtract) (prgnExposed, prgnExposed, tempRgn); if (plane != 0) { copyProc = pGC->CopyPlane; } else { copyProc = pGC->CopyArea; } dx = dstx - srcx; dy = dsty - srcy; for (i = tempRgn->numRects, pBox = tempRgn->rects; i > 0; i--, pBox++) { (* copyProc) (pBackingStore->pBackingPixmap, pDst, pGC, pBox->x1, pBox->y1, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, pBox->x1 + dx, pBox->y1 + dy, plane); } } static void miBSClearToBackground(pWin, x, y, w, h, generateExposures) WindowPtr pWin; int x; int y; int w; int h; Bool generateExposures; { RegionPtr pRgn; xEvent *events; int i; MIBackingStorePtr pBackingStore; PixmapPtr pBackingPixmap; ScreenPtr pScreen; GCPtr pGC; int ts_x_origin, ts_y_origin; int gcvalues[4]; unsigned long gcmask; xRectangle *rects; BoxPtr pBox; BoxRec box; pBackingStore = (MIBackingStorePtr)pWin->devBackingStore; pBackingPixmap = pBackingStore->pBackingPixmap; pScreen = pWin->drawable.pScreen; box.x1 = x; box.y1 = y; box.x2 = x + w; box.y2 = y + h; pRgn = (*pWin->drawable.pScreen->RegionCreate)(&box, 1); (* pScreen->Intersect) (pRgn, pRgn, pBackingStore->pSavedRegion); if ((* pScreen->RegionNotEmpty) (pRgn)) { int backgroundTile, backgroundPixel; pGC = GetScratchGC(pWin->drawable.depth, pScreen); ts_x_origin = ts_y_origin = 0; backgroundTile = (int)pWin->backgroundTile; backgroundPixel = pWin->backgroundPixel; if (backgroundTile == 1L ) { WindowPtr pParent; pParent = pWin; while ((int)pParent->backgroundTile == 1L ) { ts_x_origin -= pParent->clientWinSize.x; ts_y_origin -= pParent->clientWinSize.y; pParent = pParent->parent; } backgroundTile = (int)pParent->backgroundTile; backgroundPixel = pParent->backgroundPixel; } switch(backgroundTile) { case 0L : return; case 3: gcvalues[0] = backgroundPixel; gcvalues[1] = 0; gcmask = (1L<<2)| (1L<<8); break; default: gcvalues[0] = 1; gcvalues[1] = backgroundTile; gcmask = (1L<<8)| (1L<<10); break; } gcvalues[2] = ts_x_origin; gcvalues[3] = ts_y_origin; gcmask |= (1L<<12)|(1L<<13); DoChangeGC(pGC, gcmask, gcvalues, 1); ValidateGC(pBackingPixmap, pGC); rects = (xRectangle *)malloc((unsigned)(pRgn->numRects*sizeof(xRectangle))); for (i = 0, pBox = pRgn->rects; i < pRgn->numRects; i++, pBox++) { rects[i].x = pBox->x1; rects[i].y = pBox->y1; rects[i].width = pBox->x2 - pBox->x1; rects[i].height = pBox->y2 - pBox->y1; } (* pGC->PolyFillRect) (pBackingPixmap, pGC, pRgn->numRects, rects); FreeScratchGC(pGC); if (generateExposures) { int offset; xEvent *events, *ev; offset = (((* pScreen->RectIn) (pRgn, &box) != 1)?1:0); events = (xEvent *)malloc((unsigned)(pRgn->numRects*sizeof(xEvent))); for (i = pRgn->numRects-1, pBox = pRgn->rects, ev = events; i >= 0; i--, pBox++, ev++) { ev->u.u.type = 12; ev->u.expose.window = pWin->wid; ev->u.expose.x = pBox->x1; ev->u.expose.y = pBox->y1; ev->u.expose.width = pBox->x2 - pBox->x1; ev->u.expose.height = pBox->y2 - pBox->y1; ev->u.expose.count = i + offset; } DeliverEvents(pWin, events, pRgn->numRects, ((WindowPtr) 0)); free((char *)(events)); } free((char *)(rects)); } (* pScreen->RegionDestroy) (pRgn); }