under android with delphi, I have a background thread. in this background thread i call a procedure in synchronize that just do a repaint:
TThread.Synchronize(nil,
procedure
begin
repaint;
end);
to resume you the delphi source code, under android repaint simply put a bool to true saying to the main looper to repaint the form on next loop :
procedure TPlatformAndroid.InvalidateWindowRect(const AForm: TCommonCustomForm; R: TRectF);
begin
TAndroidWindowHandle(AForm.Handle).NeedsUpdate := True;
end;
I have also a mousemove event on my form in with i catch the mouse move and where i also call repaint
procedure TMyFrame.FrameMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Single);
begin
VPos := Y;
repaint;
end;
What i absolutely not understand now, is why this repaint (in the background thread) cause some jerks in the animation if (and only if) i also move at the same time my finger on the screen (if i do not move the finger then i don’t have jerks)
How this could be possible? because the repaint simply put to true something that was already to true via the mousemove (or vice versa). how this can delay sometime by more than 100 ms the call to the onpaint of my frame (producing jerks). Removing the onpaint from the background thread remove also the jerks … no idea what could be wrong
NOTE:
if in TPlatformAndroid.InternalProcessMessages if i replace
if TWindowManager.Current.RenderIfNeeds then
HasEvents := True
by
TWindowManager.Current.RenderImmediately;
HasEvents := True;
then the lag disappears a lot (but not completely)