[Lazarus] Gtk2 ExtTextOut internal helper is slow

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Gtk2 ExtTextOut internal helper is slow

Free Pascal - Lazarus mailing list
gtk2devicecontext.inc
procedure SetLayoutText(ALayout: PPangoLayout; AText: PChar; ALength:
PtrInt);
var
   OldStr: PChar;
begin
   OldStr := pango_layout_get_text(ALayout);
   if (strlen(OldStr)<>ALength) or (strlcomp(AText, OldStr, ALength) <>
0) then
     pango_layout_set_text(ALayout, AText, ALength);
end;

as you see it's slow
a) get oldstr
b) compare oldstr by 2 funcs
why this cache is needed?
to call ExtTextOut() 20 times with the same x/y/s ?
so I suggest to del checks - just call pango_layout_set_text and that's it.

Alexey Torgashin

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Gtk2 ExtTextOut internal helper is slow

Free Pascal - Lazarus mailing list
On 11/06/2020 16:20, Alexey Tor. via lazarus wrote:
>
> to call ExtTextOut() 20 times with the same x/y/s ?
> so I suggest to del checks - just call pango_layout_set_text and
> that's it.
I do not know if this is related.

But test your changes with Synedit extra-char-width.

You can set the extra char width to 1 (or greater) in the IDE for the
source editor. Make sure that works.
Also test with Japanese double width chars in SynEdit. アkj (randomly
typed, no idea if or what it means)
And maybe Arabic right to left script. (checking that the caret works,
and text is stable while selection is changed char by char)


--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus