Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why scrolling a TListView calls for an entire form repaint - Delphi Firemonkey

Starting with a blank mobile app, I added a TlistView, a TCircle, and a TMemo. None of the controls had any alignment other than the default and they are all direct children of the main form.

In the OnPaint event of the ListView, I put this:

Memo1.Lines.Add('ListView paint'), 

For the circle OnPaint:

Memo1.Lines.Add('Circle paint');

When I ran the app the results were that scrolling the listview resulted in lots of "Listview paint" and "Circle paint" getting added to the memo, both items always getting added at the same time. Why does scrolling a listview (or scrolling the memo) call an entire form repaint?

There's a line in the call stack that makes me think the entire form is getting repainted:

Fmx.Platform.Ios.TFMXView3D.drawRect(0x14659ec0,{origin = {x = 0, y = 0}, size = {width = 768, height = 1024}})

I'm want to know if this is supposed to be happening or not. This is causing poor performance in a listivew I have because a chart is constantly getting repainted.

like image 456
Sentient Avatar asked Dec 02 '25 01:12

Sentient


1 Answers

Judging by the comments this appears to be a issue with Firemonkey, however it has been specified as by design. From the QC issue

GPU Canvas in FireMonkey that is used on mobile platforms always repaints the entire form, which is by design.

As a workaround, there is TRasterEffect, which can be dropped on the form and parented to one of the controls. If done so, the control will be rendered to internal image first and then such image will be drawn, alleviating the problem.

like image 195
Toby Allen Avatar answered Dec 04 '25 01:12

Toby Allen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!