[Lazarus] Optimize DBGrid speed

Petr Kristan petr.kristan at epos.cz
Wed Jan 8 17:55:19 CET 2014

On Wed, Jan 08, 2014 at 02:35:08PM +0100, Hans-Peter Diettrich wrote:
> Petr Kristan schrieb:
> >In the beginning of Grid paint is Canvas.GetClipRect called to obtain area
> >which wee must redraw. This function directly calls WidgetSet.GetClipBox.
> >I find out difference betwen Win32 and gtk2 bahaviour of this func.
> >
> >In gtk2 TGtk2WidgetSet.GetClipBox returns previously Invalidated area
> >(through DC.PaintRectangle = PS.rcPaint retrieved in BeginPaint)
> >
> >But in win32 directly calls Windows.GetClipBox, but this func returns
> >whole grid area. Do not takes account on invalidated area retrieved in
> >BeginPaint.
> It may be a bug in the Win32 widgetset, invalidating the entire
> control area instead of only the affected cell, *or* some special
> handling of invalidated areas by Windows. I remember that Windows
> used to extend the UpdateRect to include *all* invalidated parts of
> the DC. This can lead to a big update area, when a single bit at the
> top left and at the bottom right of the DC was invalidated. This may
> have changed in the meantime, though.

My idea was wrong, I overlook something in debug logs.
Canvas.GetClipRect returns correct value.
Problem must be in another place.
First Paint has correct update rect, but then second Paint is called
on whole grid.


Petr Kristan
EPOS PRO s.r.o., Smilova 333, 530 02 Pardubice
tel: +420 461101401    Czech Republic (Eastern Europe)
fax: +420 461101481

More information about the Lazarus mailing list