Skip to content

Commit

Permalink
SkiaSharp: revert breaks android and osx
Browse files Browse the repository at this point in the history
  • Loading branch information
meee1 committed Aug 23, 2024
1 parent 276dd5d commit ce96e3c
Show file tree
Hide file tree
Showing 23 changed files with 102 additions and 257 deletions.
2 changes: 1 addition & 1 deletion ExtLibs/Controls/MissionPlanner.Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="OpenTK.GLControl" Version="3.1.0" Condition="'$(TargetFramework)' != 'netstandard2.0'" />
<PackageReference Include="SkiaSharp" Version="2.88.8" />
<PackageReference Include="SkiaSharp" Version="2.80.2" />
<PackageReference Include="SkiaSharp.Views.Desktop.Common" Version="2.80.2" />
<PackageReference Include="System.Drawing.Primitives" Version="4.3.0" />

Expand Down
23 changes: 12 additions & 11 deletions ExtLibs/ImageVisualizer/src/ImageVisualizer14/ImageForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 9 additions & 35 deletions ExtLibs/ImageVisualizer/src/ImageVisualizer14/ImageForm.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Runtime.InteropServices;
Expand All @@ -20,37 +21,6 @@ public static Font UIFont
{
get
{
#if VS10
var dteProgID = "VisualStudio.DTE.10.0";
#elif VS11
var dteProgID = "VisualStudio.DTE.11.0";
#elif VS12
var dteProgID = "VisualStudio.DTE.12.0";
#elif VS13
var dteProgID = "VisualStudio.DTE.13.0";
#elif VS14
var dteProgID = "VisualStudio.DTE.14.0";
#elif VS15
var dteProgID = "VisualStudio.DTE.15.0";
#elif VS16
var dteProgID = "VisualStudio.DTE.18.0";
#endif
try
{
var dte = (EnvDTE.DTE)Marshal.GetActiveObject(dteProgID);
var fontProperty = dte.Properties["FontsAndColors", "Dialogs and Tool Windows"];
if (fontProperty != null)
{
object objValue = fontProperty.Item("FontFamily").Value;
var fontFamily = objValue.ToString();
objValue = fontProperty.Item("FontSize").Value;
var fontSize = Convert.ToSingle(objValue);
var font = new Font(fontFamily, fontSize);

return font;
}
} catch { }

return System.Drawing.SystemFonts.DefaultFont;
}
}
Expand All @@ -76,19 +46,23 @@ public ImageForm(IVisualizerObjectProvider objectProvider)
string expression = objectBitmap.ToString();
#endif

Debug.WriteLine("ImageForm " + objectBitmap.ToString());

var method = objectBitmap.GetType().GetMethod("ToBitmap", new Type[] { });
if (method != null)
{
pictureBox1.Image = (Bitmap)method.Invoke(objectBitmap, null);
}

if (objectBitmap is SerializableBitmapImage serializableBitmapImage)
else if (objectBitmap is SerializableBitmapImage serializableBitmapImage)
{
pictureBox1.Image = Image.FromStream(new MemoryStream((SerializableBitmapImage) objectBitmap));
pictureBox1.Image = Image.FromStream(new MemoryStream((SerializableBitmapImage)objectBitmap));
}
else {
txtExpression.Text += "No image found";
}
}

txtExpression.Text = objectProvider.GetObject().ToString();
txtExpression.Text += objectProvider.GetObject().ToString();
}

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
Expand Down
11 changes: 5 additions & 6 deletions ExtLibs/ImageVisualizer/src/ImageVisualizer14/ImageVisualizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
using Aberus.VisualStudio.Debugger.ImageVisualizer;
using Microsoft.VisualStudio.DebuggerVisualizers;
using SkiaSharp;
#if VS16
using Microsoft.VisualStudio.Utilities;
#endif

[assembly: System.Diagnostics.DebuggerVisualizer(typeof(ImageVisualizer), typeof(ImageVisualizerObjectSource), Target = typeof(SKImage), Description = "SKImage Visualizer")]
[assembly: System.Diagnostics.DebuggerVisualizer(typeof(ImageVisualizer), typeof(ImageVisualizerObjectSource), Target = typeof(SKBitmap), Description = "SKBitmap Visualizer")]
Expand All @@ -23,15 +20,17 @@ namespace Aberus.VisualStudio.Debugger.ImageVisualizer
/// </summary>
public class ImageVisualizer : DialogDebuggerVisualizer
{
public ImageVisualizer() : base(FormatterPolicy.Legacy) // or FormatterPolicy.Json
{
}

protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
{
if (windowService == null)
throw new ArgumentNullException(nameof(windowService), "This debugger does not support modal visualizers.");
if (objectProvider == null)
throw new ArgumentNullException(nameof(objectProvider));
#if VS16
using (DpiAwareness.EnterDpiScope(DpiAwarenessContext.SystemAware))
#endif

using (var imageForm = new ImageForm(objectProvider))
{

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.IO;
using Microsoft.VisualStudio.DebuggerVisualizers;
using SkiaSharp;
using System.Diagnostics;

namespace Aberus.VisualStudio.Debugger.ImageVisualizer
{
Expand All @@ -13,6 +14,8 @@ public class ImageVisualizerObjectSource : VisualizerObjectSource
/// <param name="outgoingData"></param>
public override void GetData(object target, Stream outgoingData)
{
Debug.WriteLine("ImageVisualizerObjectSource GetData " + target.GetType());
System.Diagnostics.Debugger.Break();
if (target is SKBitmap image1)
{
var bitmapSource = image1.Encode(SKEncodedImageFormat.Png, 100).AsStream();
Expand All @@ -36,7 +39,7 @@ public override void GetData(object target, Stream outgoingData)
outgoingData);
}
else if (target is SKCanvas image5)
{
{
base.GetData(
new SerializableBitmapImage(new byte[0]),
outgoingData);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
Expand All @@ -12,18 +13,21 @@ public class SerializableBitmapImage : ISerializable

public SerializableBitmapImage(byte[] image)
{
Debug.WriteLine("SerializableBitmapImage(byte[] image) Length " + image.Length);
this.Image = image;
}

public SerializableBitmapImage(Stream image)
{
Debug.WriteLine("SerializableBitmapImage(Stream image) Length " + image.Length);
var ms = new MemoryStream();
image.CopyTo(ms);
this.Image = ms.ToArray();
}

protected SerializableBitmapImage(SerializationInfo info, StreamingContext context)
{
Debug.WriteLine("SerializableBitmapImage(SerializationInfo info, StreamingContext context)");
foreach (var i in info)
{
if (string.Equals(i.Name, "Image", StringComparison.OrdinalIgnoreCase))
Expand Down Expand Up @@ -73,6 +77,7 @@ public static implicit operator byte[](SerializableBitmapImage serializableBitma

void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
Debug.WriteLine("ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)");
{
using (var memoryStream = new MemoryStream())
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;net472;netstandard2.0;netcoreapp2.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<RootNamespace>Aberus.VisualStudio.Debugger.ImageVisualizer</RootNamespace>

<AssemblyName>Aberus.VisualStudio.Debugger.ImageVisualizer.Common</AssemblyName>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netstandard2.0;netcoreapp2.0;net472</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<RootNamespace>Aberus.VisualStudio.Debugger.ImageVisualizer</RootNamespace>

<AssemblyName>Aberus.VisualStudio.Debugger.ImageVisualizer.DebuggeeSide</AssemblyName>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net472|AnyCPU'">
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.0|AnyCPU'">
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net472|AnyCPU'">
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netstandard2.0|AnyCPU'">
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\ImageVisualizer14\ImageVisualizerObjectSource.cs" Link="ImageVisualizerObjectSource.cs" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' != 'asdasnetcoreapp20' ">
<Reference Include="Microsoft.VisualStudio.DebuggerVisualizers">
<Private>False</Private>
<HintPath>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\Common7\Packages\Debugger\Visualizers\netstandard2.0\Microsoft.VisualStudio.DebuggerVisualizers.dll</HintPath>
</Reference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
<Reference Include="Microsoft.VisualStudio.DebuggerVisualizers">
<Private>False</Private>
<HintPath>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\Common7\Packages\Debugger\Visualizers\net2.0\Microsoft.VisualStudio.DebuggerVisualizers.dll</HintPath>
</Reference>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.DebuggerVisualizers" Version="17.0.2021101" />
<PackageReference Include="Microsoft.VisualStudio.DebuggerVisualizers" Version="17.6.1032901" />
<PackageReference Include="SkiaSharp">
<Version>2.80.2</Version>
</PackageReference>
Expand Down
Loading

0 comments on commit ce96e3c

Please sign in to comment.