[Customdrawn] New fast bitmap copying

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Tue Apr 10 12:23:22 CEST 2012


I added a new option to disable the form background manually as
requested in the forum, and so I used it and also changed the
magnifier code to draw in the form OnPaint event instead of inside a
sub-control. The result was a massive speed gain:

[TCDWSCustomForm.DrawRawImageToGC] Paint duration: 61 ms
[TCDWSCustomForm.EvPaint] Total Paint duration: 185 ms of this
CustomDrawn: 185 ms Native: 0
X11 event WM_PAINT - Window 85983234, Delay 1 ms

The speed was gained mostly by drawing to the canvas directly instead
of first to the bitmap.

But using LCL-Gtk2 now the drawing is lightning fast. I didn't measure
it, but it is extremely fast! Probably 20 to 30 FPS... so we have some
catch up to do =D

I think that reusing the X native image should be something to think
of. In Android I commited a patch which I received to reuse the native
bitmap and things are getting really fast in Android =) The guy said
he is getting 60FPS using LCL-CustomDrawn + Graphics32 in Android!!!
=D My little interface is getting more and more traction and adoption.

I always said that there is no secret solution here, just optimize,
optimize and optimize and the drawing starts flying.

Anyway I guess that now finally I have a good enough speed to be able
to make a Mac OS X release of the VMG with LCL-CustomDrawn =) But
first I have to implement native menu and TTrayIcon support in the
Cocoa backend ... and also check if the native image can be reused in
Mac OS X too.

Felipe Monteiro de Carvalho

More information about the Customdrawn mailing list