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
/
brcPolyPnt.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-10-01
|
5KB
|
179 lines
/*
* $Id: brcPolyPnt.c,v 1.3 1991/10/01 06:56:18 mtranle Exp $
*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation, and that the name of IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
*/
/***********************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#include "X.h"
#include "Xprotostr.h"
#include "misc.h"
#include "gcstruct.h"
#include "windowstr.h"
#include "pixmapstr.h"
#include "colormapst.h"
#include "scrnintstr.h"
#include "regionstr.h"
#include "region.h"
#include "mistruct.h"
#include "OScompiler.h"
#include "ppc.h"
#include "x8514.h"
#include "ibmTrace.h"
extern int mfbGCPrivateIndex;
extern int mergexlate[] ;
extern int ibm8514cursorSemaphore ;
void
ibm8514PolyPoint( pDrawable, pGC, mode, npt, pptInit )
DrawablePtr pDrawable ;
GCPtr pGC ;
int mode ; /* Origin or Previous */
int npt ;
xPoint *pptInit ;
{
int CursorIsSaved;
xPoint *ppt ;
ppcPrivGC *devPriv ;
int nptTmp ;
int (* PointInRegion)();
RegionPtr pRegion ;
BoxRec box ; /* Scratch Space */
TRACE( ("ibm8514PolyPoint(0x%x,0x%x,%d,%d,0x%x)\n",
pDrawable, pGC, mode, npt, pptInit ) ) ;
/* This function only works on WINDOWS use miPolyPoint() on PIXMAP */
devPriv = (ppcPrivGC *) ( pGC->devPrivates[mfbGCPrivateIndex].ptr ) ;
if ( devPriv->colorRrop.alu == GXnoop )
return ;
/* make pointlist origin relative */
if ( mode == CoordModePrevious )
{
for ( ppt = pptInit, nptTmp = npt ; --nptTmp ; )
{
ppt++ ;
ppt->x += (ppt-1)->x ;
ppt->y += (ppt-1)->y ;
}
}
if ( pGC->miTranslate )
{
int xorg = pDrawable->x ;
int yorg = pDrawable->y ;
for ( ppt = pptInit, nptTmp = npt ; nptTmp-- ; ppt++ )
{
ppt->x += xorg ;
ppt->y += yorg ;
}
}
PointInRegion = pDrawable->pScreen->PointInRegion ;
pRegion = devPriv->pCompositeClip ;
if ( (! REGION_NUM_RECTS(pRegion)) || (! npt) )
return ;
if ( npt == 1 )
CursorIsSaved = (!ibm8514cursorSemaphore &&
ibm8514CheckCursor(pptInit->x, pptInit->y, 1, 1));
else
{
int xmin, ymin, xmax, ymax;
xmin = xmax = pptInit->x;
ymin = ymax = pptInit->y;
for (ppt = pptInit + 1, nptTmp = npt - 1; nptTmp ; nptTmp-- ,ppt++)
{
if (xmin > ppt->x)
xmin = ppt->x;
else if (ppt->x > xmax)
xmax = ppt->x;
if (ymin > ppt->y)
ymin = ppt->y;
else if (ppt->y > ymax)
ymax = ppt->y;
}
CursorIsSaved = (!ibm8514cursorSemaphore &&
ibm8514CheckCursor(xmin, ymin, xmax-xmin+1,
ymax-ymin+1));
}
ibm8514ATRNotBusy ;
ibm8514CheckQueue(5) ;
SETFN1(FNCOLOR1, mergexlate[devPriv->colorRrop.alu]) ;
SETCOL1(devPriv->colorRrop.fgPixel) ;
PLNWENBL(devPriv->colorRrop.planemask) ;
SETLY(0) ;
SETLX(0) ;
for ( ppt = pptInit ; npt-- ; ppt++ )
{
if ( (* PointInRegion)( pRegion, ppt->x, ppt->y, &box ) )
{
ibm8514CheckQueue(3) ;
SETY0(ppt->y) ;
SETX0(ppt->x) ;
COMMAND(0x80b3) ; /* Horizontal Rect operation,
DX = DY = 'increasing'*/
}
}
ibm8514ClearQueue(2) ;
PLNWENBL( ibm8514ALLPLANES ) ;
SETFN1(FNCOLOR1, FNREPLACE) ;
if (CursorIsSaved)
ibm8514ReplaceCursor() ;
}