[Lazarus] Gtk2 ExtTextOut internal helper is slow

Alexey Tor. aaa5500 at ya.ru
Thu Jun 11 16:20:14 CEST 2020


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



More information about the lazarus mailing list