3 changed files with 97 additions and 33 deletions
@ -0,0 +1,35 @@ |
|||
using System.Collections.Generic; |
|||
using Avalonia.Controls; |
|||
|
|||
namespace Avalonia.Benchmarks |
|||
{ |
|||
internal class ControlHierarchyCreator |
|||
{ |
|||
public static List<Control> CreateChildren(List<Control> controls, IPanel parent, int childCount, int innerCount, int iterations) |
|||
{ |
|||
for (var i = 0; i < childCount; ++i) |
|||
{ |
|||
var control = new StackPanel(); |
|||
parent.Children.Add(control); |
|||
|
|||
for (int j = 0; j < innerCount; ++j) |
|||
{ |
|||
var child = new Button(); |
|||
|
|||
parent.Children.Add(child); |
|||
|
|||
controls.Add(child); |
|||
} |
|||
|
|||
if (iterations > 0) |
|||
{ |
|||
CreateChildren(controls, control, childCount, innerCount, iterations - 1); |
|||
} |
|||
|
|||
controls.Add(control); |
|||
} |
|||
|
|||
return controls; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Avalonia.Rendering; |
|||
using Avalonia.VisualTree; |
|||
|
|||
namespace Avalonia.Benchmarks |
|||
{ |
|||
internal class NullRenderer : IRenderer |
|||
{ |
|||
public bool DrawFps { get; set; } |
|||
public bool DrawDirtyRects { get; set; } |
|||
public event EventHandler<SceneInvalidatedEventArgs> SceneInvalidated; |
|||
|
|||
public void AddDirty(IVisual visual) |
|||
{ |
|||
} |
|||
|
|||
public void Dispose() |
|||
{ |
|||
} |
|||
|
|||
public IEnumerable<IVisual> HitTest(Point p, IVisual root, Func<IVisual, bool> filter) => null; |
|||
|
|||
public void Paint(Rect rect) |
|||
{ |
|||
} |
|||
|
|||
public void RecalculateChildren(IVisual visual) |
|||
{ |
|||
} |
|||
|
|||
public void Resized(Size size) |
|||
{ |
|||
} |
|||
|
|||
public void Start() |
|||
{ |
|||
} |
|||
|
|||
public void Stop() |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue