LCL: Remove an unused Rect from TCanvas.TextExtent. Suggested by lagprogramming.

This commit is contained in:
Juha 2023-03-11 17:10:32 +02:00
parent e4a334e330
commit 79fadc1fa5

View File

@ -1776,7 +1776,6 @@ end;
function TCanvas.TextExtent(const Text: string): TSize; function TCanvas.TextExtent(const Text: string): TSize;
var var
DCIndex: Integer; DCIndex: Integer;
ARect: TRect;
procedure SaveState; procedure SaveState;
begin begin
@ -1795,17 +1794,13 @@ begin
Result.cY := 0; Result.cY := 0;
if Text='' then exit; if Text='' then exit;
RequiredState([csHandleValid, csFontValid]); RequiredState([csHandleValid, csFontValid]);
DCIndex := 0; DCIndex := 0;
if Font.IsDefault then if Font.IsDefault then
begin begin
SaveState; SaveState;
SelectObject(FHandle, OnGetSystemFont()); SelectObject(FHandle, OnGetSystemFont());
end; end;
ARect := Rect(0, 0, 0, 0);
GetTextExtentPoint(FHandle, PChar(Text), Length(Text), Result); GetTextExtentPoint(FHandle, PChar(Text), Length(Text), Result);
RestoreState; RestoreState;
end; end;