On Feb 16, 2006, at 8:32 AM, Tom Buchler wrote:

I am now flicker free. Some of the built-in controls don't redraw until I stop waving a window in front of my app, but the app doesn't flicker.

One thing I notice is that the app is consuming huge amounts of CPU cycles when doing the DrawPicture. If I open Windows Task Manager, and wave it in front of my canvas, I immediately go to 100% CPU utilization on an AMD 64 3200. The same thing happens when I wave the Task Manager window in front of the RB IDE. I'm coming off Delphi development, and in contrast, waving the Task Manager window in front of my Delphi app (whose main window is mostly a large canvas with hundreds of drawn elements), I barely reach 10-20% CPU utilization -- and in Delphi, I did not have to double-buffer the canvas -- nothing flickers, and no trails of the waving window are apparent.

Very interesting...

This is one area where I have been unable to control with the BufferedCanvas subclass. There is no way (that I know of) to short- circuit drawing when the Framework/OS calls Refresh(); and if your drawing is complex you *will* get flicker.

The only method I found to reduce redundant drawing is to offload the background-buffer drawing to a thread and checking for a stopThread flag within the drawing (this was before the Thread.Kill() method was available). This might reduce the CPU requirements, or at least update the window with the new drawn content, but I have found that it could have it's own set of disadvantages. For example, with Font Safari it would sometimes take up to 2 seconds to render a character set without threading but with threading it would sometimes take up to 4 seconds to render. But short-circuiting the drawing allowed partial drawing to be displayed as the user quickly looped through fonts, giving the *appearance* of more efficient updates.

You might also be able to reduce the CPU time if you incorporate a "needsRedraw" flag, which would scrap the buffer force a complete redraw... otherwise if needsRedraw is False, then just DrawPicture the buffer. This complicates the drawing code but can be worthwhile (and what was done for Font Safari).

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to