Pulling in some changes from other places (#1054)

This commit is contained in:
Matthew Leibowitz 2019-12-07 23:09:32 +02:00 коммит произвёл GitHub
Родитель dc9b306e28
Коммит 34093ecb6e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
12 изменённых файлов: 38 добавлений и 32 удалений

Просмотреть файл

@ -1834,7 +1834,7 @@ namespace SkiaSharp
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
internal static extern Int32 sk_typeface_get_units_per_em (sk_typeface_t typeface);
// bool sk_typeface_is_fixed_pitch(sk_typeface_t* typeface);
// bool sk_typeface_is_fixed_pitch(sk_typeface_t* typeface)
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs (UnmanagedType.I1)]
internal static extern bool sk_typeface_is_fixed_pitch (sk_typeface_t typeface);

Просмотреть файл

@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SkiaSharp.WindowsDesktop.Tests")]
[assembly: AssemblyTitle("SkiaSharp.Desktop.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SkiaSharp.WindowsDesktop.Tests")]
[assembly: AssemblyProduct("SkiaSharp.Desktop.Tests")]
[assembly: AssemblyCopyright("Copyright © Xamarin 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Просмотреть файл

@ -111,14 +111,14 @@
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
<Content Include="..\..\output\native\windows\$(Platform)\libSkiaSharp.dll" CopyToOutputDirectory="Always" Condition=" '$(IsWindows)' == 'true' " />
<Content Include="..\..\output\native\windows\$(Platform)\libSkiaSharp.pdb" CopyToOutputDirectory="Always" Condition=" '$(IsWindows)' == 'true' " />
<Content Include="..\..\output\native\windows\$(Platform)\libHarfBuzzSharp.dll" CopyToOutputDirectory="Always" Condition=" '$(IsWindows)' == 'true' " />
<Content Include="..\..\output\native\windows\$(Platform)\libHarfBuzzSharp.pdb" CopyToOutputDirectory="Always" Condition=" '$(IsWindows)' == 'true' " />
<Content Include="..\..\output\native\osx\libSkiaSharp.dylib" CopyToOutputDirectory="Always" Condition=" '$(IsMacOS)' == 'true' " />
<Content Include="..\..\output\native\osx\libHarfBuzzSharp.dylib" CopyToOutputDirectory="Always" Condition=" '$(IsMacOS)' == 'true' " />
<Content Include="..\..\output\native\linux\$(Platform)\libSkiaSharp.so" CopyToOutputDirectory="Always" Condition=" '$(IsLinux)' == 'true' " />
<Content Include="..\..\output\native\linux\$(Platform)\libHarfBuzzSharp.so" CopyToOutputDirectory="Always" Condition=" '$(IsLinux)' == 'true' " />
<Content Include="..\..\output\native\windows\$(Platform)\libSkiaSharp.dll" Visible="false" CopyToOutputDirectory="Always" Condition=" '$(IsWindows)' == 'true' " />
<Content Include="..\..\output\native\windows\$(Platform)\libSkiaSharp.pdb" Visible="false" CopyToOutputDirectory="Always" Condition=" '$(IsWindows)' == 'true' " />
<Content Include="..\..\output\native\windows\$(Platform)\libHarfBuzzSharp.dll" Visible="false" CopyToOutputDirectory="Always" Condition=" '$(IsWindows)' == 'true' " />
<Content Include="..\..\output\native\windows\$(Platform)\libHarfBuzzSharp.pdb" Visible="false" CopyToOutputDirectory="Always" Condition=" '$(IsWindows)' == 'true' " />
<Content Include="..\..\output\native\osx\libSkiaSharp.dylib" Visible="false" CopyToOutputDirectory="Always" Condition=" '$(IsMacOS)' == 'true' " />
<Content Include="..\..\output\native\osx\libHarfBuzzSharp.dylib" Visible="false" CopyToOutputDirectory="Always" Condition=" '$(IsMacOS)' == 'true' " />
<Content Include="..\..\output\native\linux\$(Platform)\libSkiaSharp.so" Visible="false" CopyToOutputDirectory="Always" Condition=" '$(IsLinux)' == 'true' " />
<Content Include="..\..\output\native\linux\$(Platform)\libHarfBuzzSharp.so" Visible="false" CopyToOutputDirectory="Always" Condition=" '$(IsLinux)' == 'true' " />
</ItemGroup>
<Import Project="..\..\source\SkiaSharp.Build.targets" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

Просмотреть файл

@ -13,7 +13,7 @@ namespace SkiaSharp.Tests
using (var ctx = CreateGlContext()) {
ctx.MakeCurrent();
var grContext = GRContext.Create(GRBackend.OpenGL);
var grContext = GRContext.CreateGl();
Assert.NotNull(grContext);
}
@ -30,7 +30,7 @@ namespace SkiaSharp.Tests
Assert.True(glInterface.Validate());
var grContext = GRContext.Create(GRBackend.OpenGL, glInterface);
var grContext = GRContext.CreateGl(glInterface);
Assert.NotNull(grContext);
}
@ -43,7 +43,7 @@ namespace SkiaSharp.Tests
using (var ctx = CreateGlContext()) {
ctx.MakeCurrent();
using (var grContext = GRContext.Create(GRBackend.OpenGL))
using (var grContext = GRContext.CreateGl())
using (var surface = SKSurface.Create(grContext, true, new SKImageInfo(100, 100))) {
Assert.NotNull(surface);

Просмотреть файл

@ -4,7 +4,7 @@ using System.Runtime.InteropServices;
namespace SkiaSharp.Tests
{
internal class Kernel32
public class Kernel32
{
private const string kernel32 = "kernel32.dll";

Просмотреть файл

@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
namespace SkiaSharp.Tests
{
[StructLayout(LayoutKind.Sequential)]
internal struct RECT
public struct RECT
{
public int left;
public int top;

Просмотреть файл

@ -5,7 +5,7 @@ using System.Text;
namespace SkiaSharp.Tests
{
internal class User32
public class User32
{
private const string user32 = "user32.dll";

Просмотреть файл

@ -4,10 +4,10 @@ using System.Runtime.InteropServices;
namespace SkiaSharp.Tests
{
internal delegate IntPtr WNDPROC(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);
public delegate IntPtr WNDPROC(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);
[StructLayout(LayoutKind.Sequential)]
internal struct WNDCLASS
public struct WNDCLASS
{
public uint style;
[MarshalAs(UnmanagedType.FunctionPtr)]

Просмотреть файл

@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
namespace SkiaSharp.Tests
{
[Flags]
internal enum WindowStyles : uint
public enum WindowStyles : uint
{
WS_BORDER = 0x800000,
WS_CAPTION = 0xc00000,

Просмотреть файл

@ -16,7 +16,7 @@ namespace SkiaSharp.Tests
{
ctx.MakeCurrent();
using (var grContext = GRContext.Create(GRBackend.OpenGL))
using (var grContext = GRContext.CreateGl())
using (var surface = SKSurface.Create(grContext, true, new SKImageInfo(100, 100)))
{
var canvas = surface.Canvas;

Просмотреть файл

@ -27,7 +27,7 @@ namespace SkiaSharp.Tests
var info = new SKImageInfo(100, 100);
using (var grContext = GRContext.Create(GRBackend.OpenGL))
using (var grContext = GRContext.CreateGl())
using (var surface = SKSurface.Create(grContext, true, info))
{
Assert.NotNull(surface);
@ -60,7 +60,7 @@ namespace SkiaSharp.Tests
};
// create the surface
using (var grContext = GRContext.Create(GRBackend.OpenGL))
using (var grContext = GRContext.CreateGl())
using (var surface = SKSurface.CreateAsRenderTarget(grContext, textureDesc))
{
Assert.NotNull(surface);
@ -109,7 +109,7 @@ namespace SkiaSharp.Tests
};
// create the surface
using (var grContext = GRContext.Create(GRBackend.OpenGL))
using (var grContext = GRContext.CreateGl())
using (var surface = SKSurface.CreateAsRenderTarget(grContext, textureDesc))
{
Assert.NotNull(surface);
@ -134,7 +134,7 @@ namespace SkiaSharp.Tests
var texture = new GRBackendTexture(100, 100, false, textureInfo);
// create the surface
using (var grContext = GRContext.Create(GRBackend.OpenGL))
using (var grContext = GRContext.CreateGl())
using (var surface = SKSurface.CreateAsRenderTarget(grContext, texture, SKColorType.Rgba8888))
{
Assert.NotNull(surface);

Просмотреть файл

@ -300,14 +300,20 @@ namespace SkiaSharpGenerator
writer.WriteLine($"\t\t// {field}");
var fieldName = field.Name;
var isPrivate = fieldName.StartsWith("_private_", StringComparison.OrdinalIgnoreCase);
if (isPrivate) {
fieldName = fieldName.Substring(9);
}
var vis = "private";
if (map?.IsInternal == true)
vis = "public";
writer.WriteLine($"\t\t{vis} {type} {field.Name};");
writer.WriteLine($"\t\t{vis} {type} {fieldName};");
if (map == null || (map.GenerateProperties && !map.IsInternal))
if (!isPrivate && (map == null || (map.GenerateProperties && !map.IsInternal)))
{
var propertyName = field.Name;
var propertyName = fieldName;
if (map != null && map.Members.TryGetValue(propertyName, out var fieldMap))
propertyName = fieldMap;
else
@ -316,15 +322,15 @@ namespace SkiaSharpGenerator
if (cppT == "bool")
{
writer.WriteLine($"\t\tpublic bool {propertyName} {{");
writer.WriteLine($"\t\t\tget => {field.Name} > 0;");
writer.WriteLine($"\t\t\tset => {field.Name} = value ? (byte)1 : (byte)0;");
writer.WriteLine($"\t\t\tget => {fieldName} > 0;");
writer.WriteLine($"\t\t\tset => {fieldName} = value ? (byte)1 : (byte)0;");
writer.WriteLine($"\t\t}}");
}
else
{
writer.WriteLine($"\t\tpublic {type} {propertyName} {{");
writer.WriteLine($"\t\t\tget => {field.Name};");
writer.WriteLine($"\t\t\tset => {field.Name} = value;");
writer.WriteLine($"\t\t\tget => {fieldName};");
writer.WriteLine($"\t\t\tset => {fieldName} = value;");
writer.WriteLine($"\t\t}}");
}
writer.WriteLine();