Browse Source

Merge branch 'port-immediaterenderer' into scenegraph

 Conflicts:
	src/Avalonia.Visuals/Platform/IRenderTarget.cs
	src/Avalonia.Visuals/Rendering/ImmediateRenderer.cs
	src/Gtk/Avalonia.Cairo/Media/DrawingContext.cs
	src/Gtk/Avalonia.Cairo/Media/ImageBrushImpl.cs
	src/Shared/RenderHelpers/TileBrushImplHelper.cs
	src/Skia/Avalonia.Skia/BitmapImpl.cs
	src/Skia/Avalonia.Skia/DrawingContextImpl.cs
	src/Windows/Avalonia.Direct2D1/Direct2D1Platform.cs
	src/Windows/Avalonia.Direct2D1/Media/Imaging/RenderTargetBitmapImpl.cs
	src/Windows/Avalonia.Direct2D1/RenderTarget.cs
	src/Windows/Avalonia.Direct2D1/SwapChainRenderTarget.cs
	src/Windows/Avalonia.Win32/Win32Platform.cs
	tests/Avalonia.UnitTests/TestServices.cs
	tests/Avalonia.Visuals.UnitTests/VisualTests.cs
	tests/Avalonia.Visuals.UnitTests/VisualTree/VisualExtensionsTests_GetVisualsAt.cs
Steven Kirk 8 years ago
parent
commit
daa1ef93f4

+ 1 - 1
src/Avalonia.Controls/TopLevel.cs

@@ -100,7 +100,7 @@ namespace Avalonia.Controls
             PlatformImpl.Paint = HandlePaint;
             PlatformImpl.Resized = HandleResized;
             PlatformImpl.ScalingChanged = HandleScalingChanged;
-            
+
 
             _keyboardNavigationHandler?.SetOwner(this);
             _accessKeyHandler?.SetOwner(this);

+ 1 - 2
src/Avalonia.Visuals/Platform/IRenderTarget.cs

@@ -2,7 +2,6 @@
 // Licensed under the MIT license. See licence.md file in the project root for full license information.
 
 using System;
-using Avalonia.Media;
 using Avalonia.Rendering;
 
 namespace Avalonia.Platform
@@ -16,7 +15,7 @@ namespace Avalonia.Platform
     public interface IRenderTarget : IDisposable
     {
         /// <summary>
-        /// Creates an <see cref="DrawingContext"/> for a rendering session.
+        /// Creates an <see cref="IDrawingContextImpl"/> for a rendering session.
         /// </summary>
         /// <param name="visualBrushRenderer">
         /// A render to be used to render visual brushes. May be null if no visual brushes are

+ 0 - 1
src/Avalonia.Visuals/Rendering/ImmediateRenderer.cs

@@ -5,7 +5,6 @@ using System;
 using Avalonia.Platform;
 using Avalonia.VisualTree;
 using System.Collections.Generic;
-using Avalonia.Threading;
 using Avalonia.Media;
 using System.Linq;
 

+ 19 - 19
src/Gtk/Avalonia.Cairo/Media/DrawingContext.cs

@@ -54,7 +54,7 @@ namespace Avalonia.Cairo.Media
             {
                 _transform = value;
                 _context.Matrix = value.ToCairo();
-                
+
             }
         }
 
@@ -90,7 +90,7 @@ namespace Avalonia.Cairo.Media
             _context.Scale(scale.X, scale.Y);
             destRect /= scale;
 
-			_context.PushGroup ();
+            _context.PushGroup();
 
             if (pixbuf != null)
             {
@@ -108,10 +108,10 @@ namespace Avalonia.Cairo.Media
                         (int)(-sourceRect.Y + destRect.Y));
             }
 
-            _context.Rectangle (destRect.ToCairo ());
-			_context.Fill ();
-			_context.PopGroupToSource ();
-			_context.PaintWithAlpha (opacityOverride);
+            _context.Rectangle(destRect.ToCairo());
+            _context.Fill();
+            _context.PopGroupToSource();
+            _context.PaintWithAlpha(opacityOverride);
             _context.Restore();
         }
 
