Skip to content

Commit 54b0987

Browse files
committed
Stupid micro-optimizations
1 parent 4e12904 commit 54b0987

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

AngelLoader/Forms/CustomControls/DataGridViewCustom/DataGridViewCustom.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ private void DrawPinIconIfNeeded(DataGridViewCellPaintingEventArgs e, FanMission
680680

681681
Images.FitRectInBounds(
682682
e.Graphics,
683-
Images.PinGPath.GetBounds(),
683+
Images.PinGPathBounds,
684684
pinGlyphRect
685685
);
686686
e.Graphics.FillPath(foreColorBrush, Images.PinGPath);

AngelLoader/Forms/Images.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ public static class Images
129129
private static GraphicsPath? _pinGPath;
130130
internal static GraphicsPath PinGPath => _pinGPath ??= MakeGraphicsPath(_pinPoints, _pinTypes);
131131

132+
// Stupid micro-optimization, because we call this a lot potentially
133+
private static RectangleF? _pinGPathBounds;
134+
internal static RectangleF PinGPathBounds => _pinGPathBounds ??= PinGPath.GetBounds();
135+
132136
#region Magnifying glass
133137

134138
/*
@@ -164,6 +168,10 @@ public static class Images
164168
private static GraphicsPath? _magnifierEmptyGPath;
165169
private static GraphicsPath MagnifierEmptyGPath => _magnifierEmptyGPath ??= MakeGraphicsPath(_magnifierEmptyPoints, _magnifierEmptyTypes);
166170

171+
// Stupid micro-optimization, because we call this a lot potentially
172+
private static RectangleF? _magnifierEmptyGPathBounds;
173+
private static RectangleF MagnifierEmptyGPathBounds => _magnifierEmptyGPathBounds ??= MagnifierEmptyGPath.GetBounds();
174+
167175
#endregion
168176

169177
#region Zoom symbols
@@ -1914,7 +1922,7 @@ internal static void PaintScanButtons(Button button, PaintEventArgs e)
19141922

19151923
FitRectInBounds(
19161924
e.Graphics,
1917-
MagnifierEmptyGPath.GetBounds(),
1925+
MagnifierEmptyGPathBounds,
19181926
new RectangleF(
19191927
(cr.X + 3f),//- (cr.Height - 4),
19201928
cr.Y + 3f,

0 commit comments

Comments
 (0)