Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite of rendering stack #827

Merged
merged 211 commits into from
Aug 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
211 commits
Select commit Hold shift + click to select a range
ada15eb
Initial implementation of low-level scene graph.
grokys Nov 4, 2016
8ed9823
Merge branch 'master' into scenegraph
Nov 5, 2016
8aae515
Removed duplicate TestRoot.
grokys Nov 6, 2016
83d45c5
Merge branch 'remove-duplicate-testroot' into scenegraph
grokys Nov 6, 2016
d91d182
Initial implementation of scenegraph hit testing.
grokys Nov 6, 2016
458007a
Updated libs with API changes.
grokys Nov 6, 2016
86216d9
Use scene geometry for hit-testing.
grokys Nov 6, 2016
213e3c8
Fix hit testing on tab strip items.
grokys Nov 6, 2016
afda993
Fix initial draw.
grokys Nov 6, 2016
98f551c
Don't need the context.Render any more.
grokys Nov 9, 2016
59ea52e
Clip affects rendering.
Nov 10, 2016
934e18c
Initial impl of incremental update to SceneGraph.
Nov 10, 2016
cef5ffe
Docs and tweaking.
Nov 10, 2016
73f44bb
Fix GeometryNode hit test.
Nov 10, 2016
a520789
Reset needsRender flag after rendering.
grokys Nov 10, 2016
da666b4
Make Shape render properly again.
grokys Nov 10, 2016
349ba78
Fixed pointerover state.
grokys Nov 10, 2016
3c189cb
Make SceneBuilder update dirty rects.
grokys Nov 11, 2016
3422768
Render child visual nodes explicitly.
grokys Nov 17, 2016
52c3dae
Initial implementation of dirty rect drawing.
grokys Nov 17, 2016
9f0a85a
Move FPS drawing out of inner loop.
grokys Nov 17, 2016
2d5a8f3
Removed unnecessary field.
grokys Nov 17, 2016
db26fe3
Special case for hit testing in unit tests.
grokys Nov 17, 2016
d9d5e8b
Prevent reentrancy in renderer.
grokys Nov 17, 2016
c9752d3
Fixed a few things.
grokys Nov 17, 2016
43c9534
Fix non-compiling tests.
grokys Nov 17, 2016
df014bd
Use null _dirty as meaning "needs first update".
grokys Nov 17, 2016
7dde754
Don't keep rendering when there's nothing to render.
grokys Nov 17, 2016
8578cce
Simplification.
grokys Nov 17, 2016
76ec613
Use correct bounds in VisualNode.
grokys Nov 17, 2016
c46ca88
Make IGeometryImpl immutable.
grokys Nov 18, 2016
9ebfa5c
Make SharpDX dispose of its resources.
grokys Nov 18, 2016
584cdbb
Make FormattedTextImpl immutable.
grokys Nov 18, 2016
64287fe
Prevent out-of-bounds in DirtyRects.Coalesce.
grokys Nov 18, 2016
6b6474b
Fix bounds clipping.
grokys Nov 18, 2016
04fe4a0
Fix RectangleNode bounds.
grokys Nov 18, 2016
a6f5631
Fix geometry measure.
grokys Nov 18, 2016
675b742
Remove unneeded cast.
grokys Nov 18, 2016
1f985ab
Refactored VisualNode.
grokys Nov 20, 2016
d34c279
WIP: Adding render layers.
grokys Dec 1, 2016
e222e92
Add option to draw dirty rects.
grokys Dec 6, 2016
97ea14d
More work on deferred renderer.
grokys Dec 7, 2016
ec29987
Store layers in Scene.
grokys Dec 8, 2016
6d3ca92
WIP: Getting resizing working.
grokys Dec 10, 2016
bae15f3
Update dirty controls in order.
grokys Dec 10, 2016
932f489
Use the Direct2D 1.1 render target initialization.
grokys Dec 10, 2016
74c263e
Handle detached visuals in dirty list.
grokys Dec 10, 2016
a967c9b
Make DPI scaling work again.
Dec 11, 2016
eefc1d3
Initialize layer backgrounds to transparent.
grokys Dec 13, 2016
1e4661d
Resize swap chain on window resize.
grokys Dec 13, 2016
e450c76
A bit of work on Cairo, Skia and Gtk backends.
grokys Dec 14, 2016
fc1110f
Don't clear canvas when creating drawing context.
grokys Dec 14, 2016
560ed78
Make render tests pass again.
grokys Dec 14, 2016
1480532
Removed RendererMixin.
grokys Dec 14, 2016
40d42d2
Renamed Renderer -> ImmediateRenderer
grokys Dec 14, 2016
136f86f
Fix failing tests.
grokys Dec 14, 2016
5919343
Share FPS drawing between renderers.
grokys Dec 14, 2016
f6b344d
Fix immediate geometry rendering in D2D.
grokys Dec 14, 2016
e619e6c
Added skia ref to RenderTest.
grokys Dec 14, 2016
bfed639
Don't draw FPS to overlay.
grokys Dec 14, 2016
edb28bc
Don't clear GTK window on expose.
grokys Dec 16, 2016
4e8e7f8
Added setting to save frames to disk.
Dec 18, 2016
dbeb424
Fix skia text rendering.
Dec 20, 2016
b5e93b6
Make Window.IsVisible track window visibility.
Dec 20, 2016
b51513b
Refactor render layers a bit.
Dec 20, 2016
3426a8d
Handle deleted layers.
Dec 20, 2016
cf17c07
Swallow exceptions in render loop.
Dec 20, 2016
62e629b
Merge branch 'master' into scenegraph
Dec 21, 2016
0a36466
Run render tests with deferred renderer.
Dec 27, 2016
99c1df0
Remove Rect.operator*
Jan 11, 2017
4ce2e09
Use widened bounds for GeometryNode.Bounds.
Jan 11, 2017
6bc683a
Don't call Paint for now on Win32.
Jan 11, 2017
f9f658c
Handle null event source.
Jan 11, 2017
7c5c889
Fix RenderLayer resize.
Jan 11, 2017
7ce58c9
Merge branch 'master' into scenegraph
grokys Jan 23, 2017
558f98f
Remove refrences to "scene graph" in Visual.
grokys Jan 23, 2017
63f5dfb
Added ncrunch 3 solution.
grokys Jan 28, 2017
e79a144
WIP: Working on getting VisualBrush working
grokys Jan 28, 2017
ab9cf03
WIP: Delegate back to render for VisualBrushes.
grokys Jan 28, 2017
40c5337
Don't throw here.
grokys Jan 29, 2017
24635ea
Added in-tree visual brush test.
grokys Jan 29, 2017
5261ab3
WIP: More work on VisualBrush
grokys Jan 29, 2017
6f07978
Updated test output.
grokys Jan 29, 2017
051be91
WIP: Draw visual brush from DeferredRenderer.
grokys Jan 29, 2017
b3f9a84
Run deferred render tests on a background thread.
grokys Feb 4, 2017
d92fb01
Added IImageBrush and IVisualBrush
grokys Feb 5, 2017
69bca2c
Got VisualBrushes working again.
grokys Feb 5, 2017
4490b5f
Make scene nodes internal.
grokys Feb 5, 2017
0ba8a15
Removed random class diagram.
grokys Feb 5, 2017
b20ced7
Refactored brushes.
grokys Feb 5, 2017
252bc94
Make LinearGradientBrush work again.
grokys Feb 5, 2017
e4eaf72
Make RadialGradientBrush work
grokys Feb 6, 2017
c39fd38
Make OpacityMask work in deferred renderer.
grokys Feb 7, 2017
ff9654a
Merge branch 'master' into scenegraph
grokys Feb 7, 2017
b050edb
Use yellow background in geometry clip tests.
grokys Feb 7, 2017
c23e104
Added failing geometry clip hit-test.
grokys Feb 7, 2017
9004e9b
Updated RenderTest.
grokys Feb 8, 2017
d1e322c
Added failing test.
grokys Feb 8, 2017
53c0e96
Fix RenderTransforms in SceneBuilder.
grokys Feb 9, 2017
bfd8c04
Make geometry clips work.
grokys Feb 9, 2017
a849d7b
Fixed geometry clip hit testing.
grokys Feb 9, 2017
abe69ac
Moved some mocks into Avalonia.UnitTests.
grokys Feb 9, 2017
5e4f5a6
Handle geometry clips on child layers.
grokys Feb 9, 2017
468f965
Test turning geometry clipping on and off.
grokys Feb 9, 2017
2823f9e
Merge branch 'master' into scenegraph
grokys Feb 9, 2017
4fc75cb
Fixed failing tests.
grokys Feb 9, 2017
bf6b9c1
Merge branch 'master' into scenegraph
grokys Feb 14, 2017
2a79137
Make cairo render tests pass.
grokys Feb 16, 2017
4907841
Implement drawing opacity masked bitmap on skia.
grokys Feb 17, 2017
4fddd18
Don't clear skia canvas when creating drawing ctx.
grokys Feb 17, 2017
dcb7c35
Run skia render tests under NCrunch.
grokys Feb 17, 2017
8f4ef7f
Make a bunch of skia render tests pass.
grokys Feb 17, 2017
5b62cef
Fix Skia stream geometry bounds calculation.
grokys Feb 17, 2017
7e4f7cf
Merge branch 'master' into scenegraph
grokys Feb 21, 2017
418effe
Merge branch 'master' into scenegraph
grokys Feb 25, 2017
2b1d4e5
Fix failing test.
grokys Feb 28, 2017
ad73e7f
Send paint and resize notifications to renderer.
grokys Feb 28, 2017
226fc6b
Tweak DeferredRenderer locking.
grokys Feb 28, 2017
059b937
Set dirty rect when control removed/hidden.
grokys Feb 28, 2017
071ec13
Added missing member to interface.
grokys Feb 28, 2017
9029513
Merge branch 'master' into scenegraph
grokys Mar 3, 2017
daae9c0
Forgot to save before last commit.
grokys Mar 3, 2017
6036bd5
Moved ncrunch files to their own dir.
grokys Mar 4, 2017
371db68
Merge branch 'master' into scenegraph
grokys Mar 4, 2017
2813144
Added doc comments for ImmediateRenderer.
grokys Mar 4, 2017
289fa47
Reworked immediate renderer.
grokys Mar 4, 2017
faf150c
Make windowing subsystem select the renderer.
grokys Mar 4, 2017
39c25fd
Allow selection of ImmediateRendering on Win32.
grokys Mar 4, 2017
a5f03f7
Don't need to pass visual brush renderer when creating render target.
grokys Mar 5, 2017
e0ef467
Merge remote-tracking branch 'origin/master' into scenegraph
grokys Mar 5, 2017
910d17a
Removed unused code.
grokys Mar 5, 2017
11fd0fb
Merge branch 'master' into scenegraph
grokys Mar 5, 2017
bd23c9e
Merge branch 'master' into scenegraph
grokys Mar 17, 2017
ef6486a
Removed unused member.
grokys Mar 17, 2017
4520b2d
Merge branch 'master' into scenegraph
grokys Mar 17, 2017
5cee534
Merge branch 'master' into scenegraph
grokys Apr 1, 2017
d0bb03e
Remove .vscode dir.
grokys Apr 1, 2017
2aa912c
Merge remote-tracking branch 'origin/master' into scenegraph
grokys Apr 1, 2017
b7c83e7
Remove IsVisible changes from Window/Popup.
grokys Apr 1, 2017
a39d84b
Use correct namespace for IDrawingContextImpl.
grokys Apr 1, 2017
376535b
Make IFormattedTextImpl immutable.
grokys Apr 3, 2017
be20562
Added some docs.
grokys Apr 3, 2017
e93e262
FormattedText spans can be null.
grokys Apr 4, 2017
ae7cf4a
Merge branch 'master' into scenegraph
grokys Apr 15, 2017
daa1ef9
Merge branch 'port-immediaterenderer' into scenegraph
grokys Apr 19, 2017
1b51790
Fix merge errors.
grokys Apr 19, 2017
19a8b8a
Moved hit testing tests.
grokys Apr 26, 2017
7119464
Added ImmediateRenderer hit tests.
grokys Apr 26, 2017
cb3090e
Merge branch 'fixes/fix-getvisualroot' into scenegraph
grokys May 7, 2017
96f316e
Removed some small diffs from master.
grokys May 7, 2017
b942eef
Added RenderScaling doc comment.
grokys May 7, 2017
804d1b6
Always allow D2D for the moment.
grokys May 7, 2017
7fd1adb
This needs to be settable.
grokys May 7, 2017
f0e3989
Made some classes internal and added docs.
grokys May 7, 2017
20d44f2
Merge branch 'master' into scenegraph
grokys May 23, 2017
aec3c51
Merge remote-tracking branch 'origin/master' into scenegraph
grokys May 27, 2017
80745a3
Expose Visuals internals to render tests.
grokys May 27, 2017
1c42bbf
Added failing custom renderer test.
grokys May 27, 2017
3ce2479
Implemented deferred opacity drawing.
grokys May 27, 2017
7e1efb3
Added failing render test.
grokys May 27, 2017
d6342e9
Adjusted expected test output.
grokys May 27, 2017
27ec199
Added failing custom render tests.
grokys May 27, 2017
9121b4d
Implemented more deferred rendering.
grokys May 27, 2017
51688fa
Removed duplicate using statement.
grokys May 27, 2017
2fcafe1
Merge branch 'master' into scenegraph
grokys May 27, 2017
fb25645
Fixed expected skia output.
grokys May 27, 2017
11a0100
Fix possible null reference exceptions.
grokys May 27, 2017
e5e5edd
Removed files deleted on master.
grokys May 27, 2017
3d76a50
Port Direct2D code from master.
grokys May 27, 2017
69c43cb
Fix DPI scaling with Skia.
grokys May 27, 2017
2d0d265
Merge branch 'fixes/fix-interop-samples' into scenegraph
grokys May 27, 2017
6a2d9e8
Merge branch 'fixes/fix-interop-samples' into scenegraph
grokys May 27, 2017
ddbc100
Make D3D interop sample work.
grokys May 27, 2017
1ac08f3
Merge branch 'master' into scenegraph
danwalmsley Jun 1, 2017
024573d
Removed bad project references.
grokys Jun 14, 2017
0f81420
Don't remove root layer when hiding root.
grokys Jun 14, 2017
daf59b8
Start/stop the renderer on window show/hide.
grokys Jun 16, 2017
1e2e3b3
Merge remote-tracking branch 'origin/master' into scenegraph
grokys Jun 16, 2017
becac6a
Set background on MenuItem and TreeViewItem
grokys Jun 17, 2017
99efcfe
Make BoundsTracker work with deferred renderer.
grokys Jun 17, 2017
1cb2e32
Set background for CheckBox and RadioButton
grokys Jun 17, 2017
dc20897
GeometryNode.Pen may be null.
grokys Jun 29, 2017
ec80b12
Check for null from Scene.FindNode.
grokys Jun 29, 2017
b28bc7c
Convert brushes to immutable brushes in FormattedTextImpl.
grokys Jun 29, 2017
79a192a
Change cast to `as` operator.
grokys Jun 29, 2017
a451803
Merge branch 'master' into scenegraph
danwalmsley Jun 30, 2017
cb9e9a1
Don't try to create a framebuffer of size 0.
grokys Jun 30, 2017
658a1d3
Fix scrollwheel scrolling in TreeView/ListBox.
grokys Jun 30, 2017
e7c8e8e
Merge branch 'master' into scenegraph
danwalmsley Jul 5, 2017
18dd29e
Merge branch 'master' into scenegraph
danwalmsley Jul 7, 2017
fb8695c
Merge branch 'master' into scenegraph
danwalmsley Jul 12, 2017
dc966d4
Give background to DropDownItem and ListBoxItem.
grokys Jul 13, 2017
104da0f
Fix ScrollViewer background.
grokys Jul 13, 2017
d7aa408
Fixed ScrollViewer background correctly.
grokys Jul 14, 2017
2a748fe
Newly merged tests must be async.
grokys Jul 12, 2017
64ef842
Merge remote-tracking branch 'origin/master' into scenegraph
grokys Jul 16, 2017
daafa39
Merge branch 'master' into scenegraph
danwalmsley Jul 20, 2017
3f92d13
Merge branch 'master' into scenegraph
danwalmsley Jul 24, 2017
2f5d8e2
Fix merge error.
grokys Aug 2, 2017
2edcdb8
MouseDevice now exposed on TopLevel.
grokys Aug 2, 2017
704452e
Added TODOs.
grokys Aug 2, 2017
aa1af7f
Removed unused file.
grokys Aug 2, 2017
bbf69b7
Use Vector for DPI.
grokys Aug 2, 2017
7eec944
Add Brush/Pen.ToImmutable() extension method.
grokys Aug 2, 2017
aefc5c5
Scene.Id -> Scene.Generation.
grokys Aug 2, 2017
3527c20
Throw NotSupportedException.
grokys Aug 2, 2017
d2eca39
Removed IRendererFactory.
grokys Aug 3, 2017
7905a3e
Merge remote-tracking branch 'origin/master' into scenegraph
grokys Aug 4, 2017
391efe3
Fix merge error.
grokys Aug 4, 2017
e3fde00
Remove IRenderFactory from mobile platforms.
grokys Aug 4, 2017
2479f3e
Merge branch 'master' into scenegraph
grokys Aug 4, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .ncrunch/Avalonia.LinuxFramebuffer.v3.ncrunchproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<ProjectConfiguration>
<Settings>
<PreviouslyBuiltSuccessfully>True</PreviouslyBuiltSuccessfully>
</Settings>
</ProjectConfiguration>
5 changes: 5 additions & 0 deletions .ncrunch/Avalonia.Visuals.UnitTests.net461.v3.ncrunchproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<ProjectConfiguration>
<Settings>
<PreviouslyBuiltSuccessfully>True</PreviouslyBuiltSuccessfully>
</Settings>
</ProjectConfiguration>
5 changes: 5 additions & 0 deletions .ncrunch/Avalonia.Win32.Interop.v3.ncrunchproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<ProjectConfiguration>
<Settings>
<PreviouslyBuiltSuccessfully>True</PreviouslyBuiltSuccessfully>
</Settings>
</ProjectConfiguration>
1 change: 1 addition & 0 deletions samples/ControlCatalog/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public MainWindow()
{
this.InitializeComponent();
this.AttachDevTools();
Renderer.DrawDirtyRects = Renderer.DrawFps = true;
}

