Browse Source

Update to SharpDX 3.0.0 official release.

pull/386/head
Amer Koleci 11 years ago
parent
commit
e2ab8171b3
  1. 7
      Perspex.sln
  2. 6
      nuget/template/Perspex.Desktop.nuspec
  3. 10
      samples/ControlCatalog/App.config
  4. 2
      src/Skia/Perspex.Skia.Android.TestApp/Perspex.Skia.Android.TestApp.csproj
  5. 2
      src/Skia/Perspex.Skia.Android/Perspex.Skia.Android.csproj
  6. 15
      src/Windows/Perspex.Direct2D1/Media/DrawingContext.cs
  7. 4
      src/Windows/Perspex.Direct2D1/Media/FormattedTextImpl.cs
  8. 2
      src/Windows/Perspex.Direct2D1/Media/LinearGradientBrushImpl.cs
  9. 5
      src/Windows/Perspex.Direct2D1/Media/PerspexTextRenderer.cs
  10. 2
      src/Windows/Perspex.Direct2D1/Media/RadialGradientBrushImpl.cs
  11. 2
      src/Windows/Perspex.Direct2D1/Media/SolidColorBrushImpl.cs
  12. 11
      src/Windows/Perspex.Direct2D1/Media/TileBrushImpl.cs
  13. 25
      src/Windows/Perspex.Direct2D1/Perspex.Direct2D1.csproj
  14. 79
      src/Windows/Perspex.Direct2D1/PrimitiveExtensions.cs
  15. 6
      src/Windows/Perspex.Direct2D1/packages.config

7
Perspex.sln

@ -148,18 +148,19 @@ Global
src\Shared\PlatformSupport\PlatformSupport.projitems*{e4d9629c-f168-4224-3f51-a5e482ffbc42}*SharedItemsImports = 13
src\Skia\Perspex.Skia\Perspex.Skia.projitems*{2f59f3d0-748d-4652-b01e-e0d954756308}*SharedItemsImports = 13
src\Shared\PlatformSupport\PlatformSupport.projitems*{db070a10-bf39-4752-8456-86e9d5928478}*SharedItemsImports = 4
src\Shared\RenderHelpers\RenderHelpers.projitems*{925dd807-b651-475f-9f7c-cbeb974ce43d}*SharedItemsImports = 4
src\Skia\Perspex.Skia\Perspex.Skia.projitems*{925dd807-b651-475f-9f7c-cbeb974ce43d}*SharedItemsImports = 4
src\Shared\RenderHelpers\RenderHelpers.projitems*{925dd807-b651-475f-9f7c-cbeb974ce43d}*SharedItemsImports = 4
samples\TestApplicationShared\TestApplicationShared.projitems*{78345174-5b52-4a14-b9fd-d5f2428137f0}*SharedItemsImports = 13
src\Shared\PlatformSupport\PlatformSupport.projitems*{54f237d5-a70a-4752-9656-0c70b1a7b047}*SharedItemsImports = 4
samples\TestApplicationShared\TestApplicationShared.projitems*{ff69b927-c545-49ae-8e16-3d14d621aa12}*SharedItemsImports = 4
src\Shared\RenderHelpers\RenderHelpers.projitems*{3c4c0cb4-0c0f-4450-a37b-148c84ff905f}*SharedItemsImports = 13
src\Shared\PlatformSupport\PlatformSupport.projitems*{811a76cf-1cf6-440f-963b-bbe31bd72a82}*SharedItemsImports = 4
src\Shared\RenderHelpers\RenderHelpers.projitems*{47be08a7-5985-410b-9ffc-2264b8ea595f}*SharedItemsImports = 4
src\Skia\Perspex.Skia\Perspex.Skia.projitems*{47be08a7-5985-410b-9ffc-2264b8ea595f}*SharedItemsImports = 4
src\Shared\RenderHelpers\RenderHelpers.projitems*{47be08a7-5985-410b-9ffc-2264b8ea595f}*SharedItemsImports = 4
samples\TestApplicationShared\TestApplicationShared.projitems*{8c923867-8a8f-4f6b-8b80-47d9e8436166}*SharedItemsImports = 4
samples\TestApplicationShared\TestApplicationShared.projitems*{e3a1060b-50d0-44e8-88b6-f44ef2e5bd72}*SharedItemsImports = 4
src\Shared\RenderHelpers\RenderHelpers.projitems*{bd43f7c0-396b-4aa1-bad9-dfde54d51298}*SharedItemsImports = 4
src\Skia\Perspex.Skia\Perspex.Skia.projitems*{bd43f7c0-396b-4aa1-bad9-dfde54d51298}*SharedItemsImports = 4
src\Shared\RenderHelpers\RenderHelpers.projitems*{bd43f7c0-396b-4aa1-bad9-dfde54d51298}*SharedItemsImports = 4
src\Shared\RenderHelpers\RenderHelpers.projitems*{3e908f67-5543-4879-a1dc-08eace79b3cd}*SharedItemsImports = 4
src\Shared\PlatformSupport\PlatformSupport.projitems*{e1aa3dbf-9056-4530-9376-18119a7a3ffe}*SharedItemsImports = 4
EndGlobalSection

