/****************************/
/*        WINDOWS           */
/* (c)2002 Pangea Software  */
/* By Brian Greenstone      */
/****************************/


/***************/
/* EXTERNALS   */
/***************/



/****************************/
/*    CONSTANTS             */
/****************************/


/**********************/
/*     VARIABLES      */
/**********************/



/*********************** DUMP GWORLD **********************/
//
//    Assumes that GWorld's PixMap has already been Locked
//   

void DumpGWorld(GWorldPtr thisWorld, WindowPtr thisWindow, short copyMode)
{
GrafPtr		oldPort,thisPort;
PixMapHandle pm;
Rect		srcRect,destRect;
		
		
	GetPort(&oldPort);
	pm = GetGWorldPixMap(thisWorld);	
	if ((pm == nil) || (*pm == nil))
		DoFatalAlert("\pDumpGWorld: PixMap Handle or Ptr = Null?!");

	thisPort = GetWindowPort(thisWindow);
	SetPort(thisPort);
			
	ForeColor(blackColor);
	BackColor(whiteColor);
		
	GetPortBounds(thisPort, &destRect);
	GetPortBounds(thisWorld, &srcRect);
		
	CopyBits((BitMap *)*pm,GetPortBitMapForCopyBits(thisPort),
			&srcRect,&destRect,copyMode,0);

	SetPort(oldPort);

			/* MAKE OS X SHOW US THE WINDOW */
				
	QDFlushPortBuffer(thisPort, nil);	
//	WaitNextEvent(everyEvent,&gTheEvent, 0, nil);			// gotta do this on OS X since the windows are double-buffered and they don't get updated until this call!
	
}




/******************* DO LOCK PIXELS **************/

void DoLockPixels(GWorldPtr world)
{
PixMapHandle pm;
	
	pm = GetGWorldPixMap(world);
	if (LockPixels(pm) == FALSE)
		DoFatalAlert("\pPixMap Went Bye,Bye?!");
}


/***************** DO UNLOCK PIXELS **************/

void DoUnlockPixels(GWorldPtr world)
{
	PixMapHandle pm;
	
		pm = GetGWorldPixMap(world);
		UnlockPixels(pm);
}