private void InitializeComponent()
Expand Down
2 changes: 1 addition & 1 deletion samples/interop/Direct3DInteropSample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Program
{
static void Main(string[] args)
{
AppBuilder.Configure<App>().UseWin32().UseDirect2D1().Start<MainWindow>();
AppBuilder.Configure<App>().UseWin32(deferredRendering: false).UseDirect2D1().Start<MainWindow>();
}
}
}
2 changes: 0 additions & 2 deletions src/Android/Avalonia.Android/AndroidPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,11 @@ public static void Initialize(Avalonia.Application app)
.Bind<IStandardCursorFactory>().ToTransient<CursorFactory>()
.Bind<IKeyboardDevice>().ToSingleton<AndroidKeyboardDevice>()
.Bind<IPlatformSettings>().ToConstant(Instance)
.Bind<IRendererFactory>().ToConstant(ImmediateRenderer.Factory)
.Bind<IPlatformThreadingInterface>().ToConstant(new AndroidThreadingInterface())
.Bind<ISystemDialogImpl>().ToTransient<SystemDialogImpl>()
.Bind<IWindowingPlatform>().ToConstant(Instance)
.Bind<IPlatformIconLoader>().ToSingleton<PlatformIconLoader>()
.Bind<IRenderLoop>().ToConstant(new DefaultRenderLoop(60))