6
nuget/template/Perspex.Desktop.nuspec

@ -21,9 +21,9 @@
<dependency id="Rx-Linq" version="2.2.5" />
<dependency id="Rx-Main" version="2.2.5" />
<dependency id="Rx-PlatformServices" version="2.2.5" />
<dependency id="SharpDX" version="2.6.3"/>
<dependency id="SharpDX.Direct2D1" version="2.6.3"/>
<dependency id="SharpDX.DXGI" version="2.6.3"/>
<dependency id="SharpDX" version="3.0.0"/>
<dependency id="SharpDX.Direct2D1" version="3.0.0"/>
<dependency id="SharpDX.DXGI" version="3.0.0"/>
<dependency id="Perspex" version="#VERSION#" />
</dependencies>
</metadata>

10
samples/ControlCatalog/App.config

@ -1,6 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Mono.Cairo" publicKeyToken="0738eb9f132ed756" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

2
src/Skia/Perspex.Skia.Android.TestApp/Perspex.Skia.Android.TestApp.csproj

@ -16,7 +16,7 @@
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v5.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

2
src/Skia/Perspex.Skia.Android/Perspex.Skia.Android.csproj

@ -15,7 +15,7 @@
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v5.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>

15
src/Windows/Perspex.Direct2D1/Media/DrawingContext.cs

