< Previous PageNext Page > Hide TOC

Carbon and Mac OS X Graphics

All drawing into windows in Mac OS X is double-buffered unless you explicitly request otherwise. When you draw content into the graphics port (GrafPort) of a window, you are actually drawing into the offscreen drawing buffer associated with the window. The content being drawn does not appear onscreen until QDFlushPortBuffer is called.

The Carbon Event Manager calls QDFlushPortBuffer at the following times:

The buffer is not flushed when QuickDraw drawing routines (such as LineTo, FrameRect, and CopyBits) are called or when controls are drawn. In nearly all cases, there should be no need for your application to flush the port buffer explicitly. Instead, simply let the system flush the buffer at event retrieval time. Flushing the port buffer frequently can significantly impact performance. If you absolutely must flush the buffer explicitly, make sure to coalesce your content drawing operations together and then flush the port buffer once.

The following guidelines detail how you should deal with the performance implications of Mac OS X window buffering:



< Previous PageNext Page > Hide TOC


© 2003, 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-04-04)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.