Hi,
Just for note, I`m actively working on fpGUI base on BGRABitma.
After some day of starting, Today just checked for memory usage and comparing it with fpGUI with native canvas!
WOW
on any invalidating of form, memory increase a lot(about 0.5 MB).
And also I have a problem already, That App hangs on close!
Today I find out why!
On the EasyLazFreeType(Managing glyphs for drawing Text independently
) unit any glyph will add to the AVL_Tree every time! Because of the developer of this Component forgot to set OnCompare of the TAvlTree. This event enables AVLTree to compare and put the new Item on the right position on the tree, So after FindGlyph will work.
I did it, Memory loading gone, Hangs on close gone
...
My Changes:
// ~/lazarus/components/lazutils/easylazfreetype.pas line1441
constructor TFreeTypeFont.Create;
begin
EnsureFreeTypeInitialized;
FFaceLoaded := false;
FFaceItem := nil;
FInstanceCreated := false;
FCharmapOk := false;
FPointSize := 10;
FDPI := 96;
FGlyphTable := TAvlTree.Create;
FGlyphTable.OnCompare := @GlyphTableOnCompare; //What need it is...
And the GlyphTableOnCompare function:
function GlyphTableOnCompare(Item1, Item2: Pointer): Integer;
begin
if TFreeTypeGlyph(Item1).Index = TFreeTypeGlyph(Item2).Index then
Result := 0
else if TFreeTypeGlyph(Item1).Index > TFreeTypeGlyph(Item2).Index then
Result := 1
else if TFreeTypeGlyph(Item1).Index < TFreeTypeGlyph(Item2).Index then
Result := -1;
end;
I did it, But for my knowledge, How I can report these kinds of [improvment/currections]?