[Lazarus] Fast drawing to canvas

dhkblaszyk at zeelandnet.nl dhkblaszyk at zeelandnet.nl
Thu Feb 9 12:48:48 CET 2012


  

Hi Graeme, 

1500fps is massively impressive. Unfortunately I'm
behind a firewall atm, but as soon as I can I will upload my test
project. It shows the different methods proposed by everyone and
actually times them as well. The size I have been testing on is 50%HD ie
960x540 and HD. The footage will also be uploaded to SVN. 

The 11fps is
indeed too low and there must be something wrong. I would have expected
(hoped for) something like 30fps for full HD at least. 

Regards, Darius


On 9 feb '12, Graeme Geldenhuys wrote: 

> On 9 February 2012 02:52,
Darius Blaszyk wrote:
> 
>> Despite all the advices, none of the
suggestions of drawing on a TPaintBox or creating a TCustomControl
actually speed up the painting significantly. Therefore I did some
profiling. It appears that loading a 40kb png file (50% HD) from a
stream takes about 60msec another 30msec is used to paint the bitmap to
screen. It all results in approx. 11fps which is actually pretty poor
when you imagine a full HD loop will make the rate drop 2.5fps.
> 
> A
quick test on my system, using my own "animation" images.
> 
> * using
the fpGUI toolkit
> * Each BMP image is 140kb (fpGUI doesn't have PNG
support yet)
> * each image is loaded one-by-one. No images are
cached.
> * just before a new image is loaded, the old image is freed.
>
* Partition has the ReiserFS filesystem under Linux 64-bit
> * hard
drive is an avg Seagate 250GB sata drive.
> 
> Initial framerate was
1500 fps. I couldn't actually see any animation
> at that speed, and had
to add writeln(i) statements to make sure I am
> loading all images -
which it did. :-)
> 
> I then added a sleep (10) between each image
load/paint job. Animation
> was now visible to the eye and running at
92fps. Having a sleep(1)
> gives me 577fps.
> 
> I don't know what
resolution your images are, so I simply used the
> 40kb file size you
mentioned as the bare minimum. I took a screenshot
> of my desktop and
resized the image and saved it to PNG until I got +-
> a 40kb file. I
then created a 26 frame animation using that image an
> the background.
I then converted those images to BMP, so fpGUI could
> read them. PNG to
BMP made the images go from 40kb to 140kb in size.
> 
> I'll wait for
your sample images before I take another look. But from
> my initial
testing, there is something seriously screwy in your case
> to get only
11fps. I can't imagine loading a 40kb PNG vs a 140kb BMP
> can make up
that a huge difference in framerate.

  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120209/8e7157f8/attachment-0003.html>


More information about the Lazarus mailing list