.Bind<IAssetLoader>().ToConstant(new AssetLoader(app.GetType().Assembly));

SkiaPlatform.Initialize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Avalonia.Android.Platform.Input;
using Avalonia.Controls;
using Avalonia.Controls.Platform.Surfaces;
using Avalonia.Rendering;

namespace Avalonia.Android.Platform.SkiaPlatform
{
Expand Down Expand Up @@ -85,7 +86,12 @@ public virtual Size ClientSize
public IPlatformHandle Handle => _view;

public IEnumerable<object> Surfaces => new object[] {this};


public IRenderer CreateRenderer(IRenderRoot root)
{
return new ImmediateRenderer(root);
}

public virtual void Hide()
{
_view.Visibility = ViewStates.Invisible;
Expand Down
7 changes: 7 additions & 0 deletions src/Avalonia.Controls/Platform/ITopLevelImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Collections.Generic;
using Avalonia.Input;
using Avalonia.Input.Raw;
using Avalonia.Rendering;
using JetBrains.Annotations;

namespace Avalonia.Platform
Expand Down Expand Up @@ -60,6 +61,12 @@ public interface ITopLevelImpl : IDisposable
/// </summary>
Action<double> ScalingChanged { get; set; }

/// <summary>
/// Creates a new renderer for the toplevel.
/// </summary>
/// <param name="root">The toplevel.</param>
IRenderer CreateRenderer(IRenderRoot root);

/// <summary>
/// Invalidates a rect on the toplevel.
/// </summary>
Expand Down
6 changes: 4 additions & 2 deletions src/Avalonia.Controls/TopLevel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ public TopLevel(ITopLevelImpl impl, IAvaloniaDependencyResolver dependencyResolv
_renderInterface = TryGetService<IPlatformRenderInterface>(dependencyResolver);

var renderLoop = TryGetService<IRenderLoop>(dependencyResolver);
var rendererFactory = TryGetService<IRendererFactory>(dependencyResolver);
Renderer = rendererFactory?.CreateRenderer(this, renderLoop);
Renderer = impl.CreateRenderer(this);

impl.SetInputRoot(this);

Expand Down Expand Up @@ -181,6 +180,9 @@ bool IInputRoot.ShowAccessKeys
/// <inheritdoc/>
double ILayoutRoot.LayoutScaling => PlatformImpl?.Scaling ?? 1;

/// <inheritdoc/>
double IRenderRoot.RenderScaling => PlatformImpl?.Scaling ?? 1;

IStyleHost IStyleHost.StylingParent
{
get { return AvaloniaLocator.Current.GetService<IGlobalStyles>(); }
Expand Down
9 changes: 9 additions & 0 deletions src/Avalonia.Controls/Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,14 @@ public void Close(object dialogResult)
/// </summary>
public override void Hide()
{
if (!IsVisible)
{
return;
}

using (BeginAutoSizing())
{
Renderer?.Stop();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[FUTURE] It's probably better to react to window state changes instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean that we also need to react to WindowState changes, or that some other form of window state should replace Hide?

PlatformImpl?.Hide();
}

Expand All @@ -252,6 +258,7 @@ public override void Show()
using (BeginAutoSizing())
{
PlatformImpl?.Show();
Renderer?.Start();
}
}

Expand Down Expand Up @@ -297,6 +304,8 @@ public Task<TResult> ShowDialog<TResult>()
var modal = PlatformImpl?.ShowDialog();
var result = new TaskCompletionSource<TResult>();

Renderer?.Start();

Observable.FromEventPattern<EventHandler, EventArgs>(
x => this.Closed += x,
x => this.Closed -= x)
Expand Down
2 changes: 2 additions & 0 deletions src/Avalonia.Controls/WindowBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public virtual void Hide()

try
{
Renderer?.Stop();
PlatformImpl?.Hide();
IsVisible = false;
}
Expand Down Expand Up @@ -145,6 +146,7 @@ public virtual void Show()
}

PlatformImpl?.Show();
Renderer?.Start();
}
finally
{
Expand Down
3 changes: 2 additions & 1 deletion src/Avalonia.Themes.Default/CheckBox.xaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<Styles xmlns="https://github.com/avaloniaui">
<Style Selector="CheckBox">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{StyleResource ThemeBorderMidBrush}"/>
<Setter Property="BorderThickness" Value="{StyleResource ThemeBorderThickness}"/>
<Setter Property="Template">
<ControlTemplate>
<Grid ColumnDefinitions="Auto,*">
<Grid ColumnDefinitions="Auto,*" Background="{TemplateBinding Background}">
<Border Name="border"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Expand Down
1 change: 1 addition & 0 deletions src/Avalonia.Themes.Default/DropDownItem.xaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Styles xmlns="https://github.com/avaloniaui">
<Style Selector="DropDownItem">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Padding" Value="2"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
Expand Down
6 changes: 3 additions & 3 deletions src/Avalonia.Themes.Default/ListBox.xaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Style xmlns="https://github.com/avaloniaui" Selector="ListBox">
<Setter Property="Background" Value="{StyleResource ThemeBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{StyleResource ThemeBorderMidBrush}"/>
<Setter Property="BorderThickness" Value="{StyleResource ThemeBorderThickness}"/>
<Setter Property="Padding" Value="4"/>
<Setter Property="Template">
<ControlTemplate>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
<Border BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer Name="PART_ScrollViewer">
<ScrollViewer Name="PART_ScrollViewer" Background="{TemplateBinding Background}">
<ItemsPresenter Name="PART_ItemsPresenter"
Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}"
Expand Down
1 change: 1 addition & 0 deletions src/Avalonia.Themes.Default/ListBoxItem.xaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Styles xmlns="https://github.com/avaloniaui">
<Style Selector="ListBoxItem">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template">
<ControlTemplate>
<ContentPresenter Name="PART_ContentPresenter"
Expand Down
1 change: 1 addition & 0 deletions src/Avalonia.Themes.Default/MenuItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
xmlns:sys="clr-namespace:System;assembly=mscorlib">

<Style Selector="MenuItem">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="6,0"/>
<Setter Property="Template">
Expand Down
3 changes: 2 additions & 1 deletion src/Avalonia.Themes.Default/RadioButton.xaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<Styles xmlns="https://github.com/avaloniaui">
<Style Selector="RadioButton">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{StyleResource ThemeBorderMidBrush}"/>
<Setter Property="BorderThickness" Value="{StyleResource ThemeBorderThickness}"/>
<Setter Property="Template">
<ControlTemplate>
<Grid ColumnDefinitions="Auto,*">
<Grid ColumnDefinitions="Auto,*" Background="{TemplateBinding Background}">
<Ellipse Name="border"
Stroke="{TemplateBinding BorderBrush}"
StrokeThickness="{TemplateBinding BorderThickness}"
Expand Down
3 changes: 2 additions & 1 deletion src/Avalonia.Themes.Default/ScrollViewer.xaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<Style xmlns="https://github.com/avaloniaui" Selector="ScrollViewer">
<Setter Property="Template">
<ControlTemplate>
<Grid ColumnDefinitions="*,Auto" RowDefinitions="*,Auto" Background="{TemplateBinding Background}">
<Grid ColumnDefinitions="*,Auto" RowDefinitions="*,Auto">
<ScrollContentPresenter Name="PART_ContentPresenter"
Background="{TemplateBinding Background}"
Content="{TemplateBinding Content}"
Extent="{TemplateBinding Path=Extent, Mode=TwoWay}"
Margin="{TemplateBinding Padding}"
Expand Down
1 change: 1 addition & 0 deletions src/Avalonia.Themes.Default/TabStripItem.xaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Styles xmlns="https://github.com/avaloniaui">
<Style Selector="TabStripItem">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="FontSize" Value="{StyleResource FontSizeLarge}"/>
<Setter Property="Foreground" Value="{StyleResource ThemeForegroundLightBrush}"/>
<Setter Property="Template">
Expand Down
6 changes: 3 additions & 3 deletions src/Avalonia.Themes.Default/TreeView.xaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Style xmlns="https://github.com/avaloniaui" Selector="TreeView">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{StyleResource ThemeBorderMidBrush}"/>
<Setter Property="BorderThickness" Value="{StyleResource ThemeBorderThickness}"/>
<Setter Property="Padding" Value="4"/>
<Setter Property="Template">
<ControlTemplate>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
<Border BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer CanScrollHorizontally="True">
<ScrollViewer CanScrollHorizontally="True" Background="{TemplateBinding Background}">
<ItemsPresenter Name="PART_ItemsPresenter"
Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}"
Expand Down
3 changes: 2 additions & 1 deletion src/Avalonia.Themes.Default/TreeViewItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
<Style Selector="TreeViewItem /template/ ToggleButton#expander">
<Setter Property="Template">
<ControlTemplate>
<Border Width="14"
<Border Background="Transparent"
Width="14"
Height="12"
HorizontalAlignment="Center"
VerticalAlignment="Center">
Expand Down
51 changes: 51 additions & 0 deletions src/Avalonia.Visuals/Media/BrushExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using System;

namespace Avalonia.Media
{
/// <summary>
/// Extension methods for brush classes.
/// </summary>
public static class BrushExtensions
{
/// <summary>
/// Converts a brush to an immutable brush.
/// </summary>
/// <param name="brush">The brush.</param>
/// <returns>
/// The result of calling <see cref="IMutableBrush.ToImmutable"/> if the brush is mutable,
/// otherwise <paramref name="brush"/>.
/// </returns>
public static IBrush ToImmutable(this IBrush brush)
{
Contract.Requires<ArgumentNullException>(brush != null);

return (brush as IMutableBrush)?.ToImmutable() ?? brush;
}

/// <summary>
/// Converts a pen to a pen with an immutable brush
/// </summary>
/// <param name="pen">The pen.</param>
/// <returns>
/// A copy of the pen with an immutable brush, or <paramref name="pen"/> if the pen's brush
/// is already immutable or null.
/// </returns>
public static Pen ToImmutable(this Pen pen)
{
Contract.Requires<ArgumentNullException>(pen != null);

var brush = pen?.Brush?.ToImmutable();
return pen == null || ReferenceEquals(pen?.Brush, brush) ?
pen :
new Pen(
brush,
thickness: pen.Thickness,
dashStyle: pen.DashStyle,
dashCap: pen.DashCap,
startLineCap: pen.StartLineCap,
endLineCap: pen.EndLineCap,
lineJoin: pen.LineJoin,
miterLimit: pen.MiterLimit);
}
}
}
12 changes: 10 additions & 2 deletions src/Avalonia.Visuals/Platform/IDrawingContextImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System;
using Avalonia.Media;
using Avalonia.Platform;

namespace Avalonia.Platform
{
Expand Down Expand Up @@ -32,6 +31,15 @@ public interface IDrawingContextImpl : IDisposable
/// <param name="destRect">The rect in the output to draw to.</param>
void DrawImage(IBitmapImpl source, double opacity, Rect sourceRect, Rect destRect);

/// <summary>
/// Draws a bitmap image.
/// </summary>
/// <param name="source">The bitmap image.</param>
/// <param name="opacityMask">The opacity mask to draw with.</param>
/// <param name="opacityMaskRect">The destination rect for the opacity mask.</param>
/// <param name="destRect">The rect in the output to draw to.</param>
void DrawImage(IBitmapImpl source, IBrush opacityMask, Rect opacityMaskRect, Rect destRect);

/// <summary>
/// Draws a line.
/// </summary>
Expand Down Expand Up @@ -100,4 +108,4 @@ public interface IDrawingContextImpl : IDisposable

void PopGeometryClip();
}
}
}
8 changes: 7 additions & 1 deletion src/Avalonia.Visuals/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
// Licensed under the MIT license. See licence.md file in the project root for full license information.

using System.Reflection;
using System.Runtime.CompilerServices;
using Avalonia.Metadata;

[assembly: AssemblyTitle("Avalonia.Visuals")]
[assembly: InternalsVisibleTo("Avalonia.Visuals.UnitTests")]
[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Animation")]
[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Media")]
[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Media")]

[assembly: InternalsVisibleTo("Avalonia.Cairo.RenderTests")]
[assembly: InternalsVisibleTo("Avalonia.Direct2D1.RenderTests")]
[assembly: InternalsVisibleTo("Avalonia.Skia.RenderTests")]
Loading