Re: DotView.m
Re: DotView.m
- Subject: Re: DotView.m
- From: "Kenneth C. Dyke" <email@hidden>
- Date: Wed, 7 Nov 2001 10:04:48 -0800
On Wednesday, November 7, 2001, at 05:23 AM, Graeme Phillipson wrote:
Hello,
On Wednesday, November 7, 2001, at 01:08 PM, John C. Randolph wrote:
Double-buffering is a property of the Window, not the View, and it's
orthogonal to why you shouldn't call -drawRect:.
-jcr
Surely (as I understand double buffering) there are three step, create
offscreen buffer, draw in it, flip the buffer onto the screen. Possibly
all drawing actions could go into a offscreen buffer thats there for
the window all the time, but unless the framework knows that your done
drawing (i.e. you just returned from the drawRect method that was
called by the event loop after setNeedsDisply:YES) surely it wouldn't
know to flip the buffer onto the screen?
On Mac OS X, all windows (aside from Classic) are effectively already an
offscreen buffer, so there is no need to create an extra offscreen
buffer any time you draw. All 2D drawing goes into the window's backing
store (offscreen buffer) and then the dirty bits are flushed to the
screen when the window's -flushWindow method is called.
There is code in the frameworks to keep track of when the window has
been drawn into so that any time the event loop runs windows that are
dirty are automatically flushed to the screen. There are methods in
AppKit to turn off the automatic flush behaviour, but usually this isn't
needed.
Without buffered windows, much of the Aqua UI (dropshadows,
transparency, etc) simply wouldn't be able to work correctly. It also
means that the window server never has to wake up an app to redraw it's
UI.
-Ken
Kenneth Dyke, email@hidden (personal), email@hidden (work)
Sr. Mad Scientist, MacOS X OpenGL Group, Apple Computer, Inc.
C++ is to C as Lung Cancer is to Lung
References: | |
| >Re: DotView.m (From: Graeme Phillipson <email@hidden>) |