@ -9,6 +9,7 @@ using Perspex.Media;
using SharpDX;
using SharpDX.Direct2D1;
using IBitmap = Perspex.Media.Imaging.IBitmap;
using SharpDX.Mathematics.Interop;
namespace Perspex.Direct2D1.Media
{
@ -218,11 +219,11 @@ namespace Perspex.Direct2D1.Media
_renderTarget.FillRoundedRectangle(
new RoundedRectangle
{
Rect = new RectangleF(
Rect = new RawRectangleF(
(float)rect.X,
(float)rect.Y,
(float)rect.Width,
(float)rect.Height),
(float)rect.Right,
(float)rect.Bottom),
RadiusX = cornerRadius,
RadiusY = cornerRadius
},
@ -260,8 +261,8 @@ namespace Perspex.Direct2D1.Media
{
var parameters = new LayerParameters
{
ContentBounds = RectangleF.Infinite,
MaskTransform = Matrix3x2.Identity,
ContentBounds = PrimitiveExtensions.RectangleInfinite,
MaskTransform = PrimitiveExtensions.Matrix3x2Identity,
Opacity = (float) opacity,
};
@ -295,8 +296,8 @@ namespace Perspex.Direct2D1.Media
var solidColorBrush = brush as Perspex.Media.SolidColorBrush;
var linearGradientBrush = brush as Perspex.Media.LinearGradientBrush;
var radialGradientBrush = brush as Perspex.Media.RadialGradientBrush;
var imageBrush = brush as ImageBrush;
var visualBrush = brush as VisualBrush;
var imageBrush = brush as Perspex.Media.ImageBrush;
var visualBrush = brush as Perspex.Media.VisualBrush;
if (solidColorBrush != null)
{

4
src/Windows/Perspex.Direct2D1/Media/FormattedTextImpl.cs

@ -68,8 +68,8 @@ namespace Perspex.Direct2D1.Media
public TextHitTestResult HitTestPoint(Point point)
{
SharpDX.Bool isTrailingHit;
SharpDX.Bool isInside;
SharpDX.Mathematics.Interop.RawBool isTrailingHit;
SharpDX.Mathematics.Interop.RawBool isInside;
var result = TextLayout.HitTestPoint(
(float)point.X,

2
src/Windows/Perspex.Direct2D1/Media/LinearGradientBrushImpl.cs

@ -41,7 +41,7 @@ namespace Perspex.Direct2D1.Media
new SharpDX.Direct2D1.BrushProperties
{
Opacity = (float)brush.Opacity,
Transform = SharpDX.Matrix3x2.Identity,
Transform = PrimitiveExtensions.Matrix3x2Identity,
},
stops);
}

5
src/Windows/Perspex.Direct2D1/Media/PerspexTextRenderer.cs

@ -5,6 +5,7 @@ using System;
using SharpDX;
using SharpDX.Direct2D1;
using SharpDX.DirectWrite;
using SharpDX.Mathematics.Interop;
namespace Perspex.Direct2D1.Media
{
@ -54,7 +55,7 @@ namespace Perspex.Direct2D1.Media
_context.CreateBrush(wrapper.Brush, new Size()).PlatformBrush;
_renderTarget.DrawGlyphRun(
new Vector2(baselineOriginX, baselineOriginY),
new RawVector2 { X = baselineOriginX, Y = baselineOriginY },
glyphRun,
brush,
measuringMode);
@ -82,7 +83,7 @@ namespace Perspex.Direct2D1.Media
throw new NotImplementedException();
}
public Matrix3x2 GetCurrentTransform(object clientDrawingContext)
public RawMatrix3x2 GetCurrentTransform(object clientDrawingContext)
{
return _renderTarget.Transform;
}

2
src/Windows/Perspex.Direct2D1/Media/RadialGradientBrushImpl.cs

@ -47,7 +47,7 @@ namespace Perspex.Direct2D1.Media
new SharpDX.Direct2D1.BrushProperties
{
Opacity = (float)brush.Opacity,
Transform = SharpDX.Matrix3x2.Identity,
Transform = PrimitiveExtensions.Matrix3x2Identity,
},
stops);
}

2
src/Windows/Perspex.Direct2D1/Media/SolidColorBrushImpl.cs

@ -9,7 +9,7 @@ namespace Perspex.Direct2D1.Media
{
PlatformBrush = new SharpDX.Direct2D1.SolidColorBrush(
target,
brush?.Color.ToDirect2D() ?? new SharpDX.Color4(),
brush?.Color.ToDirect2D() ?? new SharpDX.Mathematics.Interop.RawColor4(),
new SharpDX.Direct2D1.BrushProperties
{
Opacity = brush != null ? (float)brush.Opacity : 1.0f,

11
src/Windows/Perspex.Direct2D1/Media/TileBrushImpl.cs

@ -38,14 +38,15 @@ namespace Perspex.Direct2D1.Media
private static BrushProperties GetBrushProperties(TileBrush 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 = brush.TileMode != TileMode.None ?
SharpDX.Matrix3x2.Translation(
(float)destinationRect.X,
(float)destinationRect.Y) :
SharpDX.Matrix3x2.Identity,
Transform = tileTransform.ToDirect2D(),
};
}

25
src/Windows/Perspex.Direct2D1/Perspex.Direct2D1.csproj

@ -35,17 +35,17 @@
<DocumentationFile>bin\Release\Perspex.Direct2D1.XML</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="SharpDX, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(SharpDXPackageBinDir)\SharpDX.dll</HintPath>
<Reference Include="SharpDX, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\SharpDX.3.0.0\lib\net45\SharpDX.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SharpDX.Direct2D1, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(SharpDXPackageBinDir)\SharpDX.Direct2D1.dll</HintPath>
<Reference Include="SharpDX.Direct2D1, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\SharpDX.Direct2D1.3.0.0\lib\net45\SharpDX.Direct2D1.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SharpDX.DXGI, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(SharpDXPackageBinDir)\SharpDX.DXGI.dll</HintPath>
<Reference Include="SharpDX.DXGI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\SharpDX.DXGI.3.0.0\lib\net45\SharpDX.DXGI.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@ -117,13 +117,6 @@
</ItemGroup>
<Import Project="..\..\Shared\RenderHelpers\RenderHelpers.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\..\packages\SharpDX.2.6.3\build\SharpDX.targets" Condition="Exists('..\..\..\packages\SharpDX.2.6.3\build\SharpDX.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\SharpDX.2.6.3\build\SharpDX.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\SharpDX.2.6.3\build\SharpDX.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

79
src/Windows/Perspex.Direct2D1/PrimitiveExtensions.cs

@ -5,25 +5,50 @@ using System;
using System.Linq;
using SharpDX;
using SharpDX.Direct2D1;
using SharpDX.Mathematics.Interop;
using DWrite = SharpDX.DirectWrite;
namespace Perspex.Direct2D1
{
public static class PrimitiveExtensions
{
public static Rect ToPerspex(this RectangleF r)
/// <summary>
/// The value for which all absolute numbers smaller than are considered equal to zero.
/// </summary>
public const float ZeroTolerance = 1e-6f; // Value a 8x higher than 1.19209290E-07F
public static readonly RawRectangleF RectangleInfinite;
/// <summary>
/// Gets the identity matrix.
/// </summary>
/// <value>The identity matrix.</value>
public readonly static RawMatrix3x2 Matrix3x2Identity = new RawMatrix3x2 { M11 = 1, M12 = 0, M21 = 0, M22 = 1, M31 = 0, M32 = 0 };
static PrimitiveExtensions()
{
return new Rect(r.X, r.Y, r.Width, r.Height);
RectangleInfinite = new RawRectangleF
{
Left = float.NegativeInfinity,
Top = float.NegativeInfinity,
Right = float.PositiveInfinity,
Bottom = float.PositiveInfinity
};
}
public static RectangleF ToSharpDX(this Rect r)
public static Rect ToPerspex(this RawRectangleF r)
{
return new RectangleF((float)r.X, (float)r.Y, (float)r.Width, (float)r.Height);
return new Rect(new Point(r.Left, r.Top), new Point(r.Right, r.Bottom));
}
public static Vector2 ToSharpDX(this Point p)
public static RawRectangleF ToSharpDX(this Rect r)
{
return new Vector2((float)p.X, (float)p.Y);
return new RawRectangleF((float)r.X, (float)r.Y, (float)r.Right, (float)r.Bottom);
}
public static RawVector2 ToSharpDX(this Point p)
{
return new RawVector2 { X = (float)p.X, Y = (float)p.Y };
}
public static Size2F ToSharpDX(this Size p)
@ -95,9 +120,9 @@ namespace Perspex.Direct2D1
/// </summary>
/// <param name="color">The color to convert.</param>
/// <returns>The Direct2D color.</returns>
public static Color4 ToDirect2D(this Perspex.Media.Color color)
public static RawColor4 ToDirect2D(this Perspex.Media.Color color)
{
return new Color4(
return new RawColor4(
(float)(color.R / 255.0),
(float)(color.G / 255.0),
(float)(color.B / 255.0),
@ -105,27 +130,29 @@ namespace Perspex.Direct2D1
}
/// <summary>
/// Converts a Perspex <see cref="Perspex.Matrix"/> to a Direct2D <see cref="Matrix3x2"/>
/// Converts a Perspex <see cref="Perspex.Matrix"/> to a Direct2D <see cref="RawMatrix3x2"/>
/// </summary>
/// <param name="matrix">The <see cref="Matrix"/>.</param>
/// <returns>The <see cref="Matrix3x2"/>.</returns>
public static Matrix3x2 ToDirect2D(this Matrix matrix)
/// <returns>The <see cref="RawMatrix3x2"/>.</returns>
public static RawMatrix3x2 ToDirect2D(this Matrix matrix)
{
return new Matrix3x2(
(float)matrix.M11,
(float)matrix.M12,
(float)matrix.M21,
(float)matrix.M22,
(float)matrix.M31,
(float)matrix.M32);
return new RawMatrix3x2
{
M11 = (float)matrix.M11,
M12 = (float)matrix.M12,
M21 = (float)matrix.M21,
M22 = (float)matrix.M22,
M31 = (float)matrix.M31,
M32 = (float)matrix.M32
};
}
/// <summary>
/// Converts a Direct2D <see cref="Matrix3x2"/> to a Perspex <see cref="Perspex.Matrix"/>.
/// Converts a Direct2D <see cref="RawMatrix3x2"/> to a Perspex <see cref="Perspex.Matrix"/>.
/// </summary>
/// <param name="matrix">The matrix</param>
/// <returns>a <see cref="Perspex.Matrix"/>.</returns>
public static Matrix ToPerspex(this Matrix3x2 matrix)
public static Matrix ToPerspex(this RawMatrix3x2 matrix)
{
return new Matrix(
matrix.M11,
@ -137,17 +164,17 @@ namespace Perspex.Direct2D1
}
/// <summary>
/// Converts a Perspex <see cref="Rect"/> to a Direct2D <see cref="RectangleF"/>
/// Converts a Perspex <see cref="Rect"/> to a Direct2D <see cref="RawRectangleF"/>
/// </summary>
/// <param name="rect">The <see cref="Rect"/>.</param>
/// <returns>The <see cref="RectangleF"/>.</returns>
public static RectangleF ToDirect2D(this Rect rect)
/// <returns>The <see cref="RawRectangleF"/>.</returns>
public static RawRectangleF ToDirect2D(this Rect rect)
{
return new RectangleF(
return new RawRectangleF(
(float)rect.X,
(float)rect.Y,
(float)rect.Width,
(float)rect.Height);
(float)rect.Right,
(float)rect.Bottom);
}
public static DWrite.TextAlignment ToDirect2D(this Perspex.Media.TextAlignment alignment)

6
src/Windows/Perspex.Direct2D1/packages.config

@ -3,7 +3,7 @@
<package id="Rx-Core" version="2.2.5" targetFramework="net45" />
<package id="Rx-Interfaces" version="2.2.5" targetFramework="net45" />
<package id="Rx-PlatformServices" version="2.2.5" targetFramework="net45" />
<package id="SharpDX" version="2.6.3" targetFramework="net45" />
<package id="SharpDX.Direct2D1" version="2.6.3" targetFramework="net45" />
<package id="SharpDX.DXGI" version="2.6.3" targetFramework="net45" />
<package id="SharpDX" version="3.0.0" targetFramework="net45" />
<package id="SharpDX.Direct2D1" version="3.0.0" targetFramework="net45" />
<package id="SharpDX.DXGI" version="3.0.0" targetFramework="net45" />
</packages>
Loading…
Cancel
Save