Not quite understanding buffered DCs

Jeffrey Barish jeff_barish at earthlink.net
Sun Dec 24 12:45:41 PST 2006


I understand the principle behind buffered DCs: A buffered DC reduces
flicker by accumulating the effects of many draw commands before blitting
the final result to the screen in one operation.  In Listing 6.1 of the
book, there is a buffered DC for DrawLines and another for drawMotion to
accumulate the effect of many DrawLine commands.  But doesn't the actual
drawing to the screen occur in OnPaint?  Isn't the drawing of individual
elements already done by the time we get here?  I'm thinking that the
individual elements have already been rendered into the bitmap buffer, so
the only thing that needs to happen in OnPaint is a blit of the bitmap to
the screen.  No flicker there because everything gets drawn to the screen
in one operation.  I am thinking that the bitmap buffer provides the
necessary buffering.  Maybe I am confused about what the bitmap buffer
does.

Moreover, it seems as if we don't really need a BufferedPaintDC in OnPaint,
aside from the convenience of not having to spell out the blit operation,
again because the screen update happens as the result of one blit
operation.

I can see a use for BufferedPaintDC in a program where all the drawing takes
place in OnPaint.  Without the buffering, individual elements would appear
sequentially.  But if the drawing is already done by the time we get to
OnPaint, isn't the buffering superfluous?
-- 
Jeffrey Barish





More information about the wxpython-users mailing list