mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-20 11:44:59 +00:00
code_style: calculate bounds only when it is needed
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
2c8370fa92
commit
6986e1ac24
1 changed files with 2 additions and 7 deletions
|
@ -55,11 +55,6 @@ namespace SourceGit.Views
|
||||||
if (list == null)
|
if (list == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Calculate drawing area.
|
|
||||||
var width = histories.CommitListHeader.ColumnDefinitions[0].ActualWidth;
|
|
||||||
var height = Bounds.Height;
|
|
||||||
|
|
||||||
// Calculate row height
|
|
||||||
var container = list.ItemsPanelRoot as VirtualizingStackPanel;
|
var container = list.ItemsPanelRoot as VirtualizingStackPanel;
|
||||||
if (container == null)
|
if (container == null)
|
||||||
return;
|
return;
|
||||||
|
@ -68,15 +63,15 @@ namespace SourceGit.Views
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var width = histories.CommitListHeader.ColumnDefinitions[0].ActualWidth;
|
||||||
|
var height = Bounds.Height;
|
||||||
var rowHeight = item.Bounds.Height;
|
var rowHeight = item.Bounds.Height;
|
||||||
var startY = container.FirstRealizedIndex * rowHeight - item.TranslatePoint(new Point(0, 0), list).Value!.Y;
|
var startY = container.FirstRealizedIndex * rowHeight - item.TranslatePoint(new Point(0, 0), list).Value!.Y;
|
||||||
var endY = startY + height + 28;
|
var endY = startY + height + 28;
|
||||||
|
|
||||||
// Apply scroll offset and clip.
|
|
||||||
using (context.PushClip(new Rect(0, 0, width, height)))
|
using (context.PushClip(new Rect(0, 0, width, height)))
|
||||||
using (context.PushTransform(Matrix.CreateTranslation(0, -startY)))
|
using (context.PushTransform(Matrix.CreateTranslation(0, -startY)))
|
||||||
{
|
{
|
||||||
// Draw contents
|
|
||||||
DrawCurves(context, graph, startY, endY, rowHeight);
|
DrawCurves(context, graph, startY, endY, rowHeight);
|
||||||
DrawAnchors(context, graph, startY, endY, rowHeight);
|
DrawAnchors(context, graph, startY, endY, rowHeight);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue