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

Use the new GLControl packages for WinForms #2989

Merged
merged 4 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="OpenTK" Version="3.1.0" NoWarn="NU1701" />
<PackageReference Include="OpenTK.GLControl" Version="3.1.0" NoWarn="NU1701" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\..\binding\SkiaSharp\SkiaSharp.csproj" />
<ProjectReference Include="..\..\..\..\source\SkiaSharp.Views\SkiaSharp.Views.Desktop.Common\SkiaSharp.Views.Desktop.Common.csproj" />
Expand Down
5 changes: 3 additions & 2 deletions source/SkiaSharp.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@

<!-- .NET Standard, .NET Framework and .NET -->
<PropertyGroup>
<BasicTargetFrameworksCurrent>netstandard2.0;netstandard2.1;net462;$(TFMCurrent)</BasicTargetFrameworksCurrent>
<FullFrameworkTargetFrameworks>net462</FullFrameworkTargetFrameworks>
<BasicTargetFrameworksCurrent>netstandard2.0;netstandard2.1;$(FullFrameworkTargetFrameworks);$(TFMCurrent)</BasicTargetFrameworksCurrent>
<PlatformTargetFrameworksCurrent Condition="!$(IsLinux)">$(TFMCurrent)-ios$(TPViOSCurrent);$(TFMCurrent)-maccatalyst$(TPVMacCatalystCurrent);$(TFMCurrent)-android$(TPVAndroidCurrent)</PlatformTargetFrameworksCurrent>
<PlatformTargetFrameworksCurrent Condition="!$(IsLinux) and $(IsNetTizenSupported)">$(PlatformTargetFrameworksCurrent);$(TFMCurrent)-tizen$(TPVTizenCurrent)</PlatformTargetFrameworksCurrent>
<PlatformTargetFrameworksCurrent Condition="!$(IsLinux) and $(IsNetTVOSSupported)">$(PlatformTargetFrameworksCurrent);$(TFMCurrent)-tvos$(TPVtvOSCurrent)</PlatformTargetFrameworksCurrent>
Expand Down Expand Up @@ -151,7 +152,7 @@

<!-- Windows Desktop TFMs -->
<PropertyGroup>
<WindowsDesktopTargetFrameworks>net462</WindowsDesktopTargetFrameworks>
<WindowsDesktopTargetFrameworks></WindowsDesktopTargetFrameworks>
<WindowsDesktopTargetFrameworks Condition="$(IsWindows)">$(WindowsDesktopTargetFrameworks);$(WindowsTargetFrameworks)</WindowsDesktopTargetFrameworks>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(WindowsDesktopTargetFrameworks)</TargetFrameworks>
<TargetFrameworks>$(FullFrameworkTargetFrameworks);$(WindowsDesktopTargetFrameworks)</TargetFrameworks>
<UseWPF>true</UseWPF>
<RootNamespace>SkiaSharp.Views.WPF</RootNamespace>
<AssemblyName>SkiaSharp.Views.WPF</AssemblyName>
<PackagingGroup>SkiaSharp.Views.WPF</PackagingGroup>
<DefineConstants>$(DefineConstants);__DESKTOP__;__WPF__</DefineConstants>
<Title>SkiaSharp Views &amp; Layers for Windows Presentation Foundation (WPF)</Title>
<SignAssembly Condition="'$(TargetFramework)' != 'net462'">false</SignAssembly>
<SignAssembly Condition="!$(TargetFramework.StartsWith('net4'))">false</SignAssembly>
<PackageTags>wpf</PackageTags>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
<PackageReference Include="OpenTK" Version="3.3.1" NoWarn="NU1701" />
<PackageReference Include="OpenTK.GLWpfControl" Version="3.3.0" NoWarn="NU1701" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net462'">
<ItemGroup Condition="!$(TargetFramework.StartsWith('net4'))">
<PackageReference Include="OpenTK" Version="4.3.0" NoWarn="NU1701" />
<PackageReference Include="OpenTK.GLWpfControl" Version="4.2.3" />
</ItemGroup>
Expand Down
17 changes: 17 additions & 0 deletions source/SkiaSharp.Views/SkiaSharp.Views.WindowsForms/SKGLControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
using System.ComponentModel;
using System.Windows.Forms;
using OpenTK;
#if WINDOWS
using OpenTK.GLControl;
#endif
using OpenTK.Graphics;
using OpenTK.Graphics.ES20;

Expand All @@ -24,6 +27,19 @@ public class SKGLControl : GLControl

private SKSizeI lastSize;

#if WINDOWS
public SKGLControl()
: base(new GLControlSettings { AlphaBits = 8, RedBits = 8, GreenBits = 8, BlueBits = 8, DepthBits = 24, StencilBits = 8 })
{
Initialize();
}

public SKGLControl(GLControlSettings settings)
: base(settings)
{
Initialize();
}
#else
public SKGLControl()
: base(new GraphicsMode(new ColorFormat(8, 8, 8, 8), 24, 8))
{
Expand All @@ -41,6 +57,7 @@ public SKGLControl(GraphicsMode mode, int major, int minor, GraphicsContextFlags
{
Initialize();
}
#endif

private void Initialize()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(WindowsDesktopTargetFrameworks)</TargetFrameworks>
<TargetFrameworks>$(FullFrameworkTargetFrameworks);$(WindowsDesktopTargetFrameworks)</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<RootNamespace>SkiaSharp.Views.Desktop</RootNamespace>
<AssemblyName>SkiaSharp.Views.WindowsForms</AssemblyName>
<PackagingGroup>SkiaSharp.Views.WindowsForms</PackagingGroup>
<DefineConstants>$(DefineConstants);__DESKTOP__;__WINFORMS__</DefineConstants>
<Title>SkiaSharp Views &amp; Layers for Windows.Forms</Title>
<PackageTags>windows.forms;winforms</PackageTags>
<SignAssembly Condition="!$(TargetFramework.StartsWith('net4'))">false</SignAssembly>
</PropertyGroup>
<ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
<PackageReference Include="OpenTK" Version="3.1.0" NoWarn="NU1701" />
<PackageReference Include="OpenTK.GLControl" Version="3.1.0" NoWarn="NU1701" />
</ItemGroup>
<ItemGroup Condition="!$(TargetFramework.StartsWith('net4'))">
<PackageReference Include="OpenTK" Version="4.8.2" />
<PackageReference Include="OpenTK.GLControl" Version="4.0.1" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
<Reference Include="System.Windows.Forms" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(PlatformTargetFrameworks);$(WindowsDesktopTargetFrameworks)</TargetFrameworks>
<TargetFrameworks>$(PlatformTargetFrameworks);$(FullFrameworkTargetFrameworks);$(WindowsDesktopTargetFrameworks)</TargetFrameworks>
<PackagingGroup>SkiaSharp.Views</PackagingGroup>
<PackageId>SkiaSharp.Views</PackageId>
<Title>SkiaSharp Views &amp; Layers for Android, iOS, Mac Catalyst, macOS, and tvOS</Title>
Expand Down
Loading