home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xibm.zip / mpel / mpelData.c < prev    next >
C/C++ Source or Header  |  1992-02-11  |  15KB  |  405 lines

  1. /***********************************************************
  2.         Copyright IBM Corporation 1988
  3.  
  4.                       All Rights Reserved
  5.  
  6. Permission to use, copy, modify, and distribute this software and its 
  7. documentation for any purpose and without fee is hereby granted, 
  8. provided that the above copyright notice appear in all copies and that
  9. both that copyright notice and this permission notice appear in 
  10. supporting documentation, and that the name of IBM not be
  11. used in advertising or publicity pertaining to distribution of the
  12. software without specific, written prior permission.  
  13.  
  14. IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  15. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  16. IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  17. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  18. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  19. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  20. SOFTWARE.
  21.  
  22. ******************************************************************/
  23.  
  24. /* $Header: /afs/athena.mit.edu/astaff/project/x11r5/src/athena/ibm/mpel/RCS/mpelData.c,v 5.1 1992/02/12 00:28:06 jfc Exp $ */
  25. /* $Source: /afs/athena.mit.edu/astaff/project/x11r5/src/athena/ibm/mpel/RCS/mpelData.c,v $ */
  26.  
  27. #ifndef lint
  28. static char *rcsid = "$Id: mpelData.c,v 5.1 1992/02/12 00:28:06 jfc Exp $";
  29. #endif
  30.  
  31. #include "X.h"
  32. #include "Xproto.h"
  33. #include "miscstruct.h"
  34. #include "scrnintstr.h"
  35. #include "font.h"
  36. #include "pixmapstr.h"
  37. #include "window.h"
  38. #include "gcstruct.h"
  39. #include "colormapst.h"
  40. #include "cursorstr.h"
  41.  
  42. #include "mistruct.h"
  43. #include "mfb.h"
  44.  
  45. #include "OScursor.h"
  46. #include "ibmScreen.h"
  47.  
  48. #include "ppc.h"
  49. #include "ppcProcs.h"
  50.  
  51. #include "mpel.h"
  52.  
  53. #include "mpelProcs.h"
  54.  
  55. extern void miRecolorCursor() ;
  56. extern void NoopDDA() ;
  57. extern void ibmAbort();
  58.  
  59. static PixmapPtr BogusPixmap = (PixmapPtr) 1 ;
  60. extern ScreenRec mpelScreenRec ; /* Forward Declaration */
  61.  
  62. PixmapFormatRec    mpelFormats[]= { { 8, 8, 32 } } ;
  63.  
  64. VisualRec mpelVisuals[] = {
  65.     {
  66.     0,            /* unsigned long    vid */
  67.     PseudoColor,        /* short    class */
  68.     MPEL_BITS_PER_RGB,    /* short    bitsPerRGBValue */
  69.     1 << MPELMAXPLANES,    /* short    ColormapEntries */
  70.     MPELMAXPLANES,        /* short    nplanes */
  71.     0,            /* unsigned long    redMask */
  72.     0,            /* unsigned long    greenMask */
  73.     0,            /* unsigned long    blueMask */
  74.     0,            /* int        offsetRed */
  75.     0,            /* int        offsetGreen */
  76.     0            /* int        offsetBlue */
  77.     }
  78. } ;
  79.  
  80. static unsigned long int mpelDepthVID = 0 ;
  81.  
  82. DepthRec mpelDepths[] = {
  83. /*    depth        numVid    vids */
  84.     {    1,        0,    NULL    },
  85.     {    MPELMAXPLANES,    1,    &mpelDepthVID }
  86. } ;
  87.  
  88. #define mpelGCInterestValidateMask \
  89. ( GCLineStyle | GCLineWidth | GCJoinStyle | GCBackground | GCForeground    \
  90. | GCFunction | GCPlaneMask | GCFillStyle | GC_CALL_VALIDATE_BIT        \
  91. | GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode )
  92.  
  93. ppcPrivGC mpelPrototypeGCPriv = {
  94.     GXcopy,    /* unsigned char    rop */
  95.     0,    /* unsigned char    ropOpStip */
  96.     0,    /* unsigned char    ropFillArea */
  97.     TRUE,    /* short    fExpose */
  98.     FALSE,    /* short    freeCompClip */
  99.     NullPixmap,    /* PixmapPtr    pRotatedPixmap */
  100.     0,    /* RegionPtr    pCompositeClip */
  101.     ppcAreaFill,    /* void     (* FillArea)() */
  102.         {
  103.             MPEL_ALLPLANES,    /* unsigned long    planemask */
  104.             0,            /* unsigned long    fgPixel */
  105.             1,            /* unsigned long    bgPixel */
  106.             GXcopy,        /* int            alu */
  107.             FillSolid,        /* int            fillStyle */
  108.         }, /* ppcReducedRrop    colorRrop  */
  109.     -1,    /* short lastDrawableType */
  110.     -1,    /* short lastDrawableDepth */
  111.     ibmAbort, /* void (* cacheIGBlt)() */
  112.     ibmAbort, /* void (* cachePGBlt)() */
  113.     0    /* pointer devPriv */
  114. } ;
  115.  
  116. GCFuncs mpelGCFuncs = {
  117.     ppcValidateGC,                  /* void (*ValidateGC)() */
  118.     NoopDDA,                        /* void (*ChangeGC)() */
  119.     NoopDDA,                        /* void (*CopyGC)() */
  120.     ppcDestroyGC,                   /* void (*DestroyGC)() */
  121.     ppcChangeClip,                  /* void (*ChangeClip)() */
  122.     ppcDestroyClip,                 /* void (*DestroyClip)() */
  123.     ppcCopyClip                     /* void (*CopyClip)() */
  124.     };
  125.  
  126. GCOps mpelGCOps = {
  127.     ppcSolidWindowFS,    /*  void (* FillSpans)() */
  128.     ppcSetSpans,        /*  void (* SetSpans)()     */
  129.     miPutImage,        /*  void (* PutImage)()     */
  130.     ppcCopyArea,        /*  RegionPtr (* CopyArea)()     */
  131.     miCopyPlane,        /*  void (* CopyPlane)() */
  132.     mpelPolyPoint,        /*  void (* PolyPoint)() */
  133.     mpelZeroLine,        /*  void (* Polylines)() */
  134.     mpelPolySegment,    /*  void (* PolySegment)() */
  135.     miPolyRectangle,    /*  void (* PolyRectangle)() */
  136.     mpelPolyArc,        /*  void (* PolyArc)()     */
  137.     mpelFillPolygon,    /*  void (* FillPolygon)() */
  138.     miPolyFillRect,        /*  void (* PolyFillRect)() */
  139.     miPolyFillArc,        /*  void (* PolyFillArc)() */
  140.     mpelPolyText8,        /*  int (* PolyText8)()     */
  141.     mpelPolyText16,        /*  int (* PolyText16)() */
  142.     mpelImageText8,        /*  void (* ImageText8)() */
  143.     mpelImageText16,    /*  void (* ImageText16)() */
  144.     (void (*)()) ppcImageGlyphBlt,    /*  void (* ImageGlyphBlt)() */
  145.     (void (*)()) ppcPolyGlyphBlt,    /*  void (* PolyGlyphBlt)() */
  146.     ppcPushPixels,        /*  void (* PushPixels)() */
  147.     miMiter            /*  void (* LineHelper)() */
  148. };
  149.     
  150. #if defined(AIXrt) && !defined(__HIGHC__)
  151. GC mpelPrototypeGC;
  152. #else
  153. GC mpelPrototypeGC = {
  154.     &mpelScreenRec,    /*  ScreenPtr    pScreen     */
  155.     MPELMAXPLANES,    /*  int         depth     */
  156.     GXcopy,            /*  int        alu     */
  157.     0,            /*  int        lineWidth */
  158.     0,            /*  int        dashOffset */
  159.     0,            /*  int        numInDashList */
  160.     0,            /*  unsigned char *dash     */
  161.     LineSolid,        /*  int        lineStyle */
  162.     CapButt,        /*  int        capStyle */
  163.     JoinMiter,        /*  int        joinStyle */
  164.     FillSolid,        /*  int        fillStyle */
  165.     EvenOddRule,        /*  int        fillRule */
  166.     ArcPieSlice,        /*  int        arcMode     */
  167.     ClipByChildren,        /*  int        subWindowMode */
  168.     TRUE,            /*  Bool    graphicsExposures */
  169.     CT_NONE,        /*  int        clientClipType */
  170.     1,            /*  int        miTranslate:1 */
  171.     1,            /*  unsigned int tileIsPixel:1 */
  172.     0,            /*  unused:16 */
  173.     MPEL_ALLPLANES,    /*  unsigned long    planemask */
  174.     0,            /*  unsigned long    fgPixel */
  175.     1,            /*  unsigned long    bgPixel */
  176.     {0},            /*  PixmapPtr    tile     */
  177.     0,            /*  PixmapPtr    stipple     */
  178.     { 0, 0 },        /*  DDXPointRec    patOrg     */
  179.     0,            /*  FontPtr    font     */
  180.     { 0, 0 },        /*  DDXPointRec    clipOrg     */
  181.     { 0, 0 },        /*  DDXPointRec    lastWinOrg */
  182.     NULL,            /*  pointer    clientClip */
  183.     /* (1<<(GCLastBit+1))-1, */    /*  unsigned long    stateChanges */
  184.     0,            /*  unsigned long    stateChanges */
  185.     0,            /*  unsigned long        serialNumber */
  186.     &mpelGCFuncs,        /*  GCFuncs *funcs */
  187.     &mpelGCOps,        /*  GCOps *ops */
  188.     NULL            /*  devUnion    devPrivates     */
  189.  
  190. };
  191. #endif
  192.  
  193. ppcScrnPriv mpelScrnPriv = {
  194.     {
  195.         {
  196.             DRAWABLE_PIXMAP,/* unsigned char type */
  197.             0,        /* unsigned char class */
  198.             MPELMAXPLANES,    /* unsigned char depth */
  199.             1,        /* unsigned char bitsPerPixel */
  200.             0,        /* unsigned long id */
  201.             0,        /* short x */
  202.             0,        /* short y */
  203.             MPEL_WIDTH,    /* unsigned short width */
  204.             MPEL_HEIGHT,    /* unsigned short height */
  205.             0,        /* ScreenPtr    pScreen */
  206.             0        /* unsigned long        serialNumber */
  207.         },        /* DrawableRec drawable */
  208.         1,        /* int refcnt */
  209.         MPEL_WIDTH / 8,    /* int devKind */
  210.         
  211.         /* devPrivate initialized to zero by default
  212.           (no explicit initialization because AIX cc can't
  213.           initialize a union).  */
  214.  
  215.     },            /* PixmapRec    pixmap */
  216.     0,            /* void    (* devHardwareInitBB)() */
  217.     0,            /* void    (* devHardwareInitAB)() */
  218.     &mpelPrototypeGC,    /* GCPtr    devPrototypeGC */
  219.     &mpelPrototypeGCPriv,    /* ppcPrivGC     *devPrototypeGCPriv */
  220.     mpelChangeGCtype,    /* Mask        (* changeGCtype)() */
  221.     mpelChangeWindowGC,    /* Mask        (* changeWindowGC)() */
  222.     0,            /* Colormap    InstalledColormap */
  223.     mpelBitBlt,        /* void    (* blit)() */
  224.     mpelFillSolid,        /* void    (* solidFill)() */
  225.     mpelTile,        /* void    (* tileFill)() */
  226.     ppcStipple,        /* void    (* stipFill)() */
  227.     ppcOpaqueStipple,    /* void    (* opstipFill)() */
  228.     mpelDrawColorImage,    /* void    (* imageFill)() */
  229.     mpelReadColorImage,    /* void    (* imageRead)() */
  230.     mpelBresLine,        /* void    (* lineBres)() */
  231.     mpelHorzLine,        /* void    (* lineHorz)() */
  232.     mpelVertLine,        /* void    (* lineVert)() */
  233.     (void (*)())mpelSetColor,        /* void    (* setColor)() */
  234.     mpel_ppcRecolorCursor,    /* void    (* RecolorCursor)() */
  235.     mpelDrawMonoImage,    /* void    (* monoFill)() */
  236.     mpelDrawMonoByteImage,    /* void    (* glyphFill)() */
  237.     mpelGetPlane,        /* unsigned long *((* planeRead)()) */
  238.     ppcReplicateArea,    /* void    (* replicateArea)() */
  239.     mpelDestroyGCPriv,    /* void    (* DestroyGCPriv)() */
  240. /* High Level Software Cursor Support !! */
  241.     &mpelcursorSemaphore,    /* int    * CursorSemaphore */
  242.     mpelCheckCursor,    /* int    (* CheckCursor)() */
  243.     mpelReplaceCursor,    /* void    (* ReplaceCursor)() */
  244.     0            /* ppcCacheInfoPtr cacheInfo */
  245. } ;
  246.  
  247. ScreenRec mpelScreenRec = {
  248.     0,            /* int            myNum */
  249.     0,            /* ATOM id */
  250.     MPEL_WIDTH,        /* short        width */
  251.     MPEL_HEIGHT,        /* short        height */
  252.     (MPEL_WIDTH * 254)/880,    /* short        mmWidth */
  253.     (MPEL_HEIGHT*254)/880,    /* short        mmHeight */
  254.     sizeof mpelDepths/sizeof (DepthRec),    /* short    numDepths */
  255.     MPELMAXPLANES,        /* short        rootDepth */
  256.     mpelDepths,        /* DepthPtr           allowedDepths */
  257.     0,            /* unsigned long          rootVisual */
  258.     0,            /* unsigned long    defColormap */
  259.     0,            /* short        minInstalledCmaps */
  260.     1,            /* short        maxInstalledCmaps */
  261.     Always,            /* char                backingStoreSupport */
  262.     NotUseful,        /* char                saveUnderSupport */
  263.     MPEL_WHITE_PIXEL,    /* unsigned long    whitePixel */
  264.     MPEL_BLACK_PIXEL,    /* unsigned long    blackPixel */
  265.     0,            /* unsigned long    rgf */
  266.     { 0 },            /* GCPtr    GCperDepth[MAXFORMATS+1] */
  267.     { 0 },            /* PixmapPtr        PixmapPerDepth[1] */
  268.     (pointer) &mpelScrnPriv,    /* pointer        devPrivate */
  269.     sizeof mpelVisuals/sizeof (VisualRec), /* short         numVisuals */
  270.     &mpelVisuals[0],        /* VisualPtr        visuals */
  271.         0,                              /* int          WindowPrivateLen; */
  272.         0,                              /* unsigned     WindowPrivateSizes; */
  273.         0,                              /* unsigned     totalWindowSize; */
  274.         0,                              /* int          GCPrivateLen; */
  275.         0,                              /* unsigned     GCPrivateSizes; */
  276.         0,                              /* unsigned     totalGCSize; */
  277. /* Random screen procedures */
  278.     mpelScreenClose,        /* Bool (* CloseScreen)() */
  279.     ppcQueryBestSize,    /* void (* QueryBestSize)() */
  280.     ibmSaveScreen,        /* Bool (* SaveScreen)() */
  281.     ppcGetImage,        /* void (* GetImage)() */
  282.     (void (*)()) ppcGetSpans, /* void (*GetSpans)() */
  283.     ibmAbort,        /* void (* PointerNonInterestBox)() */
  284.     (void (*)()) NULL,    /* void (* SourceValidate)() */
  285. /* Window Procedures */
  286.     ppcCreateWindow,    /* Bool (* CreateWindow)() */
  287.     ppcDestroyWindow,    /* Bool (* DestroyWindow)() */
  288.     ppcPositionWindow,    /* Bool (* PositionWindow)() */
  289.     mfbChangeWindowAttributes,    /* Bool (* ChangeWindowAttributes)() */
  290.     mfbMapWindow,        /* Bool (* RealizeWindow)() */
  291.     mfbUnmapWindow,        /* Bool (* UnrealizeWindow)() */
  292.     miValidateTree,        /* int  (* ValidateTree)() */
  293.     NULL,            /* PostValidateTree */
  294.     miWindowExposures,    /* void (* WindowExposures)() */
  295.         ppcPaintWindow,         /* void PaintWindowBackground */
  296.         ppcPaintWindow,         /* void PaintWindowBorder */
  297.         ppcCopyWindow,          /* void CopyWindow */
  298.         miClearToBackground,    /* void ClearToBackground */
  299.     NULL,
  300. /* Pixmap procedures */
  301.     ppcCreatePixmap,    /* PixmapPtr (* CreatePixmap)() */
  302.     mfbDestroyPixmap,    /* Bool (* DestroyPixmap)() */
  303. /* Backing store Procedures */
  304.         NoopDDA,        /* void SaveDoomedAreas */
  305.         (RegionPtr (*)())ppcRestoreAreas,      /* RegionPtr RestoreAreas */
  306.         NoopDDA,        /* void ExposeCopy */
  307.         (RegionPtr (*)())NoopDDA,        /* void TranslateBackingStore */
  308.         (RegionPtr (*)())NoopDDA,        /* void ClearBackingStore */
  309.         NoopDDA,        /* void DrawGuarantee */
  310. /* Font procedures */
  311.     mpelRealizeFont,    /* Bool (* RealizeFont)() */
  312.     mpelUnrealizeFont,    /* Bool (* UnrealizeFont)() */
  313. /* Cursor Procedures */
  314.     OS_ConstrainCursor,    /* void (* ConstrainCursor)() */
  315.     OS_CursorLimits,    /* void (* CursorLimits)() */
  316.     mpelDisplayCursor,    /* Bool (* DisplayCursor)() */
  317.     mpelRealizeCursor,    /* Bool (* RealizeCursor)() */
  318.     mpelUnrealizeCursor,    /* Bool (* UnrealizeCursor)() */
  319.     mpelRecolorCursor,    /* void (* RecolorCursor)() */
  320.     OS_SetCursorPosition,    /* Bool (* SetCursorPosition)() */
  321. /* GC procedures */
  322.     ppcCreateGC,        /* Bool (* CreateGC)() */
  323. /* Colormap procedures */
  324.     ppcCreateColormapNoop,    /* Bool (* CreateColormap)() */
  325.     NoopDDA,        /* void (* DestroyColormap)() */
  326.     mpelInstallColormap,    /* void (* InstallColormap)() */
  327.     ppcUninstallColormap,    /* void (* UninstallColormap)() */
  328.     ppcListInstalledColormaps,    /* int (* ListInstalledColormaps) () */
  329.     ppcStoreColors,        /* void (* StoreColors)() */
  330.     ppcResolveColor,    /* void (* ResolveColor)() */
  331. /* Region procedures */
  332.     miRegionCreate,        /* RegionPtr (* RegionCreate)() */
  333.     miRegionInit,        /* void (* RegionInit)() */
  334.     miRegionCopy,        /* void (* RegionCopy)() */
  335.     miRegionDestroy,    /* void (* RegionDestroy)() */
  336.     miRegionUninit,        /* void (* RegionUninit)() */
  337.     miIntersect,        /* int (* Intersect)() */
  338.     miUnion,        /* int (* Union)() */
  339.     miSubtract,        /* int (* Subtract)() */
  340.     miInverse,        /* int (* Inverse)() */
  341.     miRegionReset,        /* void (* RegionReset)() */
  342.     miTranslateRegion,    /* void (* TranslateRegion)() */
  343.     miRectIn,        /* int (* RectIn)() */
  344.     miPointInRegion,    /* Bool (* PointInRegion)() */
  345.     miRegionNotEmpty,    /* Bool (* RegionNotEmpty)() */
  346.     miRegionEmpty,        /* void (* RegionEmpty)() */
  347.     miRegionExtents,    /* BoxPtr (*RegionExtents)() */
  348.         miRegionAppend,         /* BoxPtr (*RegionAppend)() */
  349.         miRegionValidate,       /* BoxPtr (*RegionValidate)() */
  350.         mfbPixmapToRegion,      /* BoxPtr (*BitmapToRegion)() */
  351.         miRectsToRegion,        /* BoxPtr (*RectsToRegion)() */
  352.     miSendGraphicsExpose,    /* void    (*SendGraphicsExpose)() */
  353. /* os layer procedures */
  354.     NoopDDA,        /* void (* BlockHandler)() */
  355.     NoopDDA,        /* void (* WakeupHandler)() */
  356.     (pointer) 0,        /* pointer blockData */
  357.     (pointer) 0,        /* pointer wakeupData */
  358.     0            /* DevUnion devPrivate */
  359. } ;
  360.  
  361. #if defined(AIXrt) && !defined(__HIGHC__)
  362. void
  363. mpelDataInit()
  364. {
  365.     mpelPrototypeGC.pScreen = &mpelScreenRec;
  366.     mpelPrototypeGC.depth = MPELMAXPLANES;
  367.     mpelPrototypeGC.alu       = GXcopy;
  368.     mpelPrototypeGC.lineWidth = 0;
  369.     mpelPrototypeGC.dashOffset = 0;
  370.     mpelPrototypeGC.numInDashList = 0;
  371.     mpelPrototypeGC.dash = 0;
  372.     mpelPrototypeGC.lineStyle = LineSolid;
  373.     mpelPrototypeGC.capStyle = CapButt;
  374.     mpelPrototypeGC.joinStyle = JoinMiter;
  375.     mpelPrototypeGC.fillStyle = FillSolid;
  376.     mpelPrototypeGC.fillRule = EvenOddRule;
  377.     mpelPrototypeGC.arcMode = ArcPieSlice;
  378.     mpelPrototypeGC.subWindowMode = ClipByChildren;
  379.     mpelPrototypeGC.graphicsExposures = TRUE;
  380.     mpelPrototypeGC.clientClipType = CT_NONE;
  381.     mpelPrototypeGC.miTranslate = 1;
  382.     mpelPrototypeGC.tileIsPixel = 1;
  383.     mpelPrototypeGC.unused = 0;
  384.     mpelPrototypeGC.planemask = MPEL_ALLPLANES;
  385.     mpelPrototypeGC.fgPixel = 0;
  386.     mpelPrototypeGC.bgPixel = 1;
  387.     mpelPrototypeGC.tile.pixmap = 0;
  388.     mpelPrototypeGC.stipple = 0;
  389.     mpelPrototypeGC.patOrg.x = 0;
  390.     mpelPrototypeGC.patOrg.y = 0;
  391.     mpelPrototypeGC.font = 0;
  392.     mpelPrototypeGC.clipOrg.x = 0;
  393.     mpelPrototypeGC.clipOrg.y = 0;
  394.     mpelPrototypeGC.lastWinOrg.x = 0;
  395.     mpelPrototypeGC.lastWinOrg.y = 0;
  396.     mpelPrototypeGC.clientClip = NULL;
  397.     mpelPrototypeGC.stateChanges = 0;
  398.     mpelPrototypeGC.serialNumber = 0;
  399.     mpelPrototypeGC.funcs = &mpelGCFuncs;
  400.     mpelPrototypeGC.ops = &mpelGCOps;
  401.     mpelPrototypeGC.devPrivates = NULL;
  402. }
  403. #endif
  404.  
  405.