Skip to content

Commit

Permalink
[FMX Render] Fix warning introduced on 7f45095
Browse files Browse the repository at this point in the history
Co-Authored-By: Paulo César Botelho Barbosa <16469061+paulocesarbot@users.noreply.github.com>

#273
  • Loading branch information
viniciusfbb committed Nov 17, 2023
1 parent 7f45095 commit 65df505
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions Source/FMX/FMX.Skia.Canvas.pas
Original file line number Diff line number Diff line change
Expand Up @@ -3187,6 +3187,7 @@ procedure TSkTextLayout.UpdateParagraph;
else
Result.TextAlign := SkTextAlign[HorizontalAlign];
Result.TextStyle := CreateDefaultTextStyle;
// Try to limit max lines to optimize
if Result.MaxLines = High(NativeUInt) then
begin
LMinFontSize := Result.TextStyle.FontSize;
Expand All @@ -3195,12 +3196,8 @@ procedure TSkTextLayout.UpdateParagraph;
if LMinFontSize > 0.1 then
begin
// Avoid invalid float point operation
if MaxSize.Y >= High(NativeUInt) then
AMaxLines := High(NativeUInt)
else
AMaxLines := Trunc(CeilFloat(MaxSize.Y / LMinFontSize));
if AMaxLines > 0 then
Result.MaxLines := AMaxLines;
if MaxSize.Y < High(NativeInt) then
Result.MaxLines := Max(Trunc(CeilFloat(MaxSize.Y / LMinFontSize)), 0);
end;
end;
end;
Expand Down

0 comments on commit 65df505

Please sign in to comment.