Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2020-01

Unneeded Paint calls from LCL

7 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

AlexeyT

ATSynEdit has such debug define
//{$define debug_show_fps}
I enabled it to see why editor shows 20-30ms (Form1.OnShow with editor).

a) editor shows 5 (repaint counter) on show. i put breakpoint in TATSynEdit.DoPaintEx and saw that unneeded paints were from DoOnResize() before calling Paint(). ok, i added flag FPaintStarted and filtered them. b) editor still shows 3 (repaint counter) on show. breakpoint shows that Paint is called 3 times by LCL. I cannot filter these you reduce these calls?

Regards, Alexey

Reply by email

AlexeyT
to AlexeyT: ATSynEdit has such debug define //{$define debug_show_fps} I enabled it to see why editor…

Details:
Linux gtk2: LCL calls Paint 5 times for ATSynEdit on FormCreate/FormShow:

1- DoOnResize - i filtered it out
2- DoOnResize - i filtered it out
3- Paint - it's ok
4- Paint again - i cannot filter it out
5- Paint again

Win32: LCL calls Paint 3 times:

1- Paint - it's ok
2- DoOnResize - i cannot filter it out
3- DoOnResize again

Can you optimize it to call Paint once, and DoOnResize BEFORE Paint?

Alexey T.

Reply by email

Marc Weustink
to AlexeyT
AlexeyT wrote 16 lines
Details: Linux gtk2: LCL calls Paint 5 times for ATSynEdit on FormCreate/FormShow: 1- DoOnResize - i filtered it out 2- DoOnResize - i filtered it out 3- Paint - it's ok 4- Paint again - i cannot filter it out 5- Paint again Win32: LCL calls Paint 3 times: 1- Paint - it's ok 2- DoOnResize - i cannot filter it out 3- DoOnResize again Can you optimize it to call Paint once, and DoOnResize BEFORE Paint?

IMO paint should be never called directly. When resizing, invalidate should be called (so one pain message is issued after the resize)

Marc

Reply by email

Juha Manninen
to Marc Weustink
AM Marc Weustink wrote
IMO paint should be never called directly. When resizing, invalidate should be called (so one pain message is issued after the resize)

I understood that Paint gets called by LCL excessively when a form is created or shown. Yes, I guess it should be optimized. Debugging the events flowing back and forth is challenging. Placing DebugLn() lines into relevant event handlers is the best way. And yes, it partly happens in widgetset code.

Juha

Reply by email

Martin Frb
to Juha Manninen
Juha Manninen wrote 6 lines
I understood that Paint gets called by LCL excessively when a form is created or shown. Yes, I guess it should be optimized. Debugging the events flowing back and forth is challenging. Placing DebugLn() lines into relevant event handlers is the best way. And yes, it partly happens in widgetset code.

It should be possible to use "none breaking" breakpoints (without causing extra paint or focus events) and then go through the debug history to see stackframes.

Reply by email

Alexey
to Martin Frb

Seems I posted too pessimistic analysis. Too many repaints are caused by atsynedit, and with an empty control (which only has overridden Paint to show counter) it’s not so bad— counter is 1, only on few WS it’s 2. Sorry

Alexey

Reply by email