Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Correct buffering technique?
Correct buffering technique? [message #10581] Tue, 17 July 2007 17:10 Go to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
I have several ctrls with slow Paint functions that display complex real-time data. Becuase certain actions can cause lots of display refreshes (like dragging a window) I would like to maintain a buffer to reduce CPU load between refreshes:
		if (bufferdirty) {
			buffer.Create(GetView().Size());
			BufferPaint(buffer);
			bufferdirty = false;
		}
		buffer.Put(w, 0, 0);

buffer is a BackDraw object (I was going to use ImageDraw before I saw BackDraw). This seems to work OK, but is this the way to do it?

Cheers,
James

Re: Correct buffering technique? [message #10601 is a reply to message #10581] Wed, 18 July 2007 09:03 Go to previous message
mirek is currently offline  mirek
Messages: 13985
Registered: November 2005
Ultimate Member
mrjt wrote on Tue, 17 July 2007 11:10

I have several ctrls with slow Paint functions that display complex real-time data. Becuase certain actions can cause lots of display refreshes (like dragging a window) I would like to maintain a buffer to reduce CPU load between refreshes:
		if (bufferdirty) {
			buffer.Create(GetView().Size());
			BufferPaint(buffer);
			bufferdirty = false;
		}
		buffer.Put(w, 0, 0);

buffer is a BackDraw object (I was going to use ImageDraw before I saw BackDraw). This seems to work OK, but is this the way to do it?

Cheers,
James




Yes, looks fine to me.

Mirek
Previous Topic: How to Draw into an existing image(buffer) ?
Next Topic: Load truetype font from file?
Goto Forum:
  


Current Time: Sun Jun 16 15:26:31 CEST 2024

Total time taken to generate the page: 0.02569 seconds