Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

92 lines
2.5 KiB

/**************************************************************************
* *
* Copyright (C) 1992, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/*
* trimregion.c++ - $Revision: 1.2 $
* Derrick Burns - 1991
*/
#include "glimport.h"
#include "myassert.h"
#include "mystdio.h"
#include "trimregi.h"
#include "backend.h"
TrimRegion::TrimRegion( void )
{
}
void
TrimRegion::setDu( REAL du )
{
oneOverDu = 1.0/du;
}
void
TrimRegion::init( long npts, Arc_ptr extrema )
{
left.init( npts, extrema, extrema->pwlArc->npts - 1 );
left.getNextPt();
right.init( npts, extrema, 0 );
right.getPrevPt();
}
void
TrimRegion::getPts( Arc_ptr extrema )
{
left.getNextPts( extrema );
right.getPrevPts( extrema );
}
void
TrimRegion::getPts( Backend &backend )
{
left.getNextPts( bot.vval, backend );
right.getPrevPts( bot.vval, backend );
}
void
TrimRegion::getGridExtent( void )
{
getGridExtent( left.last(), right.last() );
}
void
TrimRegion::getGridExtent( TrimVertex *l, TrimVertex *r )
{
bot.ustart = (long) ((l->param[0] - uarray.uarray[0])*oneOverDu);
if( l->param[0] >= uarray.uarray[bot.ustart] ) bot.ustart++;
// if( l->param[0] > uarray.uarray[bot.ustart] ) bot.ustart++;
assert( l->param[0] <= uarray.uarray[bot.ustart] );
assert( l->param[0] >= uarray.uarray[bot.ustart-1] );
bot.uend = (long) ((r->param[0] - uarray.uarray[0])*oneOverDu);
if( uarray.uarray[bot.uend] >= r->param[0] ) bot.uend--;
// if( uarray.uarray[bot.uend] > r->param[0] ) bot.uend--;
assert( r->param[0] >= uarray.uarray[bot.uend] );
assert( r->param[0] <= uarray.uarray[bot.uend+1] );
}
int
TrimRegion::canTile( void )
{
TrimVertex *lf = left.first();
TrimVertex *ll = left.last();
TrimVertex *l = ( ll->param[0] > lf->param[0] ) ? ll : lf;
TrimVertex *rf = right.first();
TrimVertex *rl = right.last();
TrimVertex *r = ( rl->param[0] < rf->param[0] ) ? rl : rf;
return (l->param[0] <= r->param[0]) ? 1 : 0;
}