[Lazarus] TAChart: double-buffering (issue 0012377) questions
Mattias Gaertner
nc-gaertnma at netcologne.de
Sat Dec 13 00:57:18 CET 2008
On Fri, 12 Dec 2008 19:38:55 +1000
"Alexander Klenin" <klenin at gmail.com> wrote:
> In issue http://bugs.freepascal.org/view.php?id=12377, reporter said:
>
> > Painting to an Bitmap and paint this on the Canvas would be much
> > faster
>
> This assertion is, of course, incorrect. I assume that the reporter's
> problem is actually that the TChart flickers when repainted.
>
> The flickering is caused by two sources:
> 1) The TChart is TGraphicControl, so Parent control erases chart's
> background before every repaint.
> 2) TChart itself draws directly to screen, first clearing the canvas.
>
> First source obviously needs fixing, and I attached to the issue a
> patch which fixes it.
> The only caveat is that TChart is now TWinControl -- can it lead to
> some undesirable consequences I am not aware of?
All direct TWinControl descendants must be implemented in all
widgetsets.
You can use TCustomControl.
> The second source can also easily be fixed by double-buffering, but
> before I do that,
> I have two questions:
> 1) TWinControl.WMPaint already contains double-buffering code, but it
> is protected
> by {$ifdef BUFFERED_WMPAINT}. What is the reason of this? Is there
> some ongoing work to implement double-buffering globally?
It was an idea to implement double buffering, but it does not work on
all platforms. Gladfully most widgetsets have double buffering
themselves.
> 2) If double-buffering will be implemented in TAChart itself, it will
> have some negative
> performance impact. So, should I make it optional via DoubleBuffer
> property?
Please try first TCustomControl.
Mattias
More information about the Lazarus
mailing list