src/sgp/VObject_Blitters.cc
CHAR8 BltIsClippedOrOffScreen( HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion )
{
	INT32  ClipX1, ClipY1, ClipX2, ClipY2;

	// Assertions
	Assert( hSrcVObject != NULL );

	// Get Offsets from Index into structure
	ETRLEObject const& pTrav = hSrcVObject->SubregionProperties(usIndex);
	UINT32      const  usHeight = pTrav.usHeight;
	UINT32      const  usWidth  = pTrav.usWidth;

	// Add to start position of dest buffer
	INT32 const iTempX = iX + pTrav.sOffsetX;
	INT32 const iTempY = iY + pTrav.sOffsetY;

	if(clipregion==NULL)
	{
		ClipX1=ClippingRect.iLeft;
		ClipY1=ClippingRect.iTop;
		ClipX2=ClippingRect.iRight;
		ClipY2=ClippingRect.iBottom;
	}
	else
	{
		ClipX1=clipregion->iLeft;
		ClipY1=clipregion->iTop;
		ClipX2=clipregion->iRight;
		ClipY2=clipregion->iBottom;
	}


	// Calculate rows hanging off each side of the screen
	INT32 gLeftSkip   = __min(ClipX1 -   MIN(ClipX1, iTempX), (INT32)usWidth);
	INT32 gTopSkip    = __min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight);
	INT32 gRightSkip  = __min(  MAX(ClipX2, iTempX + (INT32)usWidth)  - ClipX2, (INT32)usWidth);
	INT32 gBottomSkip = __min(__max(ClipY2, iTempY + (INT32)usHeight) - ClipY2, (INT32)usHeight);

	// check if whole thing is clipped
	if((gLeftSkip >=(INT32)usWidth) || (gRightSkip >=(INT32)usWidth))
		return(-1 );

	// check if whole thing is clipped
	if((gTopSkip >=(INT32)usHeight) || (gBottomSkip >=(INT32)usHeight))
		return(-1 );


	if ( gLeftSkip )
		return( TRUE );

	if ( gRightSkip )
		return( TRUE );

	if ( gTopSkip )
		return( TRUE );

	if ( gBottomSkip )
		return( TRUE );


	return(FALSE);
}
/**********************************************************************************************
BltIsClippedOrOffScreen

	Determines whether a given blit will need clipping or not. Returns TRUE/FALSE.

**********************************************************************************************/
BltIsClippedOrOffScreen
Determines whether a given blit will need clipping or not. Returns TRUE/FALSE.
BltIsClippedOrOffScreen Determines whether a given blit will need clipping or not . Returns TRUE / FALSE .
CHAR8 BltIsClippedOrOffScreen( HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion )
{
	INT32  ClipX1, ClipY1, ClipX2, ClipY2;
	Assert( hSrcVObject != NULL );
	ETRLEObject const& pTrav = hSrcVObject->SubregionProperties(usIndex);
	UINT32      const  usHeight = pTrav.usHeight;
	UINT32      const  usWidth  = pTrav.usWidth;
	INT32 const iTempX = iX + pTrav.sOffsetX;
	INT32 const iTempY = iY + pTrav.sOffsetY;
	if(clipregion==NULL)
	{
		ClipX1=ClippingRect.iLeft;
		ClipY1=ClippingRect.iTop;
		ClipX2=ClippingRect.iRight;
		ClipY2=ClippingRect.iBottom;
	}
	else
	{
		ClipX1=clipregion->iLeft;
		ClipY1=clipregion->iTop;
		ClipX2=clipregion->iRight;
		ClipY2=clipregion->iBottom;
	}
	INT32 gLeftSkip   = __min(ClipX1 -   MIN(ClipX1, iTempX), (INT32)usWidth);
	INT32 gTopSkip    = __min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight);
	INT32 gRightSkip  = __min(  MAX(ClipX2, iTempX + (INT32)usWidth)  - ClipX2, (INT32)usWidth);
	INT32 gBottomSkip = __min(__max(ClipY2, iTempY + (INT32)usHeight) - ClipY2, (INT32)usHeight);
	if((gLeftSkip >=(INT32)usWidth) || (gRightSkip >=(INT32)usWidth))
		return(-1 );
	if((gTopSkip >=(INT32)usHeight) || (gBottomSkip >=(INT32)usHeight))
		return(-1 );
	if ( gLeftSkip )
		return( TRUE );
	if ( gRightSkip )
		return( TRUE );
	if ( gTopSkip )
		return( TRUE );
	if ( gBottomSkip )
		return( TRUE );
	return(FALSE);
}
CHAR8 BltIsClippedOrOffScreen ( HVOBJECT hSrcVObject , INT32 iX , INT32 iY , UINT16 usIndex , SGPRect * clipregion ) { INT32 ClipX1 , ClipY1 , ClipX2 , ClipY2 ; Assert ( hSrcVObject != NULL ) ; ETRLEObject const & pTrav = hSrcVObject -> SubregionProperties ( usIndex ) ; UINT32 const usHeight = pTrav . usHeight ; UINT32 const usWidth = pTrav . usWidth ; INT32 const iTempX = iX + pTrav . sOffsetX ; INT32 const iTempY = iY + pTrav . sOffsetY ; if ( clipregion == NULL ) { ClipX1 = ClippingRect . iLeft ; ClipY1 = ClippingRect . iTop ; ClipX2 = ClippingRect . iRight ; ClipY2 = ClippingRect . iBottom ; } else { ClipX1 = clipregion -> iLeft ; ClipY1 = clipregion -> iTop ; ClipX2 = clipregion -> iRight ; ClipY2 = clipregion -> iBottom ; } INT32 gLeftSkip = __min ( ClipX1 - MIN ( ClipX1 , iTempX ) , ( INT32 ) usWidth ) ; INT32 gTopSkip = __min ( ClipY1 - __min ( ClipY1 , iTempY ) , ( INT32 ) usHeight ) ; INT32 gRightSkip = __min ( MAX ( ClipX2 , iTempX + ( INT32 ) usWidth ) - ClipX2 , ( INT32 ) usWidth ) ; INT32 gBottomSkip = __min ( __max ( ClipY2 , iTempY + ( INT32 ) usHeight ) - ClipY2 , ( INT32 ) usHeight ) ; if ( ( gLeftSkip >= ( INT32 ) usWidth ) || ( gRightSkip >= ( INT32 ) usWidth ) ) return ( -1 ) ; if ( ( gTopSkip >= ( INT32 ) usHeight ) || ( gBottomSkip >= ( INT32 ) usHeight ) ) return ( -1 ) ; if ( gLeftSkip ) return ( TRUE ) ; if ( gRightSkip ) return ( TRUE ) ; if ( gTopSkip ) return ( TRUE ) ; if ( gBottomSkip ) return ( TRUE ) ; return ( FALSE ) ; }
BltIsClippedOrOffScreen
Determines whether a given blit will need clipping or not.
BltIsClippedOrOffScreen Determines whether a given blit will need clipping or not .
// Assertions // Get Offsets from Index into structure // Add to start position of dest buffer // Calculate rows hanging off each side of the screen // check if whole thing is clipped // check if whole thing is clipped