mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 13:39:11 +02:00
designer: reduce SaveDC, RestoreDC calls
git-svn-id: trunk@21609 -
This commit is contained in:
parent
d43964d5f1
commit
88641be03d
@ -2501,8 +2501,9 @@ var
|
||||
Diff, ItemLeftTop: TPoint;
|
||||
IconRect, TextRect: TRect;
|
||||
TextSize: TSize;
|
||||
IsSelected: Boolean;
|
||||
IsSelected, IsSaved: Boolean;
|
||||
begin
|
||||
IsSaved := False;
|
||||
for i := 0 to FLookupRoot.ComponentCount - 1 do
|
||||
begin
|
||||
AComponent := FLookupRoot.Components[i];
|
||||
@ -2516,11 +2517,17 @@ begin
|
||||
ItemTop := ItemLeftTop.Y - Diff.Y;
|
||||
ItemRight := ItemLeft + NonVisualCompWidth;
|
||||
ItemBottom := ItemTop + NonVisualCompWidth;
|
||||
|
||||
if not IsSaved then
|
||||
begin
|
||||
aDDC.Save;
|
||||
IsSaved := True;
|
||||
end;
|
||||
|
||||
if not aDDC.RectVisible(ItemLeft, ItemTop, ItemRight, ItemBottom) then
|
||||
Continue;
|
||||
|
||||
IsSelected := ControlSelection.IsSelected(AComponent);
|
||||
aDDC.Save;
|
||||
with aDDC.Canvas do
|
||||
begin
|
||||
// draw component frame
|
||||
@ -2561,9 +2568,11 @@ begin
|
||||
if (ControlSelection.Count > 1) and IsSelected then
|
||||
ControlSelection.DrawMarkerAt(aDDC,
|
||||
ItemLeft, ItemTop, NonVisualCompWidth, NonVisualCompWidth);
|
||||
end;
|
||||
end;
|
||||
|
||||
if IsSaved then
|
||||
aDDC.Restore;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDesigner.DrawDesignerItems(OnlyIfNeeded: boolean);
|
||||
|
Loading…
Reference in New Issue
Block a user