Article View: comp.sys.ibm.pc.rt
Article #1994IBM 8514 source code (part 2 of 6) for X11 Release 4
From: Mark S. Lewis
Date: Mon, 12 Mar 1990 23:16
Date: Mon, 12 Mar 1990 23:16
2319 lines
64472 bytes
64472 bytes
Subject: IBM 8514 source code (part 2 of 6) for X11 Release 4
Index: ../mit/server/ddx/ibm/ibm8514
Description:
IBM has decided to provide X11 source code for the 8514 display
adapter. This is the same code used to build the object files
included in the X11 Release 4 distribution. This code supports
servers for both AIX and IBM/4.3 on their respective platforms.
V1.32_kit.1 59,103 Bytes
V1.32_kit.2 61,796 Bytes
V1.32_kit.3 60,982 Bytes
V1.32_kit.4 62,729 Bytes
V1.32_kit.5 54,871 Bytes
V1.32_kit.6 29,170 Bytes
Installation:
This code is provided in a 6-part shell archive. Before you
install it, you should save your current code. You should save
the Imakefile in the ibm server directory. You also should save
the entire ibm8514 directory by moving and remaking it.
cd ../mit/server/ddx/ibm
cp Imakefile Imakefile.orig
mv ibm8514 ibm8514.orig
mkdir ibm8514
Next, edit this header from each part, and feed the rest to
/bin/sh. Proceed to make the server as instructed in the
X11 release notes.
sh < V1.32_kit.2
=====----- Mark S. Lewis, IBM AWD Palo Alto -----======
inet: mlewis%ibmsupt@uunet.uu.net (415) 855-4486
uucp: uunet!ibmsupt!mlewis IBM Tie Line: 465-4486
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
#
# ibm8514/brcCurs.c
# ibm8514/brcDLine.c
# ibm8514/brcDash.c
# ibm8514/brcData.c
#
echo x - ibm8514/brcCurs.c
sed 's/^X//' >ibm8514/brcCurs.c << 'END-of-ibm8514/brcCurs.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X * Hardware interface routines for IBM 8514/A adapter for
X * X.11 server(s) on IBM equipment.
X *
X */
X/* $Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcCurs.c,v 6.8
89/07/27 17:48:58 jeff Exp $ */
X/* $Source:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcCurs.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcCurs.c,v 6.8
89/07/27 17:48:58 jeff Exp $" ;
X#endif
X
X/*
X * Software Cursor implementation for 8514/A
X *
X * Depends on owning some off-screen memory in SAVELOC, etc #defined areas
X */
X
X#include "X.h"
X#include "Xmd.h"
X#include "miscstruct.h"
X#include "scrnintstr.h"
X#include "cursorstr.h"
X#include "pixmapstr.h"
X#include "colormapst.h"
X
X#include "ibmScreen.h"
X#include "ibmColor.h"
X
X#include "ppc.h"
X
X#include "x8514.h"
X
X#include "OScompiler.h"
X#include "ibmTrace.h"
X#include "../../mfb/maskbits.h"
X
Xvoid ibm8514ReplaceCursor();
X
Xextern ibmPerScreenInfo ibm8514ScreenInfoStruct ; /* From brcScrInfo.c */
X
X#define CURBLIT( COL, X0, Y0, X1, Y1, LX, LY ) \
X { \
X ibm8514CheckQueue( 8 ) ; \
X SETCOL1( COL ) ; \
X SETX0( X0 ) ; \
X SETY0( Y0 ) ; \
X SETX1( X1 ) ; \
X SETY1( Y1 ) ; \
X SETLX( LX - 1 ) ; \
X SETLY( LY - 1 ) ; \
X COMMAND( 0xC0F3 ) ; \
X }
X
X/* Global Cursor State Semaphore */
Xint ibm8514cursorSemaphore = 0 ;
X
Xstatic short int c_x = 0 ;
Xstatic short int c_y = 0 ;
Xstatic unsigned long int c_fg = 255 ;
Xstatic unsigned long int c_bg = 0 ;
Xstatic int active = FALSE ;
Xstatic int cursor_not_displayed = FALSE ;
Xstatic int curs_fore_r, curs_fore_g, curs_fore_b,
X curs_back_r, curs_back_g, curs_back_b ;
Xstatic int current_w = 32 ;
Xstatic int current_h = 32 ;
X
Xstatic void
Xibm8514CBitblt( x0, y0, x1, y1 )
Xregister int x0, y0, x1, y1 ;
X{
X/* TRACE( ( "ibm8514CBitblt:x0=%d,y0=%d,x1=%d,y1=%d\n",
X x0, y0, x1, y1 ) ) ; */
X
X ibm8514ATRNotBusy ;
X ibm8514CheckQueue( 4 ) ;
X SETFN1( FNCPYRCT, FNREPLACE ) ;
X SETX0( x0 ) ;
X SETY0( y0 ) ;
X SETX1( x1 ) ;
X
X ibm8514CheckQueue( 4 ) ;
X SETY1( y1 ) ;
X SETLX( current_w - 1 ) ;
X SETLY( current_h - 1 ) ;
X COMMAND( 0xC0F3 ) ;
X
X ibm8514CheckQueue( 1 ) ;
X SETFN1( FNCOLOR1, FNREPLACE ) ;
X
X return ;
X}
X
Xvoid
Xibm8514RemoveCursor()
X{
X/* TRACE(("ibm8514RemoveCursor()\n")) ; */
X active = FALSE ;
X ibm8514CBitblt( SAVELOCX, SAVELOCY,
X c_x - ibm8514ScreenInfoStruct.ibm_CursorHotX,
X c_y - ibm8514ScreenInfoStruct.ibm_CursorHotY ) ;
X return ;
X}
X
Xstatic void
Xibm8514Overlay( x, y )
Xregister short x, y ;
X{
X/* TRACE(("ibm8514Overlay(%d,%d)\n",x,y)) ; */
X
X ibm8514ATRNotBusy ;
X ibm8514CheckQueue( 5 ) ;
X SETFN0( FNCOLOR0, FNNOP ) ;
X SETFN1( FNCOLOR1, FNREPLACE ) ;
X PLNRENBL( RPLANE0 ) ;
X SETMODE( M_CPYRCT ) ;
X SETYMAX( _8514_SCREENHEIGHT - 1 ) ;
X
X ibm8514ATRNotBusy ;
X CURBLIT( c_fg, CUR1LOCX, CUR1LOCY, x, y, current_w, current_h ) ;
X ibm8514ATRNotBusy ;
X CURBLIT( c_bg, CUR0LOCX, CUR0LOCY, x, y, current_w, current_h ) ;
X
X ibm8514CheckQueue( 4 ) ;
X SETYMAX( 1023 ) ;
X PLNRENBL( RPLANES ) ;
X SETFN0( FNCOLOR0, FNREPLACE ) ;
X SETMODE( M_ONES ) ;
X
X return ;
X}
X
X/***============================================================***/
X
Xvoid
Xibm8514CursorInit( index )
Xregister int index ;
X{
X TRACE( ( "ibm8514CursorInit(%d)\n", index ) ) ;
X
X c_x = 0 ;
X c_y = 0 ;
X active = FALSE ;
X ibm8514cursorSemaphore = 0 ;
X cursor_not_displayed = FALSE ;
X return ;
X}
X
X/***============================================================***/
X
XBool
Xibm8514RealizeCursor( pScr, pCurs )
X ScreenPtr pScr ;
X CursorPtr pCurs ;
X{
X register unsigned long int tmpMask ;
X register unsigned long int endbits ;
X unsigned long int *pFG, *pBG ;
X unsigned long int *psrcImage, *psrcMask ;
X int srcWidth ;
X int srcHeight ;
X int srcRealWidth ;
X
X TRACE( ( "ibm8514RealizeCursor(pScr=0x%x,pCurs=0x%x)\n", pScr, pCurs ) ) ;
X if ( !( ( pCurs->devPriv[ pScr->myNum ] = (pointer) Xalloc( 256 ) ) ) ) {
X ErrorF( "ibm8514RealizeCursor: can't malloc\n" ) ;
X return FALSE ;
X }
X pFG = (unsigned long int *) pCurs->devPriv[pScr->myNum] ;
X pBG = pFG + 32 ; /* words */
X bzero( (char *) pFG, 256 ) ;
X psrcImage = (unsigned long int *) pCurs->bits->source ;
X psrcMask = (unsigned long int *) pCurs->bits->mask ;
X srcRealWidth = ( pCurs->bits->width + 31 ) / 32 ;
X
X srcWidth = MIN( pCurs->bits->width, 32 ) ;
X srcHeight = MIN( pCurs->bits->height, 32 ) ;
X
X endbits = ( srcWidth == 32 ) ? 0xFFFFFFFF : SCRLEFT( -1, (32-srcWidth) );
X
X while ( srcHeight-- ) {
X tmpMask = *psrcMask &= endbits ;
X *pFG++ = (*psrcImage) & tmpMask ;
X *pBG++ = (~(*psrcImage)) & tmpMask ;
X psrcImage += srcRealWidth ;
X psrcMask += srcRealWidth ;
X }
X
X return TRUE ;
X}
X
X/***============================================================***/
X
XBool
Xibm8514UnrealizeCursor( pScr, pCurs )
X register ScreenPtr pScr ;
X register CursorPtr pCurs ;
X{
X TRACE( ( "ibm8514UnrealizeCursor(pScr=0x%x,pCurs=0x%x)\n",
X pScr, pCurs ) ) ;
X
X Xfree( pCurs->devPriv[ pScr->myNum ] ) ;
X pCurs->devPriv[ pScr->myNum ] = 0 ;
X return TRUE ;
X}
X
Xvoid
Xibm8514ColorCursor( fg, bg )
Xregister unsigned long int fg, bg ;
X{
XTRACE( ( "ibm8514ColorCursor(%d,%d)\n", fg, bg ) ) ;
Xif ( ( fg > 255 ) || ( bg > 255 ) ) {
X ErrorF( "ibm8514ColorCursor: bad color value(s)(fg/bg)=(%d,%d)",
X fg, bg ) ;
X return ;
X}
Xc_fg = fg ;
Xc_bg = bg ;
X
Xreturn ;
X}
X
Xvoid
Xibm8514RecolorCursor( cmap )
Xregister ColormapPtr cmap ;
X{
Xc_fg = ibmFindColor( cmap, curs_fore_r, curs_fore_g, curs_fore_b ) ;
Xc_bg = ibmFindColor( cmap, curs_back_r, curs_back_g, curs_back_b ) ;
Xif ( active && ( !cursor_not_displayed ) )
X {
X ibm8514RemoveCursor();
X cursor_not_displayed = TRUE;
X ibm8514ReplaceCursor();
X }
Xreturn ;
X}
X
X/***============================================================***/
X
Xvoid
Xibm8514ShowCursor( x, y )
Xint x, y ;
X{
Xregister int xloc, yloc ;
X
X/* TRACE(("ibm8514ShowCursor(x=%d, y=%d)\n",x, y)) ; */
X if ( active )
X ibm8514RemoveCursor() ;
X
X xloc = ( c_x = x ) - ibm8514ScreenInfoStruct.ibm_CursorHotX ;
X yloc = ( c_y = y ) - ibm8514ScreenInfoStruct.ibm_CursorHotY ;
X ibm8514CBitblt( xloc, yloc, SAVELOCX, SAVELOCY ) ;
X ibm8514Overlay( xloc, yloc ) ;
X active = TRUE ;
X return ;
X}
X
Xint
Xibm8514DisplayCursor( pScr, pCurs )
X register ScreenPtr pScr ;
X register CursorPtr pCurs ;
X{
X int *curdef ;
X
X TRACE( ( "ibm8514DisplayCursor(pScr=0x%x,pCurs=0x%x)\n", pScr, pCurs ) ) ;
X
X if ( active )
X ibm8514RemoveCursor() ;
X curdef = (int *) pCurs->devPriv[ pScr->myNum] ;
X
X ibm8514ScreenInfoStruct.ibm_CursorHotX = pCurs->bits->xhot ;
X ibm8514ScreenInfoStruct.ibm_CursorHotY = pCurs->bits->yhot ;
X ibm8514ScreenInfoStruct.ibm_CurrentCursor = pCurs ;
X
X curs_fore_r = pCurs->foreRed ;
X curs_fore_g = pCurs->foreGreen ;
X curs_fore_b = pCurs->foreBlue ;
X curs_back_r = pCurs->backRed ;
X curs_back_g = pCurs->backGreen ;
X curs_back_b = pCurs->backBlue ;
X
X ibm8514RecolorCursor(
X ( (ppcScrnPrivPtr) pScr->devPrivate )->InstalledColormap ) ;
X
X ibm8514AlignMonoImage( ibm8514ALLPLANES, GXcopy, C1X, C1Y,
X CURD_X, CURD_Y, curdef ) ;
X ibm8514AlignMonoImage( ibm8514ALLPLANES, GXcopy, C0X, C0Y,
X CURD_X, CURD_Y, curdef + 32 ) ;
X
X current_w = MIN( pCurs->bits->width, CURD_X ) ;
X current_h = MIN( pCurs->bits->height, CURD_Y ) ;
X
X ibm8514ShowCursor( c_x, c_y ) ;
X return TRUE ;
X}
X
Xint
Xibm8514CheckCursor( x, y, lx, ly )
Xregister const int x, y, lx, ly ;
X{
X/* check if the cursor is in this rectangle. if so, remove and return TRUE
X else return FALSE */
X
Xif ( !ibm8514cursorSemaphore && active
X && ( cursor_not_displayed == FALSE )
X && !( ( x > ( c_x + current_w ) )
X || ( y > ( c_y + current_h ) )
X || ( ( x + lx ) < ( c_x - current_w ) )
X || ( ( y + ly ) < ( c_y - current_h ) ) ) ) {
X ibm8514RemoveCursor() ;
X return cursor_not_displayed = TRUE ;
X}
Xelse
X return FALSE ;
X/*NOTREACHED*/
X}
X
Xvoid
Xibm8514ReplaceCursor()
X{
Xif ( cursor_not_displayed && !ibm8514cursorSemaphore ) {
X ibm8514ShowCursor( c_x, c_y ) ;
X cursor_not_displayed = FALSE ;
X return ;
X}
X
Xreturn ;
X}
END-of-ibm8514/brcCurs.c
echo x - ibm8514/brcDLine.c
sed 's/^X//' >ibm8514/brcDLine.c << 'END-of-ibm8514/brcDLine.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X * Hardware interface routines for IBM 8514/A adapter for
X * X.11 server(s) on IBM equipment.
X *
X */
X
X/***********************************************************
XCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
Xand the Massachusetts Institute of Technology, Cambridge, Massachusetts.
X
X All Rights Reserved
X
XPermission to use, copy, modify, and distribute this software and its
Xdocumentation for any purpose and without fee is hereby granted,
Xprovided that the above copyright notice appear in all copies and that
Xboth that copyright notice and this permission notice appear in
Xsupporting documentation, and that the names of Digital or MIT not be
Xused in advertising or publicity pertaining to distribution of the
Xsoftware without specific, written prior permission.
X
XDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
XDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
XSOFTWARE.
X
X******************************************************************/
X
X/* $Header:
/andrew/X11/r3src/earlyRelease/server/ddx/ibm/ibm8514/RCS/brcDLine.c,v
6.2 88/11/16 18:44:54 paquin Exp $ */
X/* $Source:
/andrew/X11/r3src/earlyRelease/server/ddx/ibm/ibm8514/RCS/brcDLine.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/earlyRelease/server/ddx/ibm/ibm8514/RCS/brcDLine.c,v
6.2 88/11/16 18:44:54 paquin Exp $";
X#endif
X
X
X#include "X.h"
X
X#include "misc.h"
X#include "gcstruct.h"
X#include "gc.h"
X#include "pixmap.h"
X#include "window.h"
X#include "windowstr.h"
X#include "pixmapstr.h"
X#include "regionstr.h"
X#include "scrnintstr.h"
X#include "mistruct.h"
X
X#include "mfb.h"
X#include "ppc.h"
X#include "ppcUtils.h"
X
X#include "x8514.h"
X
X/* ibm8514 dashed line
X *
X */
X
Xextern void ibm8514BresDash();
Xextern void ibm8514HorzDash();
Xextern void ibm8514VertDash();
Xextern void ibm8514BresLineStart();
Xextern void ibm8514BresLineCont();
Xextern void ibm8514BresLineStop();
X
Xextern void ibm8514HorzDashPat();
Xextern void ibm8514BresDashPat();
X
X#define X_AXIS 0
X
Xextern int mergexlate[];
Xextern int ibm8514cursorSemaphore ;
X
X/* NOTE
X maybe OUTCODES should take box (the one that includes all
Xedges) instead of pbox (the standard no-right-or-lower-edge one)?
X*/
X#define OUTCODES(result, x, y, pbox) \
X if (x < pbox->x1) \
X result |= OUT_LEFT; \
X else if (x >= pbox->x2) \
X result |= OUT_RIGHT; \
X if (y < pbox->y1) \
X result |= OUT_ABOVE; \
X else if (y >= pbox->y2) \
X result |= OUT_BELOW;
X
Xvoid
Xibm8514ZeroDash(pDrawable, pGC, mode, npt, pptInit)
X DrawablePtr pDrawable;
X GCPtr pGC;
X int mode; /* Origin or Previous */
X int npt; /* number of points */
X DDXPointPtr pptInit;
X{
X int nboxInit;
X register int nbox;
X BoxPtr pboxInit;
X register BoxPtr pbox;
X int nptTmp;
X DDXPointPtr ppt; /* pointer to list of translated points */
X
X DDXPointRec pt1;
X DDXPointRec pt2;
X
X unsigned int oc1; /* outcode of point 1 */
X unsigned int oc2; /* outcode of point 2 */
X
X int xorg, yorg; /* origin of window */
X
X int adx; /* abs values of dx and dy */
X int ady;
X int signdx; /* sign of dx and dy */
X int signdy;
X int e, e1, e2; /* bresenham error and increments */
X int len; /* length of segment */
X
X int clipDone; /* flag for clipping loop */
X DDXPointRec pt1Orig; /* unclipped start point */
X DDXPointRec pt2Orig; /* unclipped end point */
X int err; /* modified bresenham error term */
X int clip1, clip2; /* clippedness of the endpoints */
X
X int alu ; /* Screen Raster-Op value */
X long fg ; /* foreground Pixel value */
X long bg ; /* background Pixel value */
X unsigned long pm ; /* plane mask */
X register int tmp;
X int x1, x2, y1, y2;
X /* a bunch of temporaries */
X void (* scrnFunc)();
X#ifdef notyet
X int hardware_pat =
X ((ibm8514GCPrivPtr)(pGC->devPriv))->flags & HARDWARE_PAT;
X#endif
X
X if ( pDrawable->type != DRAWABLE_WINDOW )
X {
X ErrorF("ibm8514ZeroDash: not a window\n");
X return;
X }
X
X switch ( ( (ppcPrivGC *) pGC->devPriv )->colorRrop.fillStyle ) {
X case FillSolid : /* Can Use Optimized Color Raster-Op */
X alu = ( (ppcPrivGC *) pGC->devPriv )->colorRrop.alu ;
X pm = ( (ppcPrivGC *) pGC->devPriv )->colorRrop.planemask ;
X if(pGC->lineStyle == LineOnOffDash){
X ibm8514ClearQueue(1);
X SETCOL1( ( (ppcPrivGC *) pGC->devPriv )->colorRrop.fgPixel) ;
X } else {
X fg = ( (ppcPrivGC *) pGC->devPriv )->colorRrop.fgPixel ;
X bg = ( (ppcPrivGC *) pGC->devPriv )->colorRrop.bgPixel ;
X }
X break ;
X case FillTiled : /* Can't Use Optimized Color Raster-Op */
X alu = pGC->alu ;
X pm = pGC->planemask ;
X if(pGC->lineStyle == LineOnOffDash){
X ibm8514ClearQueue(1);
X SETCOL1(pGC->fgPixel);
X } else {
X fg = pGC->fgPixel ;
X bg = pGC->bgPixel ;
X }
X break ;
X }
X if ( alu == GXnoop )
X return ;
X
X pboxInit = ((mfbPrivGC *)(pGC->devPriv))->pCompositeClip->rects;
X nboxInit = ((mfbPrivGC *)(pGC->devPriv))->pCompositeClip->numRects;
X
X xorg = ((WindowPtr)pDrawable)->absCorner.x;
X yorg = ((WindowPtr)pDrawable)->absCorner.y;
X
X /* translate the point list */
X ppt = pptInit;
X nptTmp = npt;
X if (mode == CoordModeOrigin)
X {
X while(nptTmp--)
X {
X ppt->x += xorg;
X ppt++->y += yorg;
X }
X }
X else
X {
X ppt->x += xorg;
X ppt->y += yorg;
X nptTmp--;
X while ( nptTmp-- )
X {
X ppt++;
X ppt->x += (ppt-1)->x;
X ppt->y += (ppt-1)->y;
X }
X }
X
X ppt = pptInit;
X while ( --npt )
X {
X nbox = nboxInit;
X pbox = pboxInit;
X
X pt1 = *ppt++;
X pt2 = *ppt;
X
X if ( !( adx = ( pt2.x - pt1.x ) ) )
X {
X /* make the line go top to bottom of screen, keeping
X endpoint semantics
X */
X if ( pt1.y > pt2.y )
X {
X tmp = pt2.y;
X pt2.y = pt1.y + 1;
X pt1.y = tmp + 1;
X }
X
X /* get to first band that might contain part of line */
X while ((nbox) && (pbox->y2 <= pt1.y))
X {
X pbox++;
X nbox--;
X }
X
X if ( nbox )
X {
X /* stop when lower edge of box is beyond end of line */
X while ( ( nbox ) && ( pt2.y >= pbox->y1 ) ) {
X if ( ( pt1.x >= pbox->x1 ) && ( pt1.x < pbox->x2 ) ) {
X /* this box has part of the line in it */
X if ( ( y1 = MAX( pt1.y, pbox->y1 ) )
X != ( y2 = MIN( pt2.y, pbox->y2 ) ) ) {
X ibm8514VertDash( pGC, fg, bg,
X alu, pm, pt1.x, y1, y2 - y1 ) ;
X }
X }
X nbox--;
X pbox++;
X }
X }
X
X }
X else if ( !( ady = ( pt2.y - pt1.y ) ) )
X {
X /* force line from left to right, keeping
X endpoint semantics
X */
X if (pt1.x > pt2.x)
X {
X tmp = pt2.x;
X pt2.x = pt1.x + 1;
X pt1.x = tmp + 1;
X }
X
X /* find the correct band */
X while( nbox && (pbox->y2 <= pt1.y))
X {
X pbox++;
X nbox--;
X }
X
X /* try to draw the line, if we haven't gone beyond it */
X if ((nbox) && (pbox->y1 <= pt1.y))
X {
X /* when we leave this band, we're done */
X tmp = pbox->y1;
X while((nbox) && (pbox->y1 == tmp))
X {
X if (pbox->x2 <= pt1.x)
X {
X /* skip boxes until one might contain start point */
X nbox--;
X pbox++;
X continue;
X }
X
X /* stop if left of box is beyond right of line */
X if (pbox->x1 >= pt2.x)
X {
X nbox = 0;
X continue;
X }
X if ( ( x1 = MAX( pt1.x, pbox->x1 ) )
X != ( x2 = MIN( pt2.x, pbox->x2 ) ) ) {
X#ifdef notyet
X if(hardware_pat)
X ibm8514HorzDashPat( pGC, fg, bg,
X alu, pm, x1, pt1.y, x2 - x1 ) ;
X else
X#endif
X ibm8514HorzDash( pGC, fg, bg,
X alu, pm, x1, pt1.y, x2 - x1 ) ;
X }
X nbox--;
X pbox++;
X }
X }
X }
X else /* sloped line */
X {
X signdx = sign(adx);
X signdy = sign(ady);
X adx = ABS(adx);
X ady = ABS(ady);
X
X if (adx > ady)
X {
X e1 = ady*2;
X e2 = e1 - 2*adx;
X e = e1 - adx;
X
X }
X else
X {
X e1 = adx*2;
X e2 = e1 - 2*ady;
X e = e1 - ady;
X }
X
X /* we have bresenham parameters and two points.
X all we have to do now is clip and draw.
X */
X
X pt1Orig = pt1;
X pt2Orig = pt2;
X
X while(nbox--)
X {
X
X BoxRec box;
X
X pt1 = pt1Orig;
X pt2 = pt2Orig;
X clipDone = 0;
X box.x1 = pbox->x1;
X box.y1 = pbox->y1;
X box.x2 = pbox->x2-1;
X box.y2 = pbox->y2-1;
X clip1 = 0;
X clip2 = 0;
X
X oc1 = 0;
X oc2 = 0;
X OUTCODES(oc1, pt1.x, pt1.y, pbox);
X OUTCODES(oc2, pt2.x, pt2.y, pbox);
X
X if (oc1 & oc2)
X clipDone = -1;
X else if ((oc1 | oc2) == 0)
X clipDone = 1;
X else /* have to clip */
X clipDone = mfbClipLine(pbox, box,
X &pt1Orig, &pt1, &pt2,
X adx, ady, signdx, signdy,
X ( ( adx > ady ) ? X_AXIS : Y_AXIS ),
X &clip1, &clip2);
X
X if (clipDone == -1)
X {
X pbox++;
X }
X else
X {
X if ( adx > ady )
X len = ABS(pt2.x - pt1.x);
X else
X len = ABS(pt2.y - pt1.y);
X
X len += (clip2 != 0);
X if (len)
X {
X /* unwind bresenham error term to first point */
X if (clip1)
X {
X if ( adx > ady )
X err = e
X + ( ABS( pt1.y - pt1Orig.y ) * ( e2 - e1 ) )
X + ( ABS( pt1.x - pt1Orig.x ) * e1 ) ;
X else
X err = e
X + ( ABS( pt1.x - pt1Orig.x ) * ( e2 - e1 ) )
X + ( ABS( pt1.y - pt1Orig.y ) * e1 ) ;
X }
X else
X err = e;
X ibm8514BresDash( pGC, fg, bg, alu, pm,
X signdx, signdy,
X ( ( adx > ady ) ? X_AXIS : Y_AXIS ),
X pt1.x, pt1.y, err, e1, e2, len ) ;
X }
X
X /* if segment is unclipped, skip remaining rectangles */
X if (!(clip1 || clip2))
X break;
X else
X pbox++;
X }
X } /* while (nbox--) */
X } /* sloped line */
X } /* while (nline--) */
X
X /* paint the last point if the end style isn't CapNotLast.
X (Assume that a projecting, butt, or round cap that is one
X pixel wide is the same as the single pixel of the endpoint.)
X */
X
X if ((pGC->capStyle != CapNotLast) &&
X ((ppt->x != pptInit->x) ||
X (ppt->y != pptInit->y)))
X {
X nbox = nboxInit;
X pbox = pboxInit;
X scrnFunc =
X ( (ppcScrnPriv *)(pDrawable->pScreen->devPrivate))->solidFill ;
X while (nbox--)
X {
X if ((ppt->x >= pbox->x1) &&
X (ppt->y >= pbox->y1) &&
X (ppt->x < pbox->x2) &&
X (ppt->y < pbox->y2))
X {
X (* scrnFunc)( fg, alu, pm, ppt->x, ppt->y, 1, 1 ) ;
X break;
X }
X else
X pbox++;
X }
X }
X return ;
X}
X
Xvoid
Xibm8514VertDash(pGC, fg, bg, alu, pm, x, y, len)
XGCPtr pGC;
Xlong fg;
Xlong bg;
Xint alu;
Xint pm;
Xint x;
Xint y;
Xint len;
X{
X int talu = alu;
X long color = fg;
X int nseg; /* number of dashed segments */
X miDashPtr pdash; /* list of dashes */
X miDashPtr pdashInit;
X DDXPointRec pt[2];
X DDXPointRec pt1, pt2;
X int lx;
X
X pt[0].x = x;
X pt[0].y = y;
X pt[1].x = x;
X pt[1].y = y + len;
X
X pdashInit = pdash = miDashLine( 2, pt, pGC->numInDashList,
X pGC->dash, pGC->dashOffset, &nseg ) ;
X
X ibm8514ClearQueue(1);
X PLNWENBL(pm);
X
X for(; nseg--; pdash++){
X ibm8514ClearQueue(2);
X if(pGC->lineStyle == LineOnOffDash){
X if(pdash->which == ODD_DASH)
X SETFN1(FNCOLOR1,mergexlate[alu]);
X else
X SETFN1(FNCOLOR1,mergexlate[GXnoop]);
X } else {
X if(pdash->which == EVEN_DASH)
X SETCOL1(fg);
X else
X SETCOL1(bg);
X }
X
X pt1 = pdash->pt;
X pt2 = (pdash+1)->pt;
X
X if (lx = (pt2.y - pt1.y)) /* SIC */
X {
X ibm8514ClearQueue(4);
X SETLX(lx);
X SETX0(pt1.x);
X SETY0(pt1.y);
X COMMAND(0x20df);
X }
X }
X Xfree(pdashInit);
X}
X
X#ifdef notyet
Xvoid
Xibm8514HorzDashPat(pGC, fg, bg, alu, pm, x, y, len)
XGCPtr pGC;
Xlong fg;
Xlong bg;
Xint alu;
Xunsigned long pm;
Xint x;
Xint y;
Xint len;
X{
X short pattern = ;
X
X barrel_shift8(pattern, x % 8);
X ibm8514ATRNotBusy();
X
X ibm8514CheckQueue(4);
X SETMODE(M_PATTS);
X SETPAT0(pattern >> 3);
X SETPAT1(pattern << 1);
X PLNWENBL(pm);
X
X ibm8514CheckQueue(4);
X if(pGC->lineStyle == LineOnOffDash){
X SETCOL1(fg);
X SETFN0(FNCOLOR0,mergexlate[GXnoop]);
X SETFN1(FNCOLOR1,mergexlate[alu]);
X } else {
X SETCOL0(bg);
X SETCOL1(fg);
X SETFN0(FNCOLOR0,mergexlate[alu]);
X SETFN1(FNCOLOR1,mergexlate[alu]);
X }
X ibm8514HorzLine(color, alu, pm,
X x, y, len);
X}
X#endif
X
Xvoid
Xibm8514HorzDash(pGC, fg, bg, alu, pm, x, y, len)
XGCPtr pGC;
Xlong fg;
Xlong bg;
Xint alu;
Xunsigned long pm;
Xint x;
Xint y;
Xint len;
X{
X int talu = alu;
X long color = fg;
X int nseg; /* number of dashed segments */
X miDashPtr pdash; /* list of dashes */
X miDashPtr pdashInit;
X DDXPointRec pt[2];
X DDXPointRec pt1, pt2;
X int lx;
X
X pt[0].x = x;
X pt[0].y = y;
X pt[1].x = x + len;
X pt[1].y = y;
X
X pdashInit = pdash = miDashLine( 2, pt, pGC->numInDashList,
X pGC->dash, pGC->dashOffset, &nseg ) ;
X
X ibm8514ClearQueue(1);
X PLNWENBL(pm);
X
X for(; nseg--; pdash++){
X if(pGC->lineStyle == LineOnOffDash){
X if(pdash->which == ODD_DASH)
X talu = alu;
X else
X talu = GXnoop;
X } else {
X if(pdash->which == EVEN_DASH)
X color = fg;
X else
X color = bg;
X }
X pt1 = pdash->pt;
X pt2 = (pdash+1)->pt;
X
X if (lx = (pt2.x - pt1.x)) /* SIC */
X {
X ibm8514ATRNotBusy();
X ibm8514CheckQueue(6);
X SETFN1(FNCOLOR1,mergexlate[talu]);
X SETCOL1(color);
X SETLX(lx);
X SETX0(pt1.x);
X SETY0(pt1.y);
X COMMAND(0x201f);
X }
X }
X Xfree(pdashInit);
X}
X
Xvoid
Xibm8514BresDash( pGC, fg, bg, alu, pm, sdx, sdy, axis, x, y, et, e1, e2, len )
XGCPtr pGC;
Xunsigned long int fg, bg;
Xint alu ;
Xunsigned long int pm ;
Xint sdx, sdy, axis, x, y, et, e1, e2, len;
X{
X int talu = alu;
X long color = fg;
X int nseg; /* number of dashed segments */
X miDashPtr pdash; /* list of dashes */
X miDashPtr pdashInit;
X DDXPointRec pt[2];
X DDXPointRec pt1, pt2;
X int olen = len;
X
X pt[0].x = x;
X pt[0].y = y;
X pt[1].x = x + len;
X pt[1].y = y + len;
X
X pdashInit = pdash = miDashLine( 2, pt, pGC->numInDashList,
X pGC->dash, pGC->dashOffset, &nseg ) ;
X
X ibm8514ClearQueue(1);
X PLNWENBL(pm);
X for(; nseg--; pdash++){
X if(pGC->lineStyle == LineOnOffDash){
X if(pdash->which == ODD_DASH)
X talu = alu;
X else
X talu = GXnoop;
X } else {
X if(pdash->which == EVEN_DASH)
X color = fg;
X else
X color = bg;
X }
X pt1 = pdash->pt;
X pt2 = (pdash+1)->pt;
X if ( axis == X_AXIS )
X len = ABS(pt2.x - pt1.x);
X else
X len = ABS(pt2.y - pt1.y);
X
X if(pdash->newLine)
X ibm8514BresLineStart( color, talu, pm,
X sdx, sdy, axis,
X pt1.x, pt1.y , et, e1, e2, olen );
X ibm8514BresLineCont( color, talu, pm, sdx, sdy, axis, len );
X }
X ibm8514BresLineStop();
X Xfree(pdashInit);
X}
X
Xstatic int bres_saved;
X
Xvoid
Xibm8514BresLineStart( color, alu, pm, sdx, sdy, axis, x, y, et, e1, e2, len)
Xunsigned long int color ;
Xint alu ;
Xunsigned long int pm ;
Xint sdx, sdy, axis, x, y, et, e1, e2, len;
X{
X int cx, cy;
X
X if ( len <= 0 )
X return;
X if (sdx == -1)
X cx = x - len;
X else
X cx = x;
X if (sdy == -1)
X cy = y - len;
X else
X cy = y;
X bres_saved =
X !ibm8514cursorSemaphore && ibm8514CheckCursor( cx,cy,len,len ) ;
X
X ibm8514ATRNotBusy();
X ibm8514CheckQueue(6);
X PLNWENBL(pm);
X SETET(et);
X SETK1(e1);
X SETK2(e2);
X SETX0(x);
X SETY0(y);
X
X return;
X}
X
Xvoid
Xibm8514BresLineCont( color, alu, pm, sdx, sdy, axis, len)
Xunsigned long int color ;
Xint alu ;
Xunsigned long int pm ;
Xint sdx, sdy, axis, len;
X{
X unsigned short command;
X
X if ( len <= 0 )
X return;
X
X ibm8514ATRNotBusy();
X ibm8514CheckQueue(4);
X SETCOL1(color);
X SETFN1(FNCOLOR1,mergexlate[alu]);
X
X SETLX(len); /* going to use LAST PEL NULL in Line command to brecon */
X
X if (axis==X_AXIS)
X command = 0x2017; /* draw bres. line on X, W, LPN, */
X else
X command = 0x2057; /* same, on Y */
X if (sdx > 0)
X command |= 0x0020;
X if (sdy > 0)
X command |= 0x0080;
X COMMAND(command);
X
X return;
X}
X
Xvoid
Xibm8514BresLineStop()
X{
X ibm8514ATRNotBusy();
X ibm8514CheckQueue(2);
X SETFN1(FNCOLOR1,FNREPLACE);
X PLNWENBL(ALLPLANES);
X
X if (bres_saved)
X ibm8514ReplaceCursor();
X return;
X}
END-of-ibm8514/brcDLine.c
echo x - ibm8514/brcDash.c
sed 's/^X//' >ibm8514/brcDash.c << 'END-of-ibm8514/brcDash.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X * Hardware interface routines for IBM 8514/A adapter for
X * X.11 server(s) on IBM equipment.
X *
X */
X
X SYNTAX ERROR THIS LINE because I haven't finished cleaning this file for
X timing errors. 11/16/88 paquin
X
X/***********************************************************
XCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
Xand the Massachusetts Institute of Technology, Cambridge, Massachusetts.
X
X All Rights Reserved
X
XPermission to use, copy, modify, and distribute this software and its
Xdocumentation for any purpose and without fee is hereby granted,
Xprovided that the above copyright notice appear in all copies and that
Xboth that copyright notice and this permission notice appear in
Xsupporting documentation, and that the names of Digital or MIT not be
Xused in advertising or publicity pertaining to distribution of the
Xsoftware without specific, written prior permission.
X
XDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
XDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
XSOFTWARE.
X
X******************************************************************/
X
X/* $Header:
/andrew/X11/r3src/earlyRelease/server/ddx/ibm/ibm8514/RCS/brcDash.c,v
6.4 88/11/16 18:45:01 paquin Exp $ */
X/* $Source:
/andrew/X11/r3src/earlyRelease/server/ddx/ibm/ibm8514/RCS/brcDash.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/earlyRelease/server/ddx/ibm/ibm8514/RCS/brcDash.c,v
6.4 88/11/16 18:45:01 paquin Exp $";
X#endif
X
X
X#include "X.h"
X
X#include "misc.h"
X#include "gcstruct.h"
X#include "gc.h"
X#include "pixmap.h"
X#include "window.h"
X#include "windowstr.h"
X#include "pixmapstr.h"
X#include "regionstr.h"
X#include "scrnintstr.h"
X#include "mistruct.h"
X
X#include "OScompiler.h"
X
X#include "mfb.h"
X#include "ppc.h"
X
X#include "x8514.h"
X
X#define ACCESS_PIXEL (1 << 4)
X
X#define barrel_shift8(v, s) \
X (v = (v >> s) | (v << (8 - s)))
X
X#define HARDWARE_PATTERN 0x01
X
Xtypedef struct {
X unsigned char Flags;
X unsigned short Pattern;
X} ibm8514PrivGC;
X
Xtypedef ibm8514PrivGC *ibm8514PrivGCPtr;
X
X/*
X * ibm8514 dashed line
X */
X
Xextern void ibm8514BresDash();
Xextern void ibm8514HorzDash();
Xextern void ibm8514VertDash();
X
X#define X_AXIS 0
X
Xextern int mergexlate[];
Xextern int ibm8514cursorSemaphore ;
X
X/* NOTE
X maybe OUTCODES should take box (the one that includes all
Xedges) instead of pbox (the standard no-right-or-lower-edge one)?
X*/
X#define OUTCODES(result, x, y, pbox) \
X if (x < pbox->x1) \
X result |= OUT_LEFT; \
X else if (x >= pbox->x2) \
X result |= OUT_RIGHT; \
X if (y < pbox->y1) \
X result |= OUT_ABOVE; \
X else if (y >= pbox->y2) \
X result |= OUT_BELOW;
X
Xvoid
Xibm8514ZeroDash(pDrawable, pGC, mode, npt, pptInit)
X DrawablePtr pDrawable;
X GCPtr pGC;
X int mode; /* Origin or Previous */
X int npt; /* number of points */
X DDXPointPtr pptInit;
X{
X int nboxInit;
X register int nbox;
X BoxPtr pboxInit;
X register BoxPtr pbox;
X int nptTmp;
X DDXPointPtr ppt; /* pointer to list of translated points */
X
X DDXPointRec pt1;
X DDXPointRec pt2;
X
X unsigned int oc1; /* outcode of point 1 */
X unsigned int oc2; /* outcode of point 2 */
X
X int xorg, yorg; /* origin of window */
X
X int adx; /* abs values of dx and dy */
X int ady;
X int signdx; /* sign of dx and dy */
X int signdy;
X int e, e1, e2; /* bresenham error and increments */
X int len; /* length of segment */
X
X int clipDone; /* flag for clipping loop */
X DDXPointRec pt1Orig; /* unclipped start point */
X DDXPointRec pt2Orig; /* unclipped end point */
X int err; /* modified bresenham error term */
X int clip1, clip2; /* clippedness of the endpoints */
X
X int alu ; /* Screen Raster-Op value */
X long fg ; /* foreground Pixel value */
X long bg ; /* background Pixel value */
X unsigned long pm ; /* plane mask */
X register int tmp;
X int x1, x2, y1, y2;
X /* a bunch of temporaries */
X void (* scrnFunc)();
X
X if ( pDrawable->type != DRAWABLE_WINDOW )
X {
X ErrorF("ibm8514ZeroDash: not a window\n");
X return;
X }
X
X switch ( ( (ppcPrivGC *) pGC->devPriv )->colorRrop.fillStyle ) {
X case FillSolid : /* Can Use Optimized Color Raster-Op */
X alu = ( (ppcPrivGC *) pGC->devPriv )->colorRrop.alu ;
X pm = ( (ppcPrivGC *) pGC->devPriv )->colorRrop.planemask ;
X if(pGC->lineStyle == LineOnOffDash){
X ibm8514ClearQueue(1);
X SETCOL1( ( (ppcPrivGC *) pGC->devPriv )->colorRrop.fgPixel) ;
X } else {
X fg = ( (ppcPrivGC *) pGC->devPriv )->colorRrop.fgPixel ;
X bg = ( (ppcPrivGC *) pGC->devPriv )->colorRrop.bgPixel ;
X }
X break ;
X case FillTiled : /* Can't Use Optimized Color Raster-Op */
X alu = pGC->alu ;
X pm = pGC->planemask ;
X if(pGC->lineStyle == LineOnOffDash){
X ibm8514ClearQueue(1);
X SETCOL1(pGC->fgPixel);
X } else {
X fg = pGC->fgPixel ;
X bg = pGC->bgPixel ;
X }
X break ;
X }
X if ( alu == GXnoop )
X return ;
X
X pboxInit = ((mfbPrivGC *)(pGC->devPriv))->pCompositeClip->rects;
X nboxInit = ((mfbPrivGC *)(pGC->devPriv))->pCompositeClip->numRects;
X
X xorg = ((WindowPtr)pDrawable)->absCorner.x;
X yorg = ((WindowPtr)pDrawable)->absCorner.y;
X
X /* translate the point list */
X ppt = pptInit;
X nptTmp = npt;
X if (mode == CoordModeOrigin)
X {
X while(nptTmp--)
X {
X ppt->x += xorg;
X ppt++->y += yorg;
X }
X }
X else
X {
X ppt->x += xorg;
X ppt->y += yorg;
X nptTmp--;
X while ( nptTmp-- )
X {
X ppt++;
X ppt->x += (ppt-1)->x;
X ppt->y += (ppt-1)->y;
X }
X }
X
X ppt = pptInit;
X while ( --npt )
X {
X nbox = nboxInit;
X pbox = pboxInit;
X
X pt1 = *ppt++;
X pt2 = *ppt;
X
X if ( !( adx = ( pt2.x - pt1.x ) ) )
X {
X /* make the line go top to bottom of screen, keeping
X endpoint semantics
X */
X if ( pt1.y > pt2.y )
X {
X tmp = pt2.y;
X pt2.y = pt1.y + 1;
X pt1.y = tmp + 1;
X }
X
X /* get to first band that might contain part of line */
X while ((nbox) && (pbox->y2 <= pt1.y))
X {
X pbox++;
X nbox--;
X }
X
X if ( nbox )
X {
X /* stop when lower edge of box is beyond end of line */
X while ( ( nbox ) && ( pt2.y >= pbox->y1 ) ) {
X if ( ( pt1.x >= pbox->x1 ) && ( pt1.x < pbox->x2 ) ) {
X /* this box has part of the line in it */
X if ( ( y1 = MAX( pt1.y, pbox->y1 ) )
X != ( y2 = MIN( pt2.y, pbox->y2 ) ) ) {
X ibm8514VertDash( pGC, fg, bg,
X alu, pm, pt1.x, y1, y2 - y1 ) ;
X }
X }
X nbox--;
X pbox++;
X }
X }
X
X }
X else if ( !( ady = ( pt2.y - pt1.y ) ) )
X {
X /* force line from left to right, keeping
X endpoint semantics
X */
X if (pt1.x > pt2.x)
X {
X tmp = pt2.x;
X pt2.x = pt1.x + 1;
X pt1.x = tmp + 1;
X }
X
X /* find the correct band */
X while( nbox && (pbox->y2 <= pt1.y))
X {
X pbox++;
X nbox--;
X }
X
X /* try to draw the line, if we haven't gone beyond it */
X if ((nbox) && (pbox->y1 <= pt1.y))
X {
X /* when we leave this band, we're done */
X tmp = pbox->y1;
X while((nbox) && (pbox->y1 == tmp))
X {
X if (pbox->x2 <= pt1.x)
X {
X /* skip boxes until one might contain start point */
X nbox--;
X pbox++;
X continue;
X }
X
X /* stop if left of box is beyond right of line */
X if (pbox->x1 >= pt2.x)
X {
X nbox = 0;
X continue;
X }
X if ( ( x1 = MAX( pt1.x, pbox->x1 ) )
X != ( x2 = MIN( pt2.x, pbox->x2 ) ) ) {
X ibm8514HorzDash( pGC, fg, bg,
X alu, pm, x1, pt1.y, x2 - x1 ) ;
X }
X nbox--;
X pbox++;
X }
X }
X }
X else /* sloped line */
X {
X signdx = sign(adx);
X signdy = sign(ady);
X adx = ABS(adx);
X ady = ABS(ady);
X
X if (adx > ady)
X {
X e1 = ady*2;
X e2 = e1 - 2*adx;
X e = e1 - adx;
X
X }
X else
X {
X e1 = adx*2;
X e2 = e1 - 2*ady;
X e = e1 - ady;
X }
X
X /* we have bresenham parameters and two points.
X all we have to do now is clip and draw.
X */
X
X pt1Orig = pt1;
X pt2Orig = pt2;
X
X while(nbox--)
X {
X
X BoxRec box;
X
X pt1 = pt1Orig;
X pt2 = pt2Orig;
X clipDone = 0;
X box.x1 = pbox->x1;
X box.y1 = pbox->y1;
X box.x2 = pbox->x2-1;
X box.y2 = pbox->y2-1;
X clip1 = 0;
X clip2 = 0;
X
X oc1 = 0;
X oc2 = 0;
X OUTCODES(oc1, pt1.x, pt1.y, pbox);
X OUTCODES(oc2, pt2.x, pt2.y, pbox);
X
X if (oc1 & oc2)
X clipDone = -1;
X else if ((oc1 | oc2) == 0)
X clipDone = 1;
X else /* have to clip */
X clipDone = mfbClipLine(pbox, box,
X &pt1Orig, &pt1, &pt2,
X adx, ady, signdx, signdy,
X ( ( adx > ady ) ? X_AXIS : Y_AXIS ),
X &clip1, &clip2);
X
X if (clipDone == -1)
X {
X pbox++;
X }
X else
X {
X if ( adx > ady )
X len = ABS(pt2.x - pt1.x);
X else
X len = ABS(pt2.y - pt1.y);
X
X len += (clip2 != 0);
X if (len)
X {
X /* unwind bresenham error term to first point */
X if (clip1)
X {
X if ( adx > ady )
X err = e
X + ( ABS( pt1.y - pt1Orig.y ) * ( e2 - e1 ) )
X + ( ABS( pt1.x - pt1Orig.x ) * e1 ) ;
X else
X err = e
X + ( ABS( pt1.x - pt1Orig.x ) * ( e2 - e1 ) )
X + ( ABS( pt1.y - pt1Orig.y ) * e1 ) ;
X }
X else
X err = e;
X ibm8514BresDash( pGC, fg, bg, alu, pm,
X signdx, signdy,
X ( ( adx > ady ) ? X_AXIS : Y_AXIS ),
X pt1.x, pt1.y, err, e1, e2, len ) ;
X }
X
X /* if segment is unclipped, skip remaining rectangles */
X if (!(clip1 || clip2))
X break;
X else
X pbox++;
X }
X } /* while (nbox--) */
X } /* sloped line */
X } /* while (nline--) */
X
X /* paint the last point if the end style isn't CapNotLast.
X (Assume that a projecting, butt, or round cap that is one
X pixel wide is the same as the single pixel of the endpoint.)
X */
X
X if ((pGC->capStyle != CapNotLast) &&
X ((ppt->x != pptInit->x) ||
X (ppt->y != pptInit->y)))
X {
X nbox = nboxInit;
X pbox = pboxInit;
X scrnFunc =
X ( (ppcScrnPriv *)(pDrawable->pScreen->devPrivate))->solidFill ;
X while (nbox--)
X {
X if ((ppt->x >= pbox->x1) &&
X (ppt->y >= pbox->y1) &&
X (ppt->x < pbox->x2) &&
X (ppt->y < pbox->y2))
X {
X (* scrnFunc)( fg, alu, pm, ppt->x, ppt->y, 1, 1 ) ;
X break;
X }
X else
X pbox++;
X }
X }
X return ;
X}
X
Xvoid
Xibm8514VertDash(pGC, fg, bg, alu, pm, x, y, len)
XGCPtr pGC;
Xlong fg;
Xlong bg;
Xint alu;
Xint pm;
Xint x;
Xint y;
Xint len;
X{
X int saved;
X int l = pGC->dash[0];
X int n = 0;
X int togo = len;
X int ndash = 0;
X int command = 0x20df | ACCESS_PIXEL;
X
X y += pGC->dashOffset;
X
X saved =
X !ibm8514cursorSemaphore && ibm8514CheckCursor( x,y,1,len ) ;
X
X
X ibm8514ATRNotBusy();
X ibm8514CheckQueue(5);
X PLNWENBL(pm);
X SETCOL1(fg);
X SETFN1(FNCOLOR1,mergexlate[alu]);
X SETX0(x);
X SETY0(y);
X
X while(togo){
X /* handle odd dash lists later */
X if(n > pGC->numInDashList){
X n = 0;
X }
X l = MIN(pGC->dash[n++], togo);
X togo -= l;
X if(pGC->lineStyle == LineOnOffDash){
X if(ndash & 0x01)
X command = 0x20df | ACCESS_PIXEL;
X else
X command = 0x20df & ~ACCESS_PIXEL;
X ibm8514ClearQueue(2);
X } else {
X ibm8514ClearQueue(4);
X if(ndash & 0x01)
X SETCOL1(bg);
X else
X SETCOL1(fg);
X
X /* this appears to be a stupid line. tfp 11/16/88 */
X SETFN1(FNCOLOR1,mergexlate[alu]);
X }
X ndash++;
X
X SETLX(l);
X COMMAND(command);
X }
X
X ibm8514ClearQueue(2);
X SETFN1(FNCOLOR1,FNREPLACE);
X PLNWENBL(WPLANES);
X if (saved)
X ibm8514ReplaceCursor();
X}
X
Xvoid
Xibm8514HorzDash(pGC, fg, bg, alu, pm, x, y, len)
XGCPtr pGC;
Xlong fg;
Xlong bg;
Xint alu;
Xunsigned long pm;
Xint x;
Xint y;
Xint len;
X{
X int l = pGC->dash[0];
X int n = 0;
X int ndash = 0;
X int command = 0x201f | ACCESS_PIXEL;
X ppcPrivGCPtr ppcPriv = (ppcPrivGCPtr)pGC->devPriv;
X ibm8514PrivGCPtr ibm8514Priv = (ibm8514PrivGCPtr)ppcPriv->devPriv;
X int togo = len;
X int saved;
X
X unsigned char flags = ibm8514Priv->Flags;
X unsigned short pattern = ibm8514Priv->Pattern;
X
X x += pGC->dashOffset;
X
X saved =
X !ibm8514cursorSemaphore && ibm8514CheckCursor( x,y,len,1 ) ;
X
X ibm8514ATRNotBusy();
X ibm8514CheckQueue(5);
X PLNWENBL(pm);
X SETCOL1(fg);
X SETFN1(FNCOLOR1,mergexlate[alu]);
X SETX0(x);
X SETY0(y);
X if(flags & HARDWARE_PATTERN){
X ibm8514CheckQueue(5);
X barrel_shift8(pattern, x % 8);
X SETMODE(M_PATTS);
X SETPAT0(pattern >> 3);
X SETPAT1(pattern << 1);
X SETCOL0(bg);
X if(pGC->lineStyle == LineOnOffDash){
X SETFN0(FNCOLOR0,mergexlate[GXnoop]);
X } else {
X SETFN0(FNCOLOR0,mergexlate[alu]);
X }
X }
X while(togo){
X /* handle odd dash lists later */
X if(n > pGC->numInDashList){
X n = 0;
X }
X l = MIN(pGC->dash[n++], togo);
X togo -= l;
X if(!(flags & HARDWARE_PATTERN)){
X if(pGC->lineStyle == LineOnOffDash){
X if(ndash & 0x01){
X command = 0x201f | ACCESS_PIXEL;
X } else {
X command = 0x201f & ~ACCESS_PIXEL;
X }
X } else {
X ibm8514ClearQueue(5);
X PLNWENBL(pm);
X if(ndash & 0x01){
X SETCOL1(bg);
X } else {
X SETCOL1(fg);
X }
X
X /* why reset the fn1? tfp 11/16/88 */
X SETFN1(FNCOLOR1,mergexlate[alu]);
X SETX0(x);
X SETY0(y);
X }
X }
X ndash++;
X ibm8514ClearQueue(2);
X SETLX(l);
X COMMAND(command);
X }
X ibm8514ClearQueue(6);
X SETMODE(M_ONES);
X SETPAT0(0);
X SETPAT1(0);
X SETFN0(FNCOLOR0,FNREPLACE);
X SETFN1(FNCOLOR1,FNREPLACE);
X PLNWENBL(WPLANES);
X if (saved)
X ibm8514ReplaceCursor();
X}
X
Xvoid
Xibm8514BresDash( pGC, fg, bg, alu, pm, sdx, sdy, axis, x, y, et, e1, e2, len )
XGCPtr pGC;
Xunsigned long int fg, bg;
Xint alu ;
Xunsigned long int pm ;
Xint sdx, sdy, axis, x, y, et, e1, e2, len;
X{
X int saved;
X int togo = len;
X int l = pGC->dash[0];
X int n = 0;
X int ndash = 0;
X int command;
X ppcPrivGCPtr ppcPriv = (ppcPrivGCPtr)pGC->devPriv;
X ibm8514PrivGCPtr ibm8514Priv = (ibm8514PrivGCPtr)ppcPriv->devPriv;
X unsigned char flags = ibm8514Priv->Flags;
X unsigned short pattern = ibm8514Priv->Pattern;
X
X saved =
X !ibm8514cursorSemaphore && ibm8514CheckCursor( x,y,len,len ) ;
X
X if (axis==X_AXIS){
X y += pGC->dashOffset;
X command = 0x2017; /* draw bres. line on X, W, LPN, */
X } else {
X x += pGC->dashOffset;
X command = 0x2057; /* same, on Y */
X }
X
X if (sdx > 0)
X command |= 0x0020;
X if (sdy > 0)
X command |= 0x0080;
X
X ibm8514ClearQueue(2);
X SETCOL1(fg);
X SETFN1(FNCOLOR1,mergexlate[alu]);
X if(axis == X_AXIS && flags & HARDWARE_PATTERN){
X ibm8514ClearQueue(6);
X barrel_shift8(pattern, x % 8);
X SETMODE(M_PATTS);
X SETPAT0(pattern >> 3);
X SETPAT1(pattern << 1);
X if(pGC->lineStyle == LineOnOffDash){
X SETFN0(FNCOLOR0,mergexlate[GXnoop]);
X } else {
X SETCOL0(bg);
X SETFN0(FNCOLOR0,mergexlate[alu]);
X }
X }
X ibm8514ClearQueue(6);
X PLNWENBL(pm);
X SETET(et);
X SETK1(e1);
X SETK2(e2);
X
X SETX0(x);
X SETY0(y);
X
X while(togo){
X /* handle odd dash lists later */
X if(n > pGC->numInDashList){
X n = 0;
X }
X l = MIN(pGC->dash[n++], togo);
X togo -= l;
X if(!(axis == X_AXIS && flags & HARDWARE_PATTERN)){
X if(pGC->lineStyle == LineOnOffDash){
X if(ndash & 0x01)
X command |= ACCESS_PIXEL;
X else
X command &= ~ACCESS_PIXEL;
X } else {
X ibm8514ClearQueue(1);
X if(ndash & 0x01)
X SETCOL1(bg);
X else
X SETCOL1(fg);
X SETFN1(FNCOLOR1,mergexlate[alu]);
X }
X }
X
X ndash++;
X
X ibm8514ClearQueue(2);
X /* going to use LAST PEL NULL in Line command to brecon */
X SETLX(l);
X
X COMMAND(command);
X }
X ibm8514ClearQueue(6);
X SETMODE(M_ONES);
X SETPAT0(0);
X SETPAT1(0);
X SETFN0(FNCOLOR0,FNREPLACE);
X SETFN1(FNCOLOR1,FNREPLACE);
X PLNWENBL(WPLANES);
X if (saved)
X ibm8514ReplaceCursor();
X}
X
X#define barrel_shift8(v, s) \
X (v = (v >> s) | (v << (8 - s)))
X
Xvoid
Xibm8514_do_dashline_gc(pGC)
Xregister GCPtr pGC;
X{
X register unsigned int len = 0;
X register unsigned int n;
X register ibm8514PrivGCPtr ibm8514Priv =
X (ibm8514PrivGCPtr) ( (ppcPrivGCPtr) pGC->devPriv )->devPriv;
X
X /* check for dash pattern useable to ibm8514 */
X for ( n = 0 ; n < pGC->numInDashList ; n++ )
X len += pGC->dash[n];
X
X if ( len == 2 ||
X len == 4 ||
X (len == 8 && ((pGC->numInDashList & 1) == 0)))
X {
X register int bit;
X register int offset = 0;
X register unsigned char *dp = &pGC->dash[0];
X unsigned short pattern;
X
X pattern = 0;
X /* encode dash pattern into bitmask */
X while (n-- > 0 && *dp != 0){
X pattern |= ( ( ( 1 << *dp ) - 1 ) << offset ) ;
X offset += *dp++;
X if (n-- > 0)
X offset += *dp++;
X }
X /* replicate pattern over full 8 bits */
X for (bit = offset; bit < 8; bit++){
X pattern |=
X (pattern & (1 << bit - offset))
X << offset;
X }
X /* shift pattern to implement offset - mod 8 */
X /* is it legal for offset > length ?? */
X if (pGC->dashOffset != 0)
X barrel_shift8(pattern, pGC->dashOffset % 8);
X ibm8514Priv->Pattern = pattern;
X ibm8514Priv->Flags |= HARDWARE_PATTERN;
X } else {
X ibm8514Priv->Flags &= ~HARDWARE_PATTERN;
X }
X pGC->Polylines = ibm8514ZeroDash;
X return ;
X}
END-of-ibm8514/brcDash.c
echo x - ibm8514/brcData.c
sed 's/^X//' >ibm8514/brcData.c << 'END-of-ibm8514/brcData.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X#include "X.h"
X#include "Xproto.h"
X#include "miscstruct.h"
X#include "scrnintstr.h"
X#include "font.h"
X#include "pixmapstr.h"
X#include "window.h"
X#include "gcstruct.h"
X#include "colormapst.h"
X#include "cursorstr.h"
X
X#include "mistruct.h"
X#include "mfb.h"
X
X#include "OScursor.h"
X#include "OSio.h"
X#include "ibmScreen.h"
X
X#include "ppc.h"
X#include "ppcProcs.h"
X
X#include "x8514.h"
X
X#include "brcProcs.h"
X
Xextern void miRecolorCursor() ;
Xextern void NoopDDA() ;
Xextern void ibmAbort() ;
X
Xextern ScreenRec ibm8514ScreenRec ; /* Forward Declaration */
X
XPixmapFormatRec ibm8514Formats[]= { { IBM8514MAXPLANES, 8, 32 } } ;
X
XVisualRec ibm8514Visuals[] = {
X {
X 0, /* unsigned long vid */
X PseudoColor, /* short class */
X 6, /* short bitsPerRGBValue */
X 1 << IBM8514MAXPLANES, /* short ColormapEntries */
X IBM8514MAXPLANES, /* short nplanes */
X 0, /* unsigned long redMask */
X 0, /* unsigned long greenMask */
X 0, /* unsigned long blueMask */
X 0, /* int offsetRed */
X 0, /* int offsetGreen */
X 0 /* int offsetBlue */
X }
X} ;
X
X#define NUM_VISUALS (sizeof ibm8514Visuals/sizeof (VisualRec))
X
Xunsigned long int ibm8514DepthVIDs[NUM_VISUALS];
X
XDepthRec ibm8514Depths[] = {
X/* depth numVid vids */
X { 1, 0, NULL },
X { IBM8514MAXPLANES, NUM_VISUALS, ibm8514DepthVIDs }
X} ;
X
X#define ibm8514GCInterestValidateMask \
X( GCLineStyle | GCLineWidth | GCJoinStyle | GCBackground | GCForeground \
X| GCFunction | GCPlaneMask | GCFillStyle | GC_CALL_VALIDATE_BIT \
X| GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode )
X
XppcPrivGC ibm8514PrototypeGCPriv = {
X GXcopy, /* unsigned char rop */
X 0, /* unsigned char ropOpStip */
X 0, /* unsigned char ropFillArea */
X TRUE, /* short fExpose */
X FALSE, /* short freeCompClip */
X NullPixmap, /* PixmapPtr pRotatedPixmap */
X 0, /* RegionPtr pCompositeClip */
X ppcAreaFill, /* void (* FillArea)() */
X {
X ibm8514ALLPLANES, /* unsigned long planemask */
X 0, /* unsigned long fgPixel */
X 1, /* unsigned long bgPixel */
X GXcopy, /* int alu */
X FillSolid, /* int fillStyle */
X }, /* ppcReducedRrop colorRrop */
X -1, /* short lastDrawableType */
X -1, /* short lastDrawableDepth */
X ibmAbort, /* void (* cachedIGBlt)() */
X ibmAbort, /* void (* cachedPGBlt)() */
X 0 /* pointer devPriv */
X} ;
X
XGCFuncs ibm8514GCFuncs = {
XppcValidateGC, /* void (*ValidateGC)() */
XNoopDDA, /* void (*ChangeGC)() */
XNoopDDA, /* void (*CopyGC)() */
XppcDestroyGC, /* void (*DestroyGC)() */
XppcChangeClip, /* void (*ChangeClip)() */
XppcDestroyClip, /* void (*DestroyClip)() */
XppcCopyClip /* void (*CopyClip)() */
X};
X
XGCOps ibm8514GCOps = {
X ibm8514SolidFS, /* void (* FillSpans)() */
X ppcSetSpans, /* void (* SetSpans)() */
X miPutImage, /* void (* PutImage)() */
X ppcCopyArea, /* RegionPtr (* CopyArea)() */
X miCopyPlane, /* void (* CopyPlane)() */
X ppcPolyPoint, /* void (* PolyPoint)() */
X ppcScrnZeroLine, /* void (* Polylines)() */
X ppcScrnZeroSegs, /* void (* PolySegment)() */
X miPolyRectangle, /* void (* PolyRectangle)() */
X miPolyArc, /* void (* PolyArc)() */
X ibm8514FillPolygon, /* void (* FillPolygon)() */
X miPolyFillRect, /* void (* PolyFillRect)() */
X miPolyFillArc, /* void (* PolyFillArc)() */
X ibm8514PolyText8, /* int (* PolyText8)() */
X ibm8514PolyText16, /* int (* PolyText16)() */
X ibm8514ImageText8, /* void (* ImageText8)() */
X ibm8514ImageText16, /* void (* ImageText16)() */
X (void (*)()) ibm8514ImageGlyphBlt, /* void (* ImageGlyphBlt)() */
X (void (*)()) ppcPolyGlyphBlt, /* void (* PolyGlyphBlt)() */
X ibm8514PushPixels, /* void (* PushPixels)() */
X miMiter /* void (* LineHelper)() */
X};
X
XGC ibm8514PrototypeGC = {
X &ibm8514ScreenRec, /* ScreenPtr pScreen */
X IBM8514MAXPLANES, /* int depth */
X GXcopy, /* int alu */
X 0, /* int lineWidth */
X 0, /* int dashOffset */
X 0, /* int numInDashList */
X 0, /* unsigned char *dash */
X LineSolid, /* int lineStyle */
X CapButt, /* int capStyle */
X JoinMiter, /* int joinStyle */
X FillSolid, /* int fillStyle */
X EvenOddRule, /* int fillRule */
X ArcPieSlice, /* int arcMode */
X ClipByChildren, /* int subWindowMode */
X TRUE, /* Bool graphicsExposures */
X CT_NONE, /* int clientClipType */
X 1, /* int miTranslate:1 */
X 1, /* unsigned int tileIsPixel:1 */
X 0, /* unused:16 */
X ibm8514ALLPLANES, /* unsigned long planemask */
X 0, /* unsigned long fgPixel */
X 1, /* unsigned long bgPixel */
X 0, /* PixmapPtr tile */
X 0, /* PixmapPtr stipple */
X { 0, 0 }, /* DDXPointRec patOrg */
X 0, /* FontPtr font */
X { 0, 0 }, /* DDXPointRec clipOrg */
X { 0, 0 }, /* DDXPointRec lastWinOrg */
X NULL, /* pointer clientClip */
X /*(1<<(GCLastBit+1))-1,*/ /* unsigned long stateChanges */
X 0, /* unsigned long stateChanges */
X 0, /* unsigned long serialNumber */
X (GCFuncs *) &ibm8514GCFuncs, /* pointer funcs */
X (GCOps *) &ibm8514GCOps, /* pointer ops */
X NULL /* devUnion devPrivates */
X} ;
X
XppcScrnPriv ibm8514ScrnPriv = {
X {
X {
X (unsigned char)DRAWABLE_PIXMAP,/* unsigned char type */
X (unsigned char)0, /*unsigned char class */
X (unsigned char)IBM8514MAXPLANES, /*unsignedchar depth */
X (unsigned char)1, /* unsigned char bitsPerPixel */
X 0, /* unsigned long id */
X 0, /* short x */
X 0, /* short y */
X _8514_SCREEN_WIDTH, /* unsigned short width */
X _8514_SCREEN_HEIGHT, /* unsigned short height */
X 0, /* ScreenPtr pScreen */
X 0, /* unsigned long serialNumber */
X }, /* DrawableRec drawable */
X 1, /* int refcnt */
X _8514_SCREEN_WIDTH / 8, /* int devKind */
X 0 /* pointer devPrivate */
X }, /* PixmapRec pixmap */
X 0, /* void (* devHardwareInitBB)() */
X 0, /* void (* devHardwareInitAB)() */
X &ibm8514PrototypeGC, /* GCPtr devPrototypeGC */
X &ibm8514PrototypeGCPriv,/* ppcPrivGC *devPrototypeGCPriv */
X ibm8514ChangeGCtype, /* Mask (* changeGCtype)() */
X ibm8514ChangeWindowGC, /* Mask (* changeWindowGC)() */
X 0, /* Colormap InstalledColormap */
X ibm8514Bitblt, /* void (* blit)() */
X (void (*)()) ibm8514DrawRectangle, /* void (* solidFill)() */
X ibm8514TileRect, /* void (* tileFill)() */
X ibm8514Stipple, /* void (* stipFill)() */
X ibm8514OpStipple, /* void (* opstipFill)() */
X ibm8514DrawColorImage, /* void (* imageFill)() */
X ibm8514ReadColorImage, /* void (* imageRead)() */
X ibm8514BresLine, /* void (* lineBres)() */
X ibm8514HorzLine, /* void (* lineHorz)() */
X ibm8514VertLine, /* void (* lineVert)() */
X (void (*)())ibm8514SetColor, /* void (* setColor)() */
X ibm8514RecolorCursor, /* void (* RecolorCursor)() */
X ibm8514FillMonoImage, /* void (* monoFill)() */
X ibm8514DrawMonoByteImage, /* void (* glyphFill)() */
X (unsigned long *((*)())) ibmAbort,/* unsigned long *((* planeRead)()) */
X ppcReplicateArea, /* void (* replicateArea)() */
X NoopDDA, /* void (* DestroyGCPriv)() */
X/* High Level Software Cursor Support !! */
X &ibm8514cursorSemaphore,/* int * CursorSemaphore */
X ibm8514CheckCursor, /* int (* CheckCursor)() */
X ibm8514ReplaceCursor, /* void (* ReplaceCursor)() */
X 0 /* ppcCacheInfoPtr cacheInfo */
X} ;
X
XScreenRec ibm8514ScreenRec = {
X 0, /* int myNum */
X 0, /* ATOM id */
X _8514_SCREEN_WIDTH, /* short width */
X _8514_SCREEN_HEIGHT, /* short height */
X (_8514_SCREEN_WIDTH * 254)/800, /* short mmWidth */
X (_8514_SCREEN_HEIGHT*254)/800, /* short mmHeight */
X sizeof ibm8514Depths/sizeof (DepthRec), /* short numDepths */
X IBM8514MAXPLANES, /* short rootDepth */
X ibm8514Depths, /* DepthPtr allowedDepths */
X 0, /* unsigned long rootVisual */
X 0, /* unsigned long defColormap */
X 0, /* short minInstalledCmaps */
X 1, /* short maxInstalledCmaps */
X Always, /* char backingStoreSupport */
X NotUseful, /* char saveUnderSupport */
X IBM8514_WHITE_PIXEL, /* unsigned long whitePixel */
X IBM8514_BLACK_PIXEL, /* unsigned long blackPixel */
X 0, /* unsigned long rgf */
X { 0 }, /* GCPtr GCperDepth[MAXFORMATS+1] */
X { 0 }, /* PixmapPtr PixmapPerDepth[1] */
X (pointer) &ibm8514ScrnPriv, /* pointer devPrivate */
X NUM_VISUALS, /* short numVisuals */
X &ibm8514Visuals[0], /* VisualPtr visuals */
X 0, /* int WindowPrivateLen; */
X 0, /* unsigned WindowPrivateSizes; */
X 0, /* unsigned totalWindowSize; */
X 0, /* int GCPrivateLen; */
X 0, /* unsigned GCPrivateSizes; */
X 0, /* unsigned totalGCSize; */
X/* Random screen procedures */
X ibm8514ScreenClose, /* Bool (* CloseScreen)() */
X ppcQueryBestSize, /* void (* QueryBestSize)() */
X ibmSaveScreen, /* Bool (* SaveScreen)() */
X miGetImage, /* void (* GetImage)() */
X (void (*)()) ibm8514GetSpans, /* void (*GetSpans)() */
X ibmAbort, /* void (* PointerNonInterestBox)() */
X (void (*)())NULL, /* void (* SourceValidate)() */
X/* Window Procedures */
X ppcCreateWindow, /* Bool (* CreateWindow)() */
X ppcDestroyWindow, /* Bool (* DestroyWindow)() */
X ppcPositionWindow, /* Bool (* PositionWindow)() */
X mfbChangeWindowAttributes, /* Bool (* ChangeWindowAttributes)() */
X mfbMapWindow, /* Bool (* RealizeWindow)() */
X mfbUnmapWindow, /* Bool (* UnrealizeWindow)() */
X miValidateTree, /* int (* ValidateTree)() */
X miWindowExposures, /* void (* WindowExposures)() */
X ppcPaintWindow, /* void PaintWindowBackground */
X ppcPaintWindow, /* void PaintWindowBorder */
X ppcCopyWindow, /* void CopyWindow */
X miClearToBackground, /* void ClearToBackground */
X/* Pixmap procedures */
X ppcCreatePixmap, /* PixmapPtr (* CreatePixmap)() */
X mfbDestroyPixmap, /* Bool (* DestroyPixmap)() */
X/* Backing store Procedures */
X NoopDDA, /* void SaveDoomedAreas */
X (RegionPtr (*)())ppcRestoreAreas, /* RegionPtr RestoreAreas */
X NoopDDA, /* void ExposeCopy */
X (RegionPtr (*)())NoopDDA, /* RegionPtr TranslateBackingStore */
X (RegionPtr (*)())NoopDDA, /* RegionPtr ClearBackingStore */
X NoopDDA, /* void DrawGuarantee */
X/* Font procedures */
X ibm8514RealizeFont, /* Bool (* RealizeFont)() */
X ibm8514UnrealizeFont, /* Bool (* UnrealizeFont)() */
X/* Cursor Procedures */
X OS_ConstrainCursor, /* void (* ConstrainCursor)() */
X OS_CursorLimits, /* void (* CursorLimits)() */
X ibm8514DisplayCursor, /* Bool (* DisplayCursor)() */
X ibm8514RealizeCursor, /* Bool (* RealizeCursor)() */
X ibm8514UnrealizeCursor, /* Bool (* UnrealizeCursor)() */
X miRecolorCursor, /* void (* RecolorCursor)() */
X OS_SetCursorPosition, /* Bool (* SetCursorPosition)() */
X/* GC procedures */
X ppcCreateGC, /* Bool (* CreateGC)() */
X/* Colormap procedures */
X ppcCreateColormapNoop, /* void (* CreateColormap)() */
X NoopDDA, /* void (* DestroyColormap)() */
X ppcInstallColormap, /* void (* InstallColormap)() */
X ppcUninstallColormap, /* void (* UninstallColormap)() */
X ppcListInstalledColormaps, /* int (* ListInstalledColormaps) () */
X ppcStoreColors, /* void (* StoreColors)() */
X ppcResolveColor, /* void (* ResolveColor)() */
X/* Region procedures */
X miRegionCreate, /* RegionPtr (* RegionCreate)() */
X miRegionInit, /* void (* RegionInit)() */
X miRegionCopy, /* Bool (* RegionCopy)() */
X miRegionDestroy, /* void (* RegionDestroy)() */
X miRegionUninit, /* void (* RegionUninit)() */
X miIntersect, /* int (* Intersect)() */
X miUnion, /* int (* Union)() */
X miSubtract, /* int (* Subtract)() */
X miInverse, /* int (* Inverse)() */
X miRegionReset, /* void (* RegionReset)() */
X miTranslateRegion, /* void (* TranslateRegion)() */
X miRectIn, /* int (* RectIn)() */
X miPointInRegion, /* Bool (* PointInRegion)() */
X miRegionNotEmpty, /* Bool (* RegionNotEmpty)() */
X miRegionEmpty, /* void (* RegionEmpty)() */
X miRegionExtents, /* BoxPtr (*RegionExtents)() */
X miRegionAppend, /* BoxPtr (*RegionAppend)() */
X miRegionValidate, /* BoxPtr (*RegionValidate)() */
X mfbPixmapToRegion, /* BoxPtr (*BitmapToRegion)() */
X miRectsToRegion, /* BoxPtr (*RectsToRegion)() */
X miSendGraphicsExpose, /* void (*SendGraphicsExpose)() */
X/* os layer procedures */
X OS_BlockHandler, /* void (* BlockHandler)() */
X OS_WakeupHandler, /* void (* WakeupHandler)() */
X (pointer) 0, /* pointer blockData */
X (pointer) 0, /* pointer wakeupData */
X 0 /* DevUnion */
X} ;
END-of-ibm8514/brcData.c
exit
Technical Details
Message-ID:
<4472@ibmpa.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!ibmpa!dolphin.tcspa.ibm.com!mlewisShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!ibmpa!dolphin.tcspa.ibm.com!mlewis From: mlewis@dolphin.tcspa.ibm.com (Mark S. Lewis) Newsgroups: comp.sys.ibm.pc.rt Subject: IBM 8514 source code (part 2 of 6) for X11 Release 4 Keywords: V1.32_kit.2 8514 X11R4 Message-ID: <4472@ibmpa.UUCP> Date: 12 Mar 90 23:16:55 GMT Sender: news@ibmpa.UUCP Reply-To: mlewis@ibmsupt.UUCP Followup-To: comp.sys.ibm.pc.rt Organization: IBM AWD, Palo Alto Lines: 2319