[Gambas-user] [Gambas Bug Tracker] Bug #765: form/window about gambas using a lot of CPU resources, when displaying authors

bugtracker at ...3416... bugtracker at ...3416...
Mon Sep 28 17:00:53 CEST 2015


http://gambaswiki.org/bugtracker/edit?object=BUG.765&from=L21haW4-

Comment #14 by Benoît MINISINI:

I did a cache. That said, I said nothing as when you want to speed up things, you always make a cache...

It was slow because the contents was rich text redrawn at each frame. And drawing rich text is very very slow.

So I created three images (the cache). Each image has the height of the drawing area, and is filled with successive parts
of the contents.

When scrolling, the two first images are used for drawing the contents. When the scroll reaches the end of the
second image, the third image is filled with the next part of the contents, and the images are rotates (the second image
becomes the first, the third becomes the second, and the first becomes the last).

That way, for one cycle of scrolling, the contents is drawn once, and not many times.

The contents is based on a GridView, and is picked up by an hack, i.e. calling the hidden drawing event handler of the control.
Thanks to the Paint class that does not care with its target device.

If it's not clear, read the source code.






More information about the User mailing list