@@ -131,8 +131,8 @@ namespace Avalonia.Cairo.Media
         public void DrawLine(Pen pen, Point p1, Point p2)
         {
             var size = new Rect(p1, p2).Size;
-            
-            using (var p = SetPen(pen, size)) 
+
+            using (var p = SetPen(pen, size))
             {
                 _context.MoveTo(p1.ToCairo());
                 _context.LineTo(p2.ToCairo());
@@ -153,7 +153,7 @@ namespace Avalonia.Cairo.Media
             var oldMatrix = Transform;
             Transform = impl.Transform * Transform;
 
-            
+
             if (brush != null)
             {
                 _context.AppendPath(impl.Path);
@@ -188,9 +188,9 @@ namespace Avalonia.Cairo.Media
         /// <param name="rect">The rectangle bounds.</param>
         public void DrawRectangle(Pen pen, Rect rect, float cornerRadius)
         {
-            using (var p = SetPen(pen, rect.Size)) 
+            using (var p = SetPen(pen, rect.Size))
             {
-                _context.Rectangle(rect.ToCairo ());
+                _context.Rectangle(rect.ToCairo());
                 _context.Stroke();
             }
         }
@@ -206,7 +206,7 @@ namespace Avalonia.Cairo.Media
             var layout = ((FormattedTextImpl)text).Layout;
             _context.MoveTo(origin.X, origin.Y);
 
-            using (var b = SetBrush(foreground, new Size(0, 0))) 
+            using (var b = SetBrush(foreground, new Size(0, 0)))
             {
                 Pango.CairoHelper.ShowLayout(_context, layout);
             }
@@ -219,9 +219,9 @@ namespace Avalonia.Cairo.Media
         /// <param name="rect">The rectangle bounds.</param>
         public void FillRectangle(IBrush brush, Rect rect, float cornerRadius)
         {
-            using (var b = SetBrush(brush, rect.Size)) 
+            using (var b = SetBrush(brush, rect.Size))
             {
-                _context.Rectangle(rect.ToCairo ());
+                _context.Rectangle(rect.ToCairo());
                 _context.Fill();
             }
         }
@@ -276,10 +276,10 @@ namespace Avalonia.Cairo.Media
 
             return Disposable.Create(() =>
             {
-               _context.Restore();
+                _context.Restore();
             });
         }
-        
+
         private double opacityOverride = 1.0f;
 
         private IDisposable SetBrush(IBrush brush, Size destinationSize)
@@ -379,7 +379,7 @@ namespace Avalonia.Cairo.Media
 
             if (pen.Brush == null)
                 return Disposable.Empty;
-            
+
             return SetBrush(pen.Brush, destinationSize);
         }
 
@@ -405,10 +405,10 @@ namespace Avalonia.Cairo.Media
         public void PopOpacityMask()
         {
             _context.PopGroupToSource();
-			var brushImpl = _maskStack.Pop ();
+            var brushImpl = _maskStack.Pop();
 
             _context.Mask(brushImpl.PlatformBrush);
-			brushImpl.Dispose ();
+            brushImpl.Dispose();
         }
     }
 }

+ 2 - 6
src/Gtk/Avalonia.Cairo/Media/ImageBrushImpl.cs

@@ -1,16 +1,12 @@
-using System;
-using Avalonia.Cairo.Media.Imaging;
 using Avalonia.Media;
 using Avalonia.Platform;
 using Avalonia.Rendering.Utilities;
