8000 code_style: calculate bounds only when it is needed · sourcegit-scm/sourcegit@6986e1a · GitHub
[go: up one dir, main page]

Skip to content

Commit 6986e1a

Browse files
committed
code_style: calculate bounds only when it is needed
Signed-off-by: leo <longshuang@msn.cn>
1 parent 2c8370f commit 6986e1a

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/Views/CommitGraph.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ public override void Render(DrawingContext context)
5555
if (list == null)
5656
return;
5757

58-
// Calculate drawing area.
59-
var width = histories.CommitListHeader.ColumnDefinitions[0].ActualWidth;
60-
var height = Bounds.Height;
61-
62-
// Calculate row height
6358
var container = list.ItemsPanelRoot as VirtualizingStackPanel;
6459
if (container == null)
6560
return;
@@ -68,15 +63,15 @@ public override void Render(DrawingContext context)
6863
if (item == null)
6964
return;
7065

66+
var width< 88A7 /span> = histories.CommitListHeader.ColumnDefinitions[0].ActualWidth;
67+
var height = Bounds.Height;
7168
var rowHeight = item.Bounds.Height;
7269
var startY = container.FirstRealizedIndex * rowHeight - item.TranslatePoint(new Point(0, 0), list).Value!.Y;
7370
var endY = startY + height + 28;
7471

75-
// Apply scroll offset and clip.
7672
using (context.PushClip(new Rect(0, 0, width, height)))
7773
using (context.PushTransform(Matrix.CreateTranslation(0, -startY)))
7874
{
79-
// Draw contents
8075
DrawCurves(context, graph, startY, endY, rowHeight);
8176
DrawAnchors(context, graph, startY, endY, rowHeight);
8277
}

0 commit comments

Comments
 (0)
0