mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-23 10:22:13 +08:00
code_style: calculate bounds only when it is needed
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
@@ -55,11 +55,6 @@ namespace SourceGit.Views
|
||||
if (list == null)
|
||||
return;
|
||||
|
||||
// Calculate drawing area.
|
||||
var width = histories.CommitListHeader.ColumnDefinitions[0].ActualWidth;
|
||||
var height = Bounds.Height;
|
||||
|
||||
// Calculate row height
|
||||
var container = list.ItemsPanelRoot as VirtualizingStackPanel;
|
||||
if (container == null)
|
||||
return;
|
||||
@@ -68,15 +63,15 @@ namespace SourceGit.Views
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
var width = histories.CommitListHeader.ColumnDefinitions[0].ActualWidth;
|
||||
var height = Bounds.Height;
|
||||
var rowHeight = item.Bounds.Height;
|
||||
var startY = container.FirstRealizedIndex * rowHeight - item.TranslatePoint(new Point(0, 0), list).Value!.Y;
|
||||
var endY = startY + height + 28;
|
||||
|
||||
// Apply scroll offset and clip.
|
||||
using (context.PushClip(new Rect(0, 0, width, height)))
|
||||
using (context.PushTransform(Matrix.CreateTranslation(0, -startY)))
|
||||
{
|
||||
// Draw contents
|
||||
DrawCurves(context, graph, startY, endY, rowHeight);
|
||||
DrawAnchors(context, graph, startY, endY, rowHeight);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user