-using Gdk;
-using Avalonia.Media;
 using global::Cairo;
 
 namespace Avalonia.Cairo.Media
 {
-	public class ImageBrushImpl : BrushImpl
-	{
+    public class ImageBrushImpl : BrushImpl
+    {
         public ImageBrushImpl(
             ITileBrush brush,
             IBitmapImpl bitmap,

+ 0 - 55
src/Gtk/Avalonia.Cairo/Media/TileBrushes.cs

@@ -1,55 +0,0 @@
-// Copyright (c) The Avalonia Project. All rights reserved.
-// Licensed under the MIT license. See licence.md file in the project root for full license information.
-
-using System;
-using Cairo;
-using Avalonia.Cairo.Media.Imaging;
-using Avalonia.Layout;
-using Avalonia.Media;
-using Avalonia.Platform;
-using Avalonia.Rendering;
-using Avalonia.RenderHelpers;
-
-namespace Avalonia.Cairo.Media
-{
-    internal static class TileBrushes
-    {
-        public static SurfacePattern CreateTileBrush(ITileBrush brush, Size targetSize)
-        {
-            var helper = new TileBrushImplHelper(brush, targetSize);
-            if (!helper.IsValid)
-                return null;
-            
-			using (var intermediate = new ImageSurface(Format.ARGB32, (int)helper.IntermediateSize.Width, (int)helper.IntermediateSize.Height))
-            using (var ctx = new RenderTarget(intermediate).CreateDrawingContext())
-            {
-                helper.DrawIntermediate(ctx);
-
-                var result = new SurfacePattern(intermediate);
-
-                if ((brush.TileMode & TileMode.FlipXY) != 0)
-                {
-                    // TODO: Currently always FlipXY as that's all cairo supports natively. 
-                    // Support separate FlipX and FlipY by drawing flipped images to intermediate
-                    // surface.
-                    result.Extend = Extend.Reflect;
-                }
-                else
-                {
-                    result.Extend = Extend.Repeat;
-                }
-
-                if (brush.TileMode != TileMode.None)
-                {
-                    var matrix = result.Matrix;
-                    matrix.InitTranslate(-helper.DestinationRect.X, -helper.DestinationRect.Y);
-                    result.Matrix = matrix;
-                }
-
-                return result;
-            }
-        }
-
-      
-    }
-}

+ 0 - 15
src/Gtk/Avalonia.Cairo/Media/VisualBrushImpl.cs

@@ -1,15 +0,0 @@
-using System;
-using Avalonia.Media;
-using global::Cairo;
-
-namespace Avalonia.Cairo.Media
-{
-	public class VisualBrushImpl : BrushImpl
-	{
-		public VisualBrushImpl(IVisualBrush brush, Size destinationSize)
-		{
-			this.PlatformBrush = TileBrushes.CreateTileBrush(brush, destinationSize);
-		}
-	}
-}
-

+ 1 - 2
src/Shared/RenderHelpers/RenderHelpers.projitems

@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
     <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
@@ -11,6 +11,5 @@
   <ItemGroup>
     <Compile Include="$(MSBuildThisFileDirectory)ArcToHelper.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)QuadBezierHelper.cs" />
-    <Compile Include="$(MSBuildThisFileDirectory)TileBrushImplHelper.cs" />
   </ItemGroup>
 </Project>

+ 0 - 213
src/Shared/RenderHelpers/TileBrushImplHelper.cs

@@ -1,213 +0,0 @@
-// Copyright (c) The Avalonia Project. All rights reserved.
-// Licensed under the MIT license. See licence.md file in the project root for full license information.
-
-using Avalonia.Controls;
-using Avalonia.Media;
-using Avalonia.Rendering;
-using Avalonia.VisualTree;
-
-namespace Avalonia.RenderHelpers
-{
-    internal class TileBrushImplHelper
-    {
-        public Size IntermediateSize { get; }
-        public Rect DestinationRect { get; }
-        private readonly TileMode _tileMode;
-        private readonly Rect _sourceRect;
-        private readonly Vector _scale;
-        private readonly Vector _translate;
-        private readonly Size _imageSize;
-        private readonly IVisualBrush _visualBrush;
-        private readonly IImageBrush _imageBrush;
-        private readonly Matrix _transform;
-        private readonly Rect _drawRect;
-
-        public bool IsValid { get; }
-        
-        public TileBrushImplHelper(ITileBrush brush, Size targetSize)
-        {
-            _imageBrush = brush as IImageBrush;
-            _visualBrush = brush as IVisualBrush;
-            if (_imageBrush != null)
-            {
-                if (_imageBrush.Source == null)
-                    return;
-                _imageSize = new Size(_imageBrush.Source.PixelWidth, _imageBrush.Source.PixelHeight);
-                IsValid = true;
-            }
-            else if (_visualBrush != null)
-            {
-                var control = _visualBrush.Visual as IControl;
-
-                if (control != null)
-                {
-                    EnsureInitialized(control);
-                    _imageSize = control.Bounds.Size;
-                    IsValid = true;
-                }
-            }
-            else
-                return;
-
-            _tileMode = brush.TileMode;
-            _sourceRect = brush.SourceRect.ToPixels(_imageSize);
-            DestinationRect = brush.DestinationRect.ToPixels(targetSize);
-            _scale = brush.Stretch.CalculateScaling(DestinationRect.Size, _sourceRect.Size);
-            _translate = CalculateTranslate(brush, _sourceRect, DestinationRect, _scale);
-            IntermediateSize = CalculateIntermediateSize(_tileMode, targetSize, DestinationRect.Size);
-            _transform = CalculateIntermediateTransform(
-                _tileMode,
-                _sourceRect,
-                DestinationRect,
-                _scale,
-                _translate,
-                out _drawRect);
-        }
-
-        public bool NeedsIntermediateSurface
-        {
-            get
-            {
-                if (_imageBrush == null)
-                    return true;
-                if (_transform != Matrix.Identity)
-                    return true;
-                if (_sourceRect.Position != default(Point))
-                    return true;
-                if ((int) _sourceRect.Width != _imageBrush.Source.PixelWidth ||
-                    (int) _sourceRect.Height != _imageBrush.Source.PixelHeight)
-                    return true;
-                return false;
-            }
-        }
-
-        public T GetDirect<T>() => (T) _imageBrush?.Source.PlatformImpl;
-
-        public void DrawIntermediate(DrawingContext ctx)
-        {
-            using (ctx.PushClip(_drawRect))
-            using (ctx.PushPostTransform(_transform))
-            {
-                if (_imageBrush != null)
-                {
-                    var bmpRc = new Rect(0, 0, _imageBrush.Source.PixelWidth, _imageBrush.Source.PixelHeight);
-                    ctx.DrawImage(_imageBrush.Source, 1, bmpRc, bmpRc);
-                }
-                else if (_visualBrush != null)
-                {
-                    using (ctx.PushPostTransform(Matrix.CreateTranslation(-_visualBrush.Visual.Bounds.Position)))
-                    {
-                        ImmediateRenderer.Render(_visualBrush.Visual, ctx);
-                    }
-                }
-            }
-        }
-
-
-        /// <summary>
-        /// Calculates a translate based on an <see cref="ITileBrush"/>, a source and destination
-        /// rectangle and a scale.
-        /// </summary>
-        /// <param name="brush">The brush.</param>
-        /// <param name="sourceRect">The source rectangle.</param>
-        /// <param name="destinationRect">The destination rectangle.</param>
-        /// <param name="scale">The _scale factor.</param>
-        /// <returns>A vector with the X and Y _translate.</returns>
-
-        public static Vector CalculateTranslate(
-            ITileBrush brush,
-            Rect sourceRect,
-            Rect destinationRect,
-            Vector scale)
-        {
-            var x = 0.0;
-            var y = 0.0;
-            var size = sourceRect.Size*scale;
-
-            switch (brush.AlignmentX)
-            {
-                case AlignmentX.Center:
-                    x += (destinationRect.Width - size.Width)/2;
-                    break;
-                case AlignmentX.Right:
-                    x += destinationRect.Width - size.Width;
-                    break;
-            }
-
-            switch (brush.AlignmentY)
-            {
-                case AlignmentY.Center:
-                    y += (destinationRect.Height - size.Height)/2;
-                    break;
-                case AlignmentY.Bottom:
-                    y += destinationRect.Height - size.Height;
-                    break;
-            }
-
-            return new Vector(x, y);
-        }
-
-        public static Matrix CalculateIntermediateTransform(
-            TileMode tileMode,
-            Rect sourceRect,
-            Rect destinationRect,
-            Vector scale,
-            Vector translate,
-            out Rect drawRect)
-        {
-            var transform = Matrix.CreateTranslation(-sourceRect.Position)*
-                            Matrix.CreateScale(scale)*
-                            Matrix.CreateTranslation(translate);
-            Rect dr;
-
-            if (tileMode == TileMode.None)
-            {
-                dr = destinationRect;
-                transform *= Matrix.CreateTranslation(destinationRect.Position);
-            }
-            else
-            {
-                dr = new Rect(destinationRect.Size);
-            }
-
-            drawRect = dr;
-
-            return transform;
-        }
-
-        public static void EnsureInitialized(IVisual visual)
-        {
-            var control = visual as IControl;
-
-            if (control != null)
-            {
-                foreach (var i in control.GetSelfAndVisualDescendents())
-                {
-                    var c = i as IControl;
-
-                    if (c?.IsInitialized == false)
-                    {
-                        var init = c as ISupportInitialize;
-
-                        if (init != null)
-                        {
-                            init.BeginInit();
-                            init.EndInit();
-                        }
-                    }
-                }
-
-                if (!control.IsArrangeValid)
-                {
-                    control.Measure(Size.Infinity);
-                    control.Arrange(new Rect(control.DesiredSize));
-                }
-            }
-        }
-
-        private static Size CalculateIntermediateSize(
-            TileMode tileMode,
-            Size targetSize,
-            Size destinationSize) => tileMode == TileMode.None ? targetSize : destinationSize;
-    }
-}

+ 2 - 2
src/Skia/Avalonia.Skia/BitmapImpl.cs

@@ -72,10 +72,10 @@ namespace Avalonia.Skia
         {
             private readonly SKSurface _surface;
 
-            public BitmapDrawingContext(SKBitmap bitmap, IVisualBrushRenderer visualBrushRenderer) 
+            public BitmapDrawingContext(SKBitmap bitmap, IVisualBrushRenderer visualBrushRenderer)
                 : this(CreateSurface(bitmap), visualBrushRenderer)
             {
-                
+
             }
 
             private static SKSurface CreateSurface(SKBitmap bitmap)

+ 1 - 3
src/Skia/Avalonia.Skia/DrawingContextImpl.cs

@@ -1,13 +1,11 @@
 using Avalonia.Media;
-using Avalonia.Media.Imaging;
-using Avalonia.RenderHelpers;
 using SkiaSharp;
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using Avalonia.Platform;
-using Avalonia.Rendering.Utilities;
 using Avalonia.Rendering;
+using Avalonia.Rendering.Utilities;
 
 namespace Avalonia.Skia
 {

+ 3 - 3
src/Skia/Avalonia.Skia/FramebufferRenderTarget.cs

@@ -70,9 +70,9 @@ namespace Avalonia.Skia
                 throw new Exception("Unable to create a surface for pixel format " + fb.Format +
                                     " or pixel format translator");
             var canvas = surface.Canvas;
-            
-            
-            
+
+
+
             canvas.RestoreToCount(0);
             canvas.Save();
             canvas.ResetMatrix();

+ 1 - 0
src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj

@@ -81,6 +81,7 @@
     <Compile Include="Media\DrawingContextImpl.cs" />
     <Compile Include="Media\GeometryImpl.cs" />
     <Compile Include="Media\Imaging\RenderTargetBitmapImpl.cs" />
+    <Compile Include="Media\ImageBrushImpl.cs" />
     <Compile Include="Media\Imaging\BitmapImpl.cs" />
     <Compile Include="Media\Imaging\D2DBitmapImpl.cs" />
     <Compile Include="Media\Imaging\WicBitmapImpl.cs" />

+ 0 - 1
src/Windows/Avalonia.Direct2D1/Direct2D1Platform.cs

@@ -105,7 +105,6 @@ namespace Avalonia.Direct2D1
                 spans);
         }
 
-
         public IRenderTarget CreateRenderTarget(IEnumerable<object> surfaces)
         {
             var nativeWindow = surfaces?.OfType<IPlatformHandle>().FirstOrDefault();

+ 3 - 3
src/Windows/Avalonia.Direct2D1/Media/DrawingContextImpl.cs

@@ -71,10 +71,10 @@ namespace Avalonia.Direct2D1.Media
             try
             {
                 _renderTarget.EndDraw();
-                
+
                 _swapChain?.Present(1, SharpDX.DXGI.PresentFlags.None);
             }
-            catch (SharpDXException ex) when((uint)ex.HResult == 0x8899000C) // D2DERR_RECREATE_TARGET
+            catch (SharpDXException ex) when ((uint)ex.HResult == 0x8899000C) // D2DERR_RECREATE_TARGET
             {
                 throw new RenderTargetCorruptedException(ex);
             }
@@ -306,7 +306,7 @@ namespace Avalonia.Direct2D1.Media
                 {
                     ContentBounds = PrimitiveExtensions.RectangleInfinite,
                     MaskTransform = PrimitiveExtensions.Matrix3x2Identity,
-                    Opacity = (float) opacity,
+                    Opacity = (float)opacity,
                 };
 
                 var layer = _layerPool.Count != 0 ? _layerPool.Pop() : new Layer(_renderTarget);

+ 1 - 2
src/Windows/Avalonia.Direct2D1/Media/Imaging/RenderTargetBitmapImpl.cs

@@ -2,7 +2,6 @@
 // Licensed under the MIT license. See licence.md file in the project root for full license information.
 
 using System;
-using Avalonia.Media;
 using Avalonia.Platform;
 using Avalonia.Rendering;
 using SharpDX.Direct2D1;
@@ -49,6 +48,6 @@ namespace Avalonia.Direct2D1.Media
         public IDrawingContextImpl CreateDrawingContext(IVisualBrushRenderer visualBrushRenderer)
         {
             return new DrawingContextImpl(visualBrushRenderer, _target, _dwriteFactory);
-        }        
+        }
     }
 }

+ 0 - 78
src/Windows/Avalonia.Direct2D1/Media/TileBrushImpl.cs

@@ -1,78 +0,0 @@
-// Copyright (c) The Avalonia Project. All rights reserved.
-// Licensed under the MIT license. See licence.md file in the project root for full license information.
-
-using Avalonia.Media;
-using Avalonia.RenderHelpers;
-using SharpDX.Direct2D1;
-
-namespace Avalonia.Direct2D1.Media
-{
-    public sealed class TileBrushImpl : BrushImpl
-    {
-        public TileBrushImpl(
-            ITileBrush brush,
-            SharpDX.Direct2D1.RenderTarget target,
-            Size targetSize)
-        {
-            var helper = new TileBrushImplHelper(brush, targetSize);
-            if (!helper.IsValid)
-                return;
-
-            using (var intermediate = new BitmapRenderTarget(target, CompatibleRenderTargetOptions.None, helper.IntermediateSize.ToSharpDX()))
-            {
-                using (var ctx = new RenderTarget(intermediate).CreateDrawingContext())
-                {
-                    intermediate.Clear(null);
-                    helper.DrawIntermediate(ctx);
-                }
-
-                PlatformBrush = new BitmapBrush(
-                    target,
-                    intermediate.Bitmap,
-                    GetBitmapBrushProperties(brush),
-                    GetBrushProperties(brush, helper.DestinationRect));
-            }
-        }
-
-        private static BrushProperties GetBrushProperties(ITileBrush brush, Rect destinationRect)
-        {
-            var tileTransform = 
-                brush.TileMode != TileMode.None ? 
-                Matrix.CreateTranslation(destinationRect.X, destinationRect.Y) :
-                Matrix.Identity;
-
-            return new BrushProperties
-            {
-                Opacity = (float)brush.Opacity,
-                Transform = tileTransform.ToDirect2D(),
-            };
-        }
-
-        private static BitmapBrushProperties GetBitmapBrushProperties(ITileBrush brush)
-        {
-            var tileMode = brush.TileMode;
-
-            return new BitmapBrushProperties
-            {
-                ExtendModeX = GetExtendModeX(tileMode),
-                ExtendModeY = GetExtendModeY(tileMode),
-            };
-        }
-
-        private static ExtendMode GetExtendModeX(TileMode tileMode)
-        {
-            return (tileMode & TileMode.FlipX) != 0 ? ExtendMode.Mirror : ExtendMode.Wrap;
-        }
-
-        private static ExtendMode GetExtendModeY(TileMode tileMode)
-        {
-            return (tileMode & TileMode.FlipY) != 0 ? ExtendMode.Mirror : ExtendMode.Wrap;
-        }
-
-        public override void Dispose()
-        {
-            ((BitmapBrush)PlatformBrush)?.Bitmap.Dispose();
-            base.Dispose();
-        }
-    }
-}

+ 1 - 2
src/Windows/Avalonia.Direct2D1/RenderTarget.cs

@@ -3,7 +3,6 @@
 
 using System;
 using Avalonia.Direct2D1.Media;
-using Avalonia.Media;
 using Avalonia.Platform;
 using Avalonia.Rendering;
 using SharpDX.Direct2D1;
@@ -48,7 +47,7 @@ namespace Avalonia.Direct2D1
         /// <summary>
         /// Creates a drawing context for a rendering session.
         /// </summary>
-        /// <returns>An <see cref="Avalonia.Media.DrawingContext"/>.</returns>
+        /// <returns>An <see cref="Avalonia.Platform.IDrawingContextImpl"/>.</returns>
         public IDrawingContextImpl CreateDrawingContext(IVisualBrushRenderer visualBrushRenderer)
         {
             return new DrawingContextImpl(visualBrushRenderer, _renderTarget, DirectWriteFactory);

+ 3 - 9
src/Windows/Avalonia.Direct2D1/SwapChainRenderTarget.cs

@@ -1,13 +1,5 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Avalonia.Direct2D1.Media;
-using Avalonia.Media;
 using Avalonia.Platform;
-using Avalonia.Rendering;
-using Avalonia.Win32.Interop;
 using SharpDX;
 using SharpDX.Direct2D1;
 using SharpDX.DXGI;
@@ -16,6 +8,8 @@ using AlphaMode = SharpDX.Direct2D1.AlphaMode;
 using Device = SharpDX.Direct2D1.Device;
 using Factory = SharpDX.Direct2D1.Factory;
 using Factory2 = SharpDX.DXGI.Factory2;
+using Avalonia.Rendering;
+using Avalonia.Direct2D1.Media;
 
 namespace Avalonia.Direct2D1
 {
@@ -58,7 +52,7 @@ namespace Avalonia.Direct2D1
         /// <summary>
         /// Creates a drawing context for a rendering session.
         /// </summary>
-        /// <returns>An <see cref="Avalonia.Media.DrawingContext"/>.</returns>
+        /// <returns>An <see cref="Avalonia.Platform.IDrawingContextImpl"/>.</returns>
         public IDrawingContextImpl CreateDrawingContext(IVisualBrushRenderer visualBrushRenderer)
         {
             var size = GetWindowSize();

+ 0 - 1
tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj

@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <TargetFrameworks>net461;netcoreapp1.1</TargetFrameworks>
-    <EnableDefaultCompileItems>False</EnableDefaultCompileItems>
     <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

+ 1 - 1
tests/Avalonia.Visuals.UnitTests/VisualTests.cs

@@ -161,7 +161,7 @@ namespace Avalonia.Visuals.UnitTests
                 root.Child = child;
 
                 renderer.Verify(x => x.AddDirty(child));
-            }                
+            }
         }
 
         [Fact]

+ 1 - 1
tests/Avalonia.Visuals.UnitTests/VisualTree/VisualExtensionsTests_GetVisualsAt.cs

@@ -55,7 +55,7 @@ namespace Avalonia.Visuals.UnitTests.VisualTree
                 var container = new TestRoot
                 {
                     Width = 200,
-                    Height = 200,                    
+                    Height = 200,
                     Child = new Border
                     {
                         Width = 100,