home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xibm.zip / ibm8514 / brcData.c < prev    next >
C/C++ Source or Header  |  1991-09-28  |  14KB  |  356 lines

  1. /*
  2.  * $Id: brcData.c,v 1.2 1991/09/28 03:05:45 mtranle Exp $
  3.  *
  4.  * Copyright IBM Corporation 1987,1990
  5.  *
  6.  * All Rights Reserved
  7.  *
  8.  * Permission to use, copy, modify, and distribute this software and its
  9.  * documentation for any purpose and without fee is hereby granted,
  10.  * provided that the above copyright notice appear in all copies and that 
  11.  * both that copyright notice and this permission notice appear in
  12.  * supporting documentation, and that the name of IBM not be
  13.  * used in advertising or publicity pertaining to distribution of the
  14.  * software without specific, written prior permission.
  15.  *
  16.  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  17.  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
  18.  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  19.  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  20.  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  21.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  22.  * SOFTWARE.
  23.  *
  24. */
  25. /*
  26.  * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
  27.  * LICENSED MATERIALS - PROPERTY OF IBM
  28.  * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
  29.  */
  30. #include "X.h"
  31. #include "Xproto.h"
  32. #include "miscstruct.h"
  33. #include "scrnintstr.h"
  34. #include "font.h"
  35. #include "pixmapstr.h"
  36. #include "window.h"
  37. #include "gcstruct.h"
  38. #include "colormapst.h"
  39. #include "cursorstr.h"
  40.  
  41. #include "mistruct.h"
  42. #include "mfb.h"
  43.  
  44. #include "OScursor.h"
  45. #include "OSio.h"
  46. #include "ibmScreen.h"
  47.  
  48. #include "ppc.h"
  49. #include "ppcProcs.h"
  50.  
  51. #include "x8514.h"
  52.  
  53. #include "brcProcs.h"
  54.  
  55. extern void miRecolorCursor() ;
  56. extern void NoopDDA() ;
  57. extern void ibmAbort() ;
  58.  
  59. extern ScreenRec ibm8514ScreenRec ; /* Forward Declaration */
  60.  
  61. PixmapFormatRec    ibm8514Formats[]= { { IBM8514MAXPLANES, 8, 32 } } ;
  62.  
  63. VisualRec ibm8514Visuals[] = {
  64.     {
  65.     0,            /* unsigned long    vid */
  66.     PseudoColor,        /* short       class */
  67.     6,            /* short       bitsPerRGBValue */
  68.     1 << IBM8514MAXPLANES,    /* short    ColormapEntries */
  69.     IBM8514MAXPLANES,    /* short    nplanes */
  70.     0,            /* unsigned long    redMask */
  71.     0,            /* unsigned long    greenMask */
  72.     0,            /* unsigned long    blueMask */
  73.     0,            /* int        offsetRed */
  74.     0,            /* int        offsetGreen */
  75.     0            /* int        offsetBlue */
  76.     }
  77. } ;
  78.  
  79. #define NUM_VISUALS    (sizeof ibm8514Visuals/sizeof (VisualRec))
  80.  
  81. unsigned long int ibm8514DepthVIDs[NUM_VISUALS];
  82.  
  83. DepthRec ibm8514Depths[] = {
  84. /*    depth            numVid        vids */
  85.     {    1,            0,        NULL         },
  86.     {    IBM8514MAXPLANES,    NUM_VISUALS,    ibm8514DepthVIDs }
  87. } ;
  88.  
  89. #define ibm8514GCInterestValidateMask \
  90. ( GCLineStyle | GCLineWidth | GCJoinStyle | GCBackground | GCForeground    \
  91. | GCFunction | GCPlaneMask | GCFillStyle | GC_CALL_VALIDATE_BIT        \
  92. | GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode )
  93.  
  94. ppcPrivGC ibm8514PrototypeGCPriv = {
  95.     GXcopy,        /* unsigned char    rop */
  96.     0,        /* unsigned char    ropOpStip */
  97.     0,        /* unsigned char    oneRect */
  98.     TRUE,        /* short    fExpose */
  99.     FALSE,        /* short    freeCompClip */
  100.     NullPixmap,    /* PixmapPtr    pRotatedPixmap */
  101.     0,        /* RegionPtr    pCompositeClip */
  102.     ibm8514AreaFill,/* void     (* FillArea)() */
  103.     {
  104.         ibm8514ALLPLANES,    /* unsigned long    planemask */
  105.         0,            /* unsigned long    fgPixel */
  106.         1,            /* unsigned long    bgPixel */
  107.         GXcopy,        /* int            alu */
  108.         FillSolid,        /* int            fillStyle */
  109.     }, /* ppcReducedRrop    colorRrop  */
  110.     -1,        /* short lastDrawableType */
  111.     -1,        /* short lastDrawableDepth */
  112.     ibmAbort,     /* void (* cachedIGBlt)() */
  113.     ibmAbort,     /* void (* cachedPGBlt)() */
  114.     0        /* pointer devPriv */
  115. } ;
  116.  
  117. GCFuncs ibm8514GCFuncs = {
  118. ppcValidateGC,            /* void (*ValidateGC)() */
  119. NoopDDA,            /* void (*ChangeGC)() */
  120. NoopDDA,            /* void (*CopyGC)() */
  121. ppcDestroyGC,            /* void (*DestroyGC)() */
  122. ppcChangeClip,            /* void (*ChangeClip)() */
  123. ppcDestroyClip,            /* void (*DestroyClip)() */
  124. ppcCopyClip            /* void (*CopyClip)() */
  125. };
  126.  
  127. GCOps ibm8514GCOps = {
  128.     ibm8514SolidFS,        /*  void (* FillSpans)() */
  129.     ppcSetSpans,        /*  void (* SetSpans)()     */
  130.     miPutImage,        /*  void (* PutImage)()     */
  131.     ppcCopyArea,        /*  RegionPtr (* CopyArea)()     */
  132.     miCopyPlane,        /*  void (* CopyPlane)() */
  133.     ibm8514PolyPoint,    /*  void (* PolyPoint)() */
  134.     ppcScrnZeroLine,    /*  void (* Polylines)() */
  135.     ppcScrnZeroSegs,    /*  void (* PolySegment)() */
  136.     miPolyRectangle,    /*  void (* PolyRectangle)() */
  137.     miPolyArc,        /*  void (* PolyArc)()     */
  138.     ibm8514FillPolygon,    /*  void (* FillPolygon)() */
  139.     miPolyFillRect,        /*  void (* PolyFillRect)() */
  140.     miPolyFillArc,        /*  void (* PolyFillArc)() */
  141.     ibm8514PolyText8,    /*  int (* PolyText8)()     */
  142.     ibm8514PolyText16,    /*  int (* PolyText16)() */
  143.     ibm8514ImageText8,    /*  void (* ImageText8)() */
  144.     ibm8514ImageText16,    /*  void (* ImageText16)() */
  145.     (void (*)()) ibm8514ImageGlyphBlt,    /*  void (* ImageGlyphBlt)() */
  146.     (void (*)()) ppcPolyGlyphBlt,    /*  void (* PolyGlyphBlt)() */
  147.     ibm8514PushPixels,    /*  void (* PushPixels)() */
  148.     miMiter            /*  void (* LineHelper)() */
  149. };
  150.  
  151. GC ibm8514PrototypeGC = {
  152.     &ibm8514ScreenRec,    /*  ScreenPtr    pScreen     */
  153.     IBM8514MAXPLANES,    /*  int         depth     */
  154.     GXcopy,            /*  int        alu     */
  155.     0,            /*  int        lineWidth */
  156.     0,            /*  int        dashOffset */
  157.     0,            /*  int        numInDashList */
  158.     0,            /*  unsigned char *dash     */
  159.     LineSolid,        /*  int        lineStyle */
  160.     CapButt,        /*  int        capStyle */
  161.     JoinMiter,        /*  int        joinStyle */
  162.     FillSolid,        /*  int        fillStyle */
  163.     EvenOddRule,        /*  int        fillRule */
  164.     ArcPieSlice,        /*  int        arcMode     */
  165.     ClipByChildren,        /*  int        subWindowMode */
  166.     TRUE,            /*  Bool    graphicsExposures */
  167.     CT_NONE,        /*  int        clientClipType */
  168.     1,            /*  int        miTranslate:1 */
  169.     1,            /* unsigned int tileIsPixel:1 */
  170.     0,            /* unused:16 */
  171.     ibm8514ALLPLANES,    /*  unsigned long    planemask */
  172.     0,            /*  unsigned long    fgPixel */
  173.     1,            /*  unsigned long    bgPixel */
  174.     0,            /*  PixmapPtr    tile     */
  175.     0,            /*  PixmapPtr    stipple     */
  176.     { 0, 0 },        /*  DDXPointRec    patOrg     */
  177.     0,            /*  FontPtr    font     */
  178.     { 0, 0 },        /*  DDXPointRec    clipOrg     */
  179.     { 0, 0 },        /*  DDXPointRec    lastWinOrg */
  180.     NULL,            /*  pointer    clientClip */
  181.     /*(1<<(GCLastBit+1))-1,*/    /*  unsigned long    stateChanges */
  182.     0,            /*  unsigned long    stateChanges */
  183.     0,            /*  unsigned long        serialNumber */
  184.     (GCFuncs *) &ibm8514GCFuncs,    /*  pointer    funcs     */
  185.     (GCOps *) &ibm8514GCOps,    /*  pointer    ops     */
  186.     NULL /*  devUnion devPrivates     */
  187. } ;
  188.  
  189. ppcScrnPriv ibm8514ScrnPriv = {
  190.     {
  191.         {
  192.             (unsigned char)DRAWABLE_PIXMAP,/* unsigned char  type */
  193.             (unsigned char)0,        /*unsigned char class */
  194.             (unsigned char)IBM8514MAXPLANES, /*unsignedchar depth */
  195.             (unsigned char)1,     /* unsigned char   bitsPerPixel */
  196.             0,        /* unsigned long   id */
  197.             0,        /* short          x */
  198.             0,        /* short           y */
  199.             _8514_SCREEN_WIDTH, /* unsigned short  width */
  200.             _8514_SCREEN_HEIGHT, /* unsigned short  height */
  201.             0,        /* ScreenPtr       pScreen */
  202.             0,        /* unsigned long   serialNumber */
  203.         },        /* DrawableRec drawable */
  204.         1,        /* int refcnt */
  205.         _8514_SCREEN_WIDTH / 8,    /* int devKind */
  206.         0        /* pointer devPrivate */
  207.     },            /* PixmapRec    pixmap */
  208.     0,            /* void    (* devHardwareInitBB)() */
  209.     0,            /* void    (* devHardwareInitAB)() */
  210.     &ibm8514PrototypeGC,    /* GCPtr    devPrototypeGC */
  211.     &ibm8514PrototypeGCPriv,/* ppcPrivGC     *devPrototypeGCPriv */
  212.     ibm8514ChangeGCtype,    /* Mask        (* changeGCtype)() */
  213.     ibm8514ChangeWindowGC,    /* Mask        (* changeWindowGC)() */
  214.     0,            /* Colormap    InstalledColormap */
  215.     ibm8514Bitblt,        /* void    (* blit)() */
  216.     ibm8514DrawRectangle,    /* void    (* solidFill)() */
  217.     ibm8514TileRect,    /* void    (* tileFill)() */
  218.     ibm8514Stipple,        /* void    (* stipFill)() */
  219.     ibm8514OpStipple,    /* void    (* opstipFill)() */
  220.     ibm8514DrawColorImage,    /* void    (* imageFill)() */
  221.     ibm8514ReadColorImage,    /* void    (* imageRead)() */
  222.     ibm8514BresLine,    /* void    (* lineBres)() */
  223.     ibm8514HorzLine,    /* void    (* lineHorz)() */
  224.     ibm8514VertLine,    /* void    (* lineVert)() */
  225.     ibm8514SetColor,    /* void    (* setColor)() */
  226.     ibm8514RecolorCursor,    /* void    (* RecolorCursor)() */
  227.     ibm8514FillMonoImage,    /* void    (* monoFill)() */
  228.     ibm8514DrawMonoByteImage,    /* void    (* glyphFill)() */
  229.     (unsigned long *(*)()) NoopDDA,    /* unsigned long *((* planeRead)()) */
  230.     ppcReplicateArea,    /* void    (* replicateArea)() */
  231. #ifdef UseHardwareDash
  232.     ibm8514DestroyGCPriv,    /* void    (* DestroyGCPriv)() */
  233. #else
  234.     NoopDDA,        /* void    (* DestroyGCPriv)() */
  235. #endif
  236. /* High Level Software Cursor Support !! */
  237.     &ibm8514cursorSemaphore,/* int    * CursorSemaphore */
  238.     ibm8514CheckCursor,    /* int    (* CheckCursor)() */
  239.     ibm8514ReplaceCursor,    /* void    (* ReplaceCursor)() */
  240.     0            /* ppcCacheInfoPtr cacheInfo */
  241. } ;
  242.  
  243. ScreenRec ibm8514ScreenRec = {
  244.     0,                    /* int         myNum */
  245.     0,                /* ATOM          id */
  246.     _8514_SCREEN_WIDTH,        /* short     width */
  247.     _8514_SCREEN_HEIGHT,        /* short     height */
  248.     (_8514_SCREEN_WIDTH * 254)/800,    /* short     mmWidth */
  249.     (_8514_SCREEN_HEIGHT*254)/800,    /* short     mmHeight */
  250.     sizeof ibm8514Depths/sizeof (DepthRec),    /* short numDepths */
  251.     IBM8514MAXPLANES,        /* short            rootDepth */
  252.     ibm8514Depths,            /* DepthPtr      allowedDepths */
  253.     0,                /* unsigned long rootVisual */
  254.     0,                /* unsigned long defColormap */
  255.     0,                /* short     minInstalledCmaps */
  256.     1,                /* short     maxInstalledCmaps */
  257.     Always,                /* char          backingStoreSupport */
  258.     NotUseful,            /* char          saveUnderSupport */
  259.     IBM8514_WHITE_PIXEL,        /* unsigned long whitePixel */
  260.     IBM8514_BLACK_PIXEL,        /* unsigned long blackPixel */
  261.     0,                /* unsigned long rgf */
  262.     { 0 },                /* GCPtr GCperDepth[MAXFORMATS+1] */
  263.     { 0 },                /* PixmapPtr      PixmapPerDepth[1] */
  264.     (pointer) &ibm8514ScrnPriv,    /* pointer     devPrivate */
  265.     NUM_VISUALS,            /* short         numVisuals */
  266.     &ibm8514Visuals[0],        /* VisualPtr    visuals */
  267.     0,                /* int         WindowPrivateLen; */
  268.     0,                /* unsigned     WindowPrivateSizes; */
  269.     0,                /* unsigned     totalWindowSize; */
  270.     0,                /* int         GCPrivateLen; */
  271.     0,                /* unsigned     GCPrivateSizes; */
  272.     0,                /* unsigned     totalGCSize; */
  273. /* Random screen procedures */
  274.     ibm8514ScreenClose,    /* Bool (* CloseScreen)() */
  275.     ppcQueryBestSize,    /* void (* QueryBestSize)() */
  276.     ibmSaveScreen,        /* Bool (* SaveScreen)() */
  277.     ppcGetImage,        /* void (* GetImage)() */
  278.     ibm8514GetSpans,    /* void (*GetSpans)() */
  279.     (void (*)())ibmAbort,    /* void (* PointerNonInterestBox)() */
  280.     (void (*)())NULL,    /* void (* SourceValidate)() */
  281. /* Window Procedures */
  282.     ppcCreateWindow,    /* Bool (* CreateWindow)() */
  283.     ppcDestroyWindow,    /* Bool (* DestroyWindow)() */
  284.     ppcPositionWindow,    /* Bool (* PositionWindow)() */
  285.     mfbChangeWindowAttributes,    /* Bool (* ChangeWindowAttributes)() */
  286.     mfbMapWindow,        /* Bool (* RealizeWindow)() */
  287.     mfbUnmapWindow,        /* Bool (* UnrealizeWindow)() */
  288.     miValidateTree,        /* int  (* ValidateTree)() */
  289.     (void (*)())NULL,    /* void (* PostValidateTree)() */
  290.     miWindowExposures,    /* void (* WindowExposures)() */
  291.     ppcPaintWindow,        /* void (* PaintWindowBackground)() */
  292.     ppcPaintWindow,        /* void (* PaintWindowBorder)() */
  293.     ppcCopyWindow,        /* void (* CopyWindow)() */
  294.     miClearToBackground,    /* void (* ClearToBackground)() */
  295.     (void (*)())NULL,    /* void (* ClipNotify)() */
  296. /* Pixmap procedures */
  297.     ppcCreatePixmap,    /* PixmapPtr (* CreatePixmap)() */
  298.     mfbDestroyPixmap,    /* Bool (* DestroyPixmap)() */
  299. /* Backing store Procedures */
  300.     (void (*)())NoopDDA,        /* void SaveDoomedAreas */
  301.     (RegionPtr (*)())ppcRestoreAreas,    /* RegionPtr RestoreAreas */
  302.     (void (*)())NoopDDA,        /* void ExposeCopy */
  303.     (RegionPtr (*)())NoopDDA,    /* RegionPtr TranslateBackingStore */
  304.     (RegionPtr (*)())NoopDDA,    /* RegionPtr ClearBackingStore */
  305.     NoopDDA,        /* void DrawGuarantee */
  306. /* Font procedures */
  307.     ibm8514RealizeFont,    /* Bool (* RealizeFont)() */
  308.     ibm8514UnrealizeFont,    /* Bool (* UnrealizeFont)() */
  309. /* Cursor Procedures */
  310.     OS_ConstrainCursor,    /* void (* ConstrainCursor)() */
  311.     OS_CursorLimits,    /* void (* CursorLimits)() */
  312.     ibm8514DisplayCursor,    /* Bool (* DisplayCursor)() */
  313.     ibm8514RealizeCursor,    /* Bool (* RealizeCursor)() */
  314.     ibm8514UnrealizeCursor,    /* Bool (* UnrealizeCursor)() */
  315.     miRecolorCursor,    /* void (* RecolorCursor)() */
  316.     OS_SetCursorPosition,    /* Bool (* SetCursorPosition)() */
  317. /* GC procedures */
  318.     ppcCreateGC,        /* Bool (* CreateGC)() */
  319. /* Colormap procedures */
  320.     ppcCreateColormapNoop,    /* void (* CreateColormap)() */
  321.     NoopDDA,        /* void (* DestroyColormap)() */
  322.     ppcInstallColormap,    /* void (* InstallColormap)() */
  323.     ppcUninstallColormap,    /* void (* UninstallColormap)() */
  324.     ppcListInstalledColormaps,    /* int (* ListInstalledColormaps) () */
  325.     ppcStoreColors,        /* void (* StoreColors)() */
  326.     ppcResolveColor,    /* void (* ResolveColor)() */
  327. /* Region procedures */
  328.     miRegionCreate,        /* RegionPtr (* RegionCreate)() */
  329.     miRegionInit,        /* void (* RegionInit)() */
  330.     miRegionCopy,        /* Bool (* RegionCopy)() */
  331.     miRegionDestroy,    /* void (* RegionDestroy)() */
  332.     miRegionUninit,        /* void (* RegionUninit)() */
  333.     miIntersect,        /* int (* Intersect)() */
  334.     miUnion,        /* int (* Union)() */
  335.     miSubtract,        /* int (* Subtract)() */
  336.     miInverse,        /* int (* Inverse)() */
  337.     miRegionReset,        /* void (* RegionReset)() */
  338.     miTranslateRegion,    /* void (* TranslateRegion)() */
  339.     miRectIn,        /* int (* RectIn)() */
  340.     miPointInRegion,    /* Bool (* PointInRegion)() */
  341.     miRegionNotEmpty,    /* Bool (* RegionNotEmpty)() */
  342.     miRegionEmpty,        /* void (* RegionEmpty)() */
  343.     miRegionExtents,    /* BoxPtr (*RegionExtents)() */
  344.     miRegionAppend,        /* BoxPtr (*RegionAppend)() */
  345.     miRegionValidate,    /* BoxPtr (*RegionValidate)() */
  346.     mfbPixmapToRegion,    /* BoxPtr (*BitmapToRegion)() */
  347.     miRectsToRegion,    /* BoxPtr (*RectsToRegion)() */
  348.     miSendGraphicsExpose,    /* void    (*SendGraphicsExpose)() */
  349. /* os layer procedures */
  350.     OS_BlockHandler,    /* void (* BlockHandler)() */
  351.     OS_WakeupHandler,    /* void (* WakeupHandler)() */
  352.     (pointer) 0,        /* pointer blockData */
  353.     (pointer) 0,        /* pointer wakeupData */
  354.     0            /* DevUnion */
  355. } ;
  356.