Exemple #1
0
void
TkMacOSXFlushWindows ()
{
    WindowRef wRef = GetWindowList();
    
    while (wRef) {
        CGrafPtr portPtr = GetWindowPort(wRef);
        if (QDIsPortBuffered(portPtr)) {
            QDFlushPortBuffer(portPtr, NULL);
        }
        wRef = GetNextWindow(wRef);
    }
}
Exemple #2
0
static void ROM_WindowUpdate(_THIS, int numrects, SDL_Rect *rects)
{
	GWorldPtr memworld;
	GrafPtr saveport;
	CGrafPtr thePort;
	const BitMap *memBits;
	const BitMap *winBits;
	int i;
	Rect update;
	
	/* Copy from the offscreen GWorld to the window port */
	GetPort(&saveport);
	SetPortWindowPort(SDL_Window);
	thePort = GetWindowPort(SDL_Window);
	memworld = (GWorldPtr)GetWRefCon(SDL_Window);
#if TARGET_API_MAC_CARBON && ACCESSOR_CALLS_ARE_FUNCTIONS
	memBits = GetPortBitMapForCopyBits((CGrafPtr) memworld);
#else
	memBits = &((GrafPtr)memworld)->portBits;
#endif
#if TARGET_API_MAC_CARBON && ACCESSOR_CALLS_ARE_FUNCTIONS
	winBits = GetPortBitMapForCopyBits(thePort);
#else
	winBits = &SDL_Window->portBits;
#endif
	for ( i=0; i<numrects; ++i ) {
		update.left = rects[i].x;
		update.right = rects[i].x+rects[i].w;
		update.top = rects[i].y;
		update.bottom = rects[i].y+rects[i].h;
		CopyBits(memBits, winBits,
			 &update, &update, srcCopy, nil);
	}
#if TARGET_API_MAC_CARBON
	if ( QDIsPortBuffered(thePort) ) {
		QDFlushPortBuffer(thePort, NULL);
	}
#endif
	SetPort(saveport);
}
static pascal void MyTimerHandler( EventLoopTimerRef inTimer, void *inUserData )
{
    CGrafPtr            currentPort;
    Rect                currentPortRect;
    RgnHandle           flushRegion;

    SetPortWindowPort( (WindowRef) inUserData );

    //  Call the plug-in function "drawBall" which is defined in the plug-in interface.

    (*gDrawBallInterface)->drawBall( gDrawBallInterface );

    //  We are not drawing in response to an update or draw event, so if the window is buffered
    //  (i.e. on Mac OS X) we need to flush the content to be drawn in the window.

    GetPort( &currentPort );
    if( QDIsPortBuffered( currentPort ) ) {
    	GetPortBounds( currentPort, &currentPortRect );
    	flushRegion = NewRgn();
    	RectRgn( flushRegion, &currentPortRect );
        QDFlushPortBuffer( currentPort, flushRegion );
        DisposeRgn( flushRegion );
    }
}