This commit is contained in:
Jerome Laban 2020-08-13 11:25:22 -04:00
Родитель 2ee4d8daa3
Коммит d2ea4ee97d
24 изменённых файлов: 287 добавлений и 155 удалений

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

@ -17,7 +17,7 @@ jobs:
- bash: |
cd ~
echo Installing emscripten $(EMSCRIPTEN_VERSION)
git clone https://github.com/emscripten-core/emsdk
git clone --branch $(EMSCRIPTEN_VERSION) https://github.com/emscripten-core/emsdk
cd ~/emsdk
./emsdk install $(EMSCRIPTEN_VERSION)
./emsdk activate $(EMSCRIPTEN_VERSION)

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

@ -20,16 +20,24 @@ jobs:
useConfigFile: true
configFilePath: gitversion.yml
- task: NuGetToolInstaller@0
inputs:
versionSpec: 4.9.1
checkLatest: false
- task: DownloadBuildArtifacts@0
inputs:
artifactName: canvaskit_wasm
downloadPath: '$(build.sourcesdirectory)\externals\skia\out'
- task: MSBuild@1
inputs:
solution: $(build.sourcesdirectory)/source/SkiaSharp.Views/SkiaSharp.Views.Uno/SkiaSharp.Views.Uno.Wasm.csproj
msbuildLocationMethod: version
msbuildVersion: latest
msbuildArchitecture: x86
msbuildArguments: /r /p:Configuration=Release /detailedsummary "/p:PackageOutputPath=$(build.artifactstagingdirectory)\nuget" "/p:PackageVersion=$(GITVERSION.FullSemVer)" "/p:InformationalVersion=$(GITVERSION.InformationalVersion)" /detailedsummary
clean: false
maximumCpuCount: true
restoreNugetPackages: false
logProjectEvents: false
createLogFile: false
- task: MSBuild@1
inputs:
solution: $(build.sourcesdirectory)/source/SkiaSharp.Views/SkiaSharp.Views.Uno/SkiaSharp.Views.Uno.csproj

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

@ -42,7 +42,7 @@ namespace SkiaSharp
// internal proxy implementations
[MonoPInvokeCallback (typeof (SKBitmapReleaseProxyDelegate))]
private static void SKBitmapReleaseDelegateProxyImplementation (void* address, void* context)
private static void SKBitmapReleaseDelegateProxyImplementation (IntPtr address, IntPtr context)
{
var del = Get<SKBitmapReleaseDelegate> ((IntPtr)context, out var gch);
try {
@ -53,7 +53,7 @@ namespace SkiaSharp
}
[MonoPInvokeCallback (typeof (SKDataReleaseProxyDelegate))]
private static void SKDataReleaseDelegateProxyImplementation (void* address, void* context)
private static void SKDataReleaseDelegateProxyImplementation (IntPtr address, IntPtr context)
{
var del = Get<SKDataReleaseDelegate> ((IntPtr)context, out var gch);
try {
@ -64,13 +64,13 @@ namespace SkiaSharp
}
[MonoPInvokeCallback (typeof (SKImageRasterReleaseProxyDelegate))]
private static void SKImageRasterReleaseDelegateProxyImplementationForCoTaskMem (void* pixels, void* context)
private static void SKImageRasterReleaseDelegateProxyImplementationForCoTaskMem (IntPtr pixels, IntPtr context)
{
Marshal.FreeCoTaskMem ((IntPtr)pixels);
}
[MonoPInvokeCallback (typeof (SKImageRasterReleaseProxyDelegate))]
private static void SKImageRasterReleaseDelegateProxyImplementation (void* pixels, void* context)
private static void SKImageRasterReleaseDelegateProxyImplementation (IntPtr pixels, IntPtr context)
{
var del = Get<SKImageRasterReleaseDelegate> ((IntPtr)context, out var gch);
try {
@ -81,7 +81,7 @@ namespace SkiaSharp
}
[MonoPInvokeCallback (typeof (SKImageTextureReleaseProxyDelegate))]
private static void SKImageTextureReleaseDelegateProxyImplementation (void* context)
private static void SKImageTextureReleaseDelegateProxyImplementation (IntPtr context)
{
var del = Get<SKImageTextureReleaseDelegate> ((IntPtr)context, out var gch);
try {
@ -92,7 +92,7 @@ namespace SkiaSharp
}
[MonoPInvokeCallback (typeof (SKSurfaceRasterReleaseProxyDelegate))]
private static void SKSurfaceReleaseDelegateProxyImplementation (void* address, void* context)
private static void SKSurfaceReleaseDelegateProxyImplementation (IntPtr address, IntPtr context)
{
var del = Get<SKSurfaceReleaseDelegate> ((IntPtr)context, out var gch);
try {
@ -103,22 +103,24 @@ namespace SkiaSharp
}
[MonoPInvokeCallback (typeof (GRGlGetProcProxyDelegate))]
private static IntPtr GRGlGetProcDelegateProxyImplementation (void* context, string name)
private static IntPtr GRGlGetProcDelegateProxyImplementation (IntPtr context, IntPtr name)
{
var del = Get<GRGlGetProcedureAddressDelegate> ((IntPtr)context, out _);
return del.Invoke (name);
throw new NotImplementedException ();
// var del = Get<GRGlGetProcedureAddressDelegate> ((IntPtr)context, out _);
// return del.Invoke (name);
}
[MonoPInvokeCallback (typeof (GRVkGetProcProxyDelegate))]
private static IntPtr GRVkGetProcDelegateProxyImplementation (void* context, string name, IntPtr instance, IntPtr device)
private static IntPtr GRVkGetProcDelegateProxyImplementation (IntPtr context, IntPtr name, IntPtr instance, IntPtr device)
{
var del = Get<GRVkGetProcedureAddressDelegate> ((IntPtr)context, out _);
throw new NotImplementedException ();
//var del = Get<GRVkGetProcedureAddressDelegate> ((IntPtr)context, out _);
return del.Invoke (name, instance, device);
//return del.Invoke (name, instance, device);
}
[MonoPInvokeCallback (typeof (SKGlyphPathProxyDelegate))]
private static void SKGlyphPathDelegateProxyImplementation (IntPtr pathOrNull, SKMatrix* matrix, void* context)
private static void SKGlyphPathDelegateProxyImplementation (IntPtr pathOrNull, SKMatrix* matrix, IntPtr context)
{
var del = Get<SKGlyphPathDelegate> ((IntPtr)context, out _);
var path = SKPath.GetObject (pathOrNull, false);

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

@ -50,28 +50,28 @@ namespace SkiaSharp
protected abstract IntPtr OnBytesWritten ();
[MonoPInvokeCallback (typeof (SKManagedWStreamWriteProxyDelegate))]
private static bool WriteInternal (IntPtr s, void* context, void* buffer, IntPtr size)
private static bool WriteInternal (IntPtr s, IntPtr context, IntPtr buffer, IntPtr size)
{
var stream = DelegateProxies.GetUserData<SKAbstractManagedWStream> ((IntPtr)context, out _);
return stream.OnWrite ((IntPtr)buffer, size);
}
[MonoPInvokeCallback (typeof (SKManagedWStreamFlushProxyDelegate))]
private static void FlushInternal (IntPtr s, void* context)
private static void FlushInternal (IntPtr s, IntPtr context)
{
var stream = DelegateProxies.GetUserData<SKAbstractManagedWStream> ((IntPtr)context, out _);
stream.OnFlush ();
}
[MonoPInvokeCallback (typeof (SKManagedWStreamBytesWrittenProxyDelegate))]
private static IntPtr BytesWrittenInternal (IntPtr s, void* context)
private static IntPtr BytesWrittenInternal (IntPtr s, IntPtr context)
{
var stream = DelegateProxies.GetUserData<SKAbstractManagedWStream> ((IntPtr)context, out _);
return stream.OnBytesWritten ();
}
[MonoPInvokeCallback (typeof (SKManagedWStreamDestroyProxyDelegate))]
private static void DestroyInternal (IntPtr s, void* context)
private static void DestroyInternal (IntPtr s, IntPtr context)
{
var stream = DelegateProxies.GetUserData<SKAbstractManagedWStream> ((IntPtr)context, out var gch);
if (stream != null) {

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

@ -98,14 +98,14 @@ namespace SkiaSharp
}
[MonoPInvokeCallback (typeof (SKManagedDrawableDrawProxyDelegate))]
private static void DrawInternal (IntPtr d, void* context, IntPtr canvas)
private static void DrawInternal (IntPtr d, IntPtr context, IntPtr canvas)
{
var drawable = DelegateProxies.GetUserData<SKDrawable> ((IntPtr)context, out _);
drawable.OnDraw (SKCanvas.GetObject (canvas, false));
}
[MonoPInvokeCallback (typeof (SKManagedDrawableGetBoundsProxyDelegate))]
private static void GetBoundsInternal (IntPtr d, void* context, SKRect* rect)
private static void GetBoundsInternal (IntPtr d, IntPtr context, SKRect* rect)
{
var drawable = DelegateProxies.GetUserData<SKDrawable> ((IntPtr)context, out _);
var bounds = drawable.OnGetBounds ();
@ -113,14 +113,14 @@ namespace SkiaSharp
}
[MonoPInvokeCallback (typeof (SKManagedDrawableNewPictureSnapshotProxyDelegate))]
private static IntPtr NewPictureSnapshotInternal (IntPtr d, void* context)
private static IntPtr NewPictureSnapshotInternal (IntPtr d, IntPtr context)
{
var drawable = DelegateProxies.GetUserData<SKDrawable> ((IntPtr)context, out _);
return drawable.OnSnapshot ()?.Handle ?? IntPtr.Zero;
}
[MonoPInvokeCallback (typeof (SKManagedDrawableDestroyProxyDelegate))]
private static void DestroyInternal (IntPtr d, void* context)
private static void DestroyInternal (IntPtr d, IntPtr context)
{
var drawable = DelegateProxies.GetUserData<SKDrawable> ((IntPtr)context, out var gch);
if (drawable != null) {

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

@ -1,4 +1,4 @@
using System;
using System;
using System.Runtime.InteropServices;
namespace SkiaSharp
@ -3807,130 +3807,130 @@ namespace SkiaSharp
// typedef gr_gl_func_ptr (*)(void* ctx, const char* name)* gr_gl_get_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate IntPtr GRGlGetProcProxyDelegate(void* ctx, [MarshalAs (UnmanagedType.LPStr)] String name);
internal unsafe delegate IntPtr GRGlGetProcProxyDelegate(IntPtr ctx, IntPtr name);
// typedef void (*)()* gr_vk_func_ptr
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate void GRVkFuncPtr();
// typedef gr_vk_func_ptr (*)(void* ctx, const char* name, vk_instance_t* instance, vk_device_t* device)* gr_vk_get_proc
// typedef gr_vk_func_ptr (*)(IntPtr ctx, const char* name, vk_instance_t* instance, vk_device_t* device)* gr_vk_get_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate IntPtr GRVkGetProcProxyDelegate(void* ctx, [MarshalAs (UnmanagedType.LPStr)] String name, vk_instance_t instance, vk_device_t device);
internal unsafe delegate IntPtr GRVkGetProcProxyDelegate(IntPtr ctx, IntPtr name, vk_instance_t instance, vk_device_t device);
// typedef void (*)(void* addr, void* context)* sk_bitmap_release_proc
// typedef void (*)(IntPtr addr, IntPtr context)* sk_bitmap_release_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate void SKBitmapReleaseProxyDelegate(void* addr, void* context);
internal unsafe delegate void SKBitmapReleaseProxyDelegate(IntPtr addr, IntPtr context);
// typedef void (*)(const void* ptr, void* context)* sk_data_release_proc
// typedef void (*)(const IntPtr ptr, IntPtr context)* sk_data_release_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate void SKDataReleaseProxyDelegate(void* ptr, void* context);
internal unsafe delegate void SKDataReleaseProxyDelegate(IntPtr ptr, IntPtr context);
// typedef void (*)(const sk_path_t* pathOrNull, const sk_matrix_t* matrix, void* context)* sk_glyph_path_proc
// typedef void (*)(const sk_path_t* pathOrNull, const sk_matrix_t* matrix, IntPtr context)* sk_glyph_path_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate void SKGlyphPathProxyDelegate(sk_path_t pathOrNull, SKMatrix* matrix, void* context);
internal unsafe delegate void SKGlyphPathProxyDelegate(sk_path_t pathOrNull, SKMatrix* matrix, IntPtr context);
// typedef void (*)(const void* addr, void* context)* sk_image_raster_release_proc
// typedef void (*)(const IntPtr addr, IntPtr context)* sk_image_raster_release_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate void SKImageRasterReleaseProxyDelegate(void* addr, void* context);
internal unsafe delegate void SKImageRasterReleaseProxyDelegate(IntPtr addr, IntPtr context);
// typedef void (*)(void* context)* sk_image_texture_release_proc
// typedef void (*)(IntPtr context)* sk_image_texture_release_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate void SKImageTextureReleaseProxyDelegate(void* context);
internal unsafe delegate void SKImageTextureReleaseProxyDelegate(IntPtr context);
// typedef void (*)(sk_manageddrawable_t* d, void* context)* sk_manageddrawable_destroy_proc
// typedef void (*)(sk_manageddrawable_t* d, IntPtr context)* sk_manageddrawable_destroy_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate void SKManagedDrawableDestroyProxyDelegate(sk_manageddrawable_t d, void* context);
internal unsafe delegate void SKManagedDrawableDestroyProxyDelegate(sk_manageddrawable_t d, IntPtr context);
// typedef void (*)(sk_manageddrawable_t* d, void* context, sk_canvas_t* ccanvas)* sk_manageddrawable_draw_proc
// typedef void (*)(sk_manageddrawable_t* d, IntPtr context, sk_canvas_t* ccanvas)* sk_manageddrawable_draw_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate void SKManagedDrawableDrawProxyDelegate(sk_manageddrawable_t d, void* context, sk_canvas_t ccanvas);
internal unsafe delegate void SKManagedDrawableDrawProxyDelegate(sk_manageddrawable_t d, IntPtr context, sk_canvas_t ccanvas);
// typedef void (*)(sk_manageddrawable_t* d, void* context, sk_rect_t* rect)* sk_manageddrawable_getBounds_proc
// typedef void (*)(sk_manageddrawable_t* d, IntPtr context, sk_rect_t* rect)* sk_manageddrawable_getBounds_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate void SKManagedDrawableGetBoundsProxyDelegate(sk_manageddrawable_t d, void* context, SKRect* rect);
internal unsafe delegate void SKManagedDrawableGetBoundsProxyDelegate(sk_manageddrawable_t d, IntPtr context, SKRect* rect);
// typedef sk_picture_t* (*)(sk_manageddrawable_t* d, void* context)* sk_manageddrawable_newPictureSnapshot_proc
// typedef sk_picture_t* (*)(sk_manageddrawable_t* d, IntPtr context)* sk_manageddrawable_newPictureSnapshot_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate sk_picture_t SKManagedDrawableNewPictureSnapshotProxyDelegate(sk_manageddrawable_t d, void* context);
internal unsafe delegate sk_picture_t SKManagedDrawableNewPictureSnapshotProxyDelegate(sk_manageddrawable_t d, IntPtr context);
// typedef void (*)(sk_stream_managedstream_t* s, void* context)* sk_managedstream_destroy_proc
// typedef void (*)(sk_stream_managedstream_t* s, IntPtr context)* sk_managedstream_destroy_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate void SKManagedStreamDestroyProxyDelegate(sk_stream_managedstream_t s, void* context);
internal unsafe delegate void SKManagedStreamDestroyProxyDelegate(sk_stream_managedstream_t s, IntPtr context);
// typedef sk_stream_managedstream_t* (*)(const sk_stream_managedstream_t* s, void* context)* sk_managedstream_duplicate_proc
// typedef sk_stream_managedstream_t* (*)(const sk_stream_managedstream_t* s, IntPtr context)* sk_managedstream_duplicate_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate sk_stream_managedstream_t SKManagedStreamDuplicateProxyDelegate(sk_stream_managedstream_t s, void* context);
internal unsafe delegate sk_stream_managedstream_t SKManagedStreamDuplicateProxyDelegate(sk_stream_managedstream_t s, IntPtr context);
// typedef sk_stream_managedstream_t* (*)(const sk_stream_managedstream_t* s, void* context)* sk_managedstream_fork_proc
// typedef sk_stream_managedstream_t* (*)(const sk_stream_managedstream_t* s, IntPtr context)* sk_managedstream_fork_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate sk_stream_managedstream_t SKManagedStreamForkProxyDelegate(sk_stream_managedstream_t s, void* context);
internal unsafe delegate sk_stream_managedstream_t SKManagedStreamForkProxyDelegate(sk_stream_managedstream_t s, IntPtr context);
// typedef size_t (*)(const sk_stream_managedstream_t* s, void* context)* sk_managedstream_getLength_proc
// typedef size_t (*)(const sk_stream_managedstream_t* s, IntPtr context)* sk_managedstream_getLength_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate /* size_t */ IntPtr SKManagedStreamGetLengthProxyDelegate(sk_stream_managedstream_t s, void* context);
internal unsafe delegate /* size_t */ IntPtr SKManagedStreamGetLengthProxyDelegate(sk_stream_managedstream_t s, IntPtr context);
// typedef size_t (*)(const sk_stream_managedstream_t* s, void* context)* sk_managedstream_getPosition_proc
// typedef size_t (*)(const sk_stream_managedstream_t* s, IntPtr context)* sk_managedstream_getPosition_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate /* size_t */ IntPtr SKManagedStreamGetPositionProxyDelegate(sk_stream_managedstream_t s, void* context);
internal unsafe delegate /* size_t */ IntPtr SKManagedStreamGetPositionProxyDelegate(sk_stream_managedstream_t s, IntPtr context);
// typedef bool (*)(const sk_stream_managedstream_t* s, void* context)* sk_managedstream_hasLength_proc
// typedef bool (*)(const sk_stream_managedstream_t* s, IntPtr context)* sk_managedstream_hasLength_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
[return: MarshalAs (UnmanagedType.I1)]
internal unsafe delegate bool SKManagedStreamHasLengthProxyDelegate(sk_stream_managedstream_t s, void* context);
internal unsafe delegate bool SKManagedStreamHasLengthProxyDelegate(sk_stream_managedstream_t s, IntPtr context);
// typedef bool (*)(const sk_stream_managedstream_t* s, void* context)* sk_managedstream_hasPosition_proc
// typedef bool (*)(const sk_stream_managedstream_t* s, IntPtr context)* sk_managedstream_hasPosition_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
[return: MarshalAs (UnmanagedType.I1)]
internal unsafe delegate bool SKManagedStreamHasPositionProxyDelegate(sk_stream_managedstream_t s, void* context);
internal unsafe delegate bool SKManagedStreamHasPositionProxyDelegate(sk_stream_managedstream_t s, IntPtr context);
// typedef bool (*)(const sk_stream_managedstream_t* s, void* context)* sk_managedstream_isAtEnd_proc
// typedef bool (*)(const sk_stream_managedstream_t* s, IntPtr context)* sk_managedstream_isAtEnd_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
[return: MarshalAs (UnmanagedType.I1)]
internal unsafe delegate bool SKManagedStreamIsAtEndProxyDelegate(sk_stream_managedstream_t s, void* context);
internal unsafe delegate bool SKManagedStreamIsAtEndProxyDelegate(sk_stream_managedstream_t s, IntPtr context);
// typedef bool (*)(sk_stream_managedstream_t* s, void* context, int offset)* sk_managedstream_move_proc
// typedef bool (*)(sk_stream_managedstream_t* s, IntPtr context, int offset)* sk_managedstream_move_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
[return: MarshalAs (UnmanagedType.I1)]
internal unsafe delegate bool SKManagedStreamMoveProxyDelegate(sk_stream_managedstream_t s, void* context, Int32 offset);
internal unsafe delegate bool SKManagedStreamMoveProxyDelegate(sk_stream_managedstream_t s, IntPtr context, Int32 offset);
// typedef size_t (*)(const sk_stream_managedstream_t* s, void* context, void* buffer, size_t size)* sk_managedstream_peek_proc
// typedef size_t (*)(const sk_stream_managedstream_t* s, IntPtr context, IntPtr buffer, size_t size)* sk_managedstream_peek_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate /* size_t */ IntPtr SKManagedStreamPeekProxyDelegate(sk_stream_managedstream_t s, void* context, void* buffer, /* size_t */ IntPtr size);
internal unsafe delegate /* size_t */ IntPtr SKManagedStreamPeekProxyDelegate(sk_stream_managedstream_t s, IntPtr context, IntPtr buffer, /* size_t */ IntPtr size);
// typedef size_t (*)(sk_stream_managedstream_t* s, void* context, void* buffer, size_t size)* sk_managedstream_read_proc
// typedef size_t (*)(sk_stream_managedstream_t* s, IntPtr context, IntPtr buffer, size_t size)* sk_managedstream_read_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate /* size_t */ IntPtr SKManagedStreamReadProxyDelegate(sk_stream_managedstream_t s, void* context, void* buffer, /* size_t */ IntPtr size);
internal unsafe delegate /* size_t */ IntPtr SKManagedStreamReadProxyDelegate(sk_stream_managedstream_t s, IntPtr context, IntPtr buffer, /* size_t */ IntPtr size);
// typedef bool (*)(sk_stream_managedstream_t* s, void* context)* sk_managedstream_rewind_proc
// typedef bool (*)(sk_stream_managedstream_t* s, IntPtr context)* sk_managedstream_rewind_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
[return: MarshalAs (UnmanagedType.I1)]
internal unsafe delegate bool SKManagedStreamRewindProxyDelegate(sk_stream_managedstream_t s, void* context);
internal unsafe delegate bool SKManagedStreamRewindProxyDelegate(sk_stream_managedstream_t s, IntPtr context);
// typedef bool (*)(sk_stream_managedstream_t* s, void* context, size_t position)* sk_managedstream_seek_proc
// typedef bool (*)(sk_stream_managedstream_t* s, IntPtr context, size_t position)* sk_managedstream_seek_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
[return: MarshalAs (UnmanagedType.I1)]
internal unsafe delegate bool SKManagedStreamSeekProxyDelegate(sk_stream_managedstream_t s, void* context, /* size_t */ IntPtr position);
internal unsafe delegate bool SKManagedStreamSeekProxyDelegate(sk_stream_managedstream_t s, IntPtr context, /* size_t */ IntPtr position);
// typedef size_t (*)(const sk_wstream_managedstream_t* s, void* context)* sk_managedwstream_bytesWritten_proc
// typedef size_t (*)(const sk_wstream_managedstream_t* s, IntPtr context)* sk_managedwstream_bytesWritten_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate /* size_t */ IntPtr SKManagedWStreamBytesWrittenProxyDelegate(sk_wstream_managedstream_t s, void* context);
internal unsafe delegate /* size_t */ IntPtr SKManagedWStreamBytesWrittenProxyDelegate(sk_wstream_managedstream_t s, IntPtr context);
// typedef void (*)(sk_wstream_managedstream_t* s, void* context)* sk_managedwstream_destroy_proc
// typedef void (*)(sk_wstream_managedstream_t* s, IntPtr context)* sk_managedwstream_destroy_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate void SKManagedWStreamDestroyProxyDelegate(sk_wstream_managedstream_t s, void* context);
internal unsafe delegate void SKManagedWStreamDestroyProxyDelegate(sk_wstream_managedstream_t s, IntPtr context);
// typedef void (*)(sk_wstream_managedstream_t* s, void* context)* sk_managedwstream_flush_proc
// typedef void (*)(sk_wstream_managedstream_t* s, IntPtr context)* sk_managedwstream_flush_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate void SKManagedWStreamFlushProxyDelegate(sk_wstream_managedstream_t s, void* context);
internal unsafe delegate void SKManagedWStreamFlushProxyDelegate(sk_wstream_managedstream_t s, IntPtr context);
// typedef bool (*)(sk_wstream_managedstream_t* s, void* context, const void* buffer, size_t size)* sk_managedwstream_write_proc
// typedef bool (*)(sk_wstream_managedstream_t* s, IntPtr context, const IntPtr buffer, size_t size)* sk_managedwstream_write_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
[return: MarshalAs (UnmanagedType.I1)]
internal unsafe delegate bool SKManagedWStreamWriteProxyDelegate(sk_wstream_managedstream_t s, void* context, void* buffer, /* size_t */ IntPtr size);
internal unsafe delegate bool SKManagedWStreamWriteProxyDelegate(sk_wstream_managedstream_t s, IntPtr context, IntPtr buffer, /* size_t */ IntPtr size);
// typedef void (*)(void* addr, void* context)* sk_surface_raster_release_proc
// typedef void (*)(IntPtr addr, IntPtr context)* sk_surface_raster_release_proc
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal unsafe delegate void SKSurfaceRasterReleaseProxyDelegate(void* addr, void* context);
internal unsafe delegate void SKSurfaceRasterReleaseProxyDelegate(IntPtr addr, IntPtr context);
#endregion

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

@ -0,0 +1,5 @@
<linker>
<assembly fullname="SkiaSharp">
<type fullname="SkiaSharp.SKAbstractManagedStream"/>
</assembly>
</linker>

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

@ -48,6 +48,12 @@
</Content>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="LinkerDefinition.Wasm.xml">
<LogicalName>$(AssemblyName).xml</LogicalName>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.TypeScript.Compiler" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>

2
externals/depot_tools поставляемый

@ -1 +1 @@
Subproject commit 44134341fa8b46e83bad3bef48a8bc6badaa3083
Subproject commit f170af48e4490633334a300bbcb65d50fab09537

2
externals/harfbuzz поставляемый

@ -1 +1 @@
Subproject commit be97e9d678017d4ec66625fa2b17ef3485552cad
Subproject commit 55d1d7c8bcd8d97c4e618e5dd21f13df50b10ce8

2
externals/skia поставляемый

@ -1 +1 @@
Subproject commit 10bd203fcc03fed0ba523b6bf5dbcf3c51dbfc6b
Subproject commit fe5185495a925ca7ead436ed71904c510349b3ad

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

@ -1,7 +1,7 @@
<linker>
<assembly fullname="SkiaSharpSample.Wasm" />
<assembly fullname="Uno.Foundation" />
<assembly fullname="SkiaSharp" />
<assembly fullname="WebAssembly.Bindings" />
<assembly fullname="System.Core">
<!-- This is required by JSon.NET and any expression.Compile caller -->

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

@ -6,14 +6,20 @@
<WasmHead>true</WasmHead>
<DefineConstants>$(DefineConstants);__WASM__</DefineConstants>
<NoWarn>NU1701</NoWarn>
<MonoRuntimeDebuggerEnabled Condition="'$(Configuration)'=='Debug'">true</MonoRuntimeDebuggerEnabled>
<WasmShellMonoRuntimeExecutionMode Condition="$([MSBuild]::IsOsPlatform('Linux'))">InterpreterAndAOT</WasmShellMonoRuntimeExecutionMode>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TypeScriptToolsVersion>3.3</TypeScriptToolsVersion>
<CompileTypeScriptDependsOn>_UnoSourceGenerator; $(CompileTypeScriptDependsOn)</CompileTypeScriptDependsOn>
<IsUiAutomationMappingEnabled>true</IsUiAutomationMappingEnabled>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup>
<MonoRuntimeDebuggerEnabled Condition="'$(Configuration)'=='Debug'">true</MonoRuntimeDebuggerEnabled>
<UseAOT Condition="$([MSBuild]::IsOsPlatform('Linux')) or ( $([MSBuild]::IsOsPlatform('Windows')) and '$(BUILD_REPOSITORY_PROVIDER)'=='' )">true</UseAOT>
<WasmShellMonoRuntimeExecutionMode Condition="'$(UseAOT)'=='true'">InterpreterAndAOT</WasmShellMonoRuntimeExecutionMode>
<!--<WasmShellGenerateAOTProfile>true</WasmShellGenerateAOTProfile>-->
</PropertyGroup>
<ItemGroup>
<Content Include="..\SkiaSharpSample.UWP\Assets\*.png" Link="Assets\%(FileName)%(Extension)" />
<None Remove="MainPage.xaml" />
@ -25,20 +31,24 @@
<Content Include="Fonts\winjs-symbols.woff2" />
<Content Include="ts\GoogleAnalytics.ts" />
</ItemGroup>
<ItemGroup>
<WasmShellMonoEnvironment Include="MONO_GC_PARAMS" Value="soft-heap-limit=512m,nursery-size=64m,evacuation-threshold=66,major=marksweep" />
<WasmShellMonoEnvironment Include="MONO_LOG_LEVEL" Value="debug" />
<WasmShellMonoEnvironment Include="MONO_LOG_MASK" Value="gc" />
</ItemGroup>
<ItemGroup Condition="'$(UseAOT)'=='true'">
<WasmShellEnableAotProfile Include="aot.profile" />
</ItemGroup>
<ItemGroup>
<WasmShellExtraEmccFlags Include="-s USE_LIBPNG=1" />
<WasmShellExtraEmccFlags Include="-s USE_FREETYPE=1" />
<WasmShellExtraEmccFlags Include="-lidbfs.js" />
</ItemGroup>
<ItemGroup>
<ItemGroup>
<EmbeddedResource Include="WasmCSS\Fonts.css" />
<EmbeddedResource Include="WasmScripts\*.js" />
</ItemGroup>
@ -49,20 +59,20 @@
<ItemGroup>
<LinkerDescriptor Include="LinkerConfig.xml" />
</ItemGroup>
<ItemGroup>
<MonoRuntimeMixedModeExcludedAssembly Include="SkiaSharp.Views.Uno" />
<MonoRuntimeMixedModeExcludedAssembly Include="SkiaSharp.Wasm" />
<MonoRuntimeMixedModeExcludedAssembly Include="SkiaSharpSample.Wasm" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
<PackageReference Include="Uno.UI" Version="3.0.0-dev.657" />
<PackageReference Include="Uno.UI.Sample.Banner" Version="1.44.0-dev.23" />
<PackageReference Include="Uno.Wasm.Bootstrap" Version="1.3.0-dev.44" />
<PackageReference Include="Uno.Wasm.Bootstrap.DevServer" Version="1.3.0-dev.44" />
<PackageReference Include="Uno.UI.WebAssembly" Version="3.1.0-dev.35" />
<PackageReference Include="Uno.UI.Sample.Banner" Version="1.44.0-dev.33" />
<PackageReference Include="Uno.Wasm.Bootstrap" Version="1.3.4" />
<PackageReference Include="Uno.Wasm.Bootstrap.DevServer" Version="1.3.4" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.TypeScript.Compiler" Version="3.1.5">
@ -92,7 +102,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\binding\SkiaSharp.Wasm\SkiaSharp.Wasm.csproj" />
<ProjectReference Include="..\..\..\..\source\SkiaSharp.Views\SkiaSharp.Views.Uno\SkiaSharp.Views.Uno.csproj" />
<ProjectReference Include="..\..\..\..\source\SkiaSharp.Views\SkiaSharp.Views.Uno\SkiaSharp.Views.Uno.Wasm.csproj" />
</ItemGroup>
<Import Project="..\SkiaSharpSample.Shared\SkiaSharpSample.Shared.projitems" Label="Shared" />
</Project>

Двоичные данные
samples/Gallery/Uno/SkiaSharpSample.Wasm/aot.profile Normal file

Двоичный файл не отображается.

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

@ -15,6 +15,8 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SkiaSharpSample.Shared", "S
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharpSample.Wasm", "SkiaSharpSample.Wasm\SkiaSharpSample.Wasm.csproj", "{EF116554-E884-49FD-80D7-14112D713E5E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.Uno.Wasm", "..\..\..\source\SkiaSharp.Views\SkiaSharp.Views.Uno\SkiaSharp.Views.Uno.Wasm.csproj", "{554FFDC1-0D3B-4D89-863C-FFD67AF56B8B}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
SkiaSharpSample.Shared\SkiaSharpSample.Shared.projitems*{6279c845-92f8-4333-ab99-3d213163593c}*SharedItemsImports = 13
@ -37,6 +39,10 @@ Global
{EF116554-E884-49FD-80D7-14112D713E5E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EF116554-E884-49FD-80D7-14112D713E5E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EF116554-E884-49FD-80D7-14112D713E5E}.Release|Any CPU.Build.0 = Release|Any CPU
{554FFDC1-0D3B-4D89-863C-FFD67AF56B8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{554FFDC1-0D3B-4D89-863C-FFD67AF56B8B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{554FFDC1-0D3B-4D89-863C-FFD67AF56B8B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{554FFDC1-0D3B-4D89-863C-FFD67AF56B8B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -46,6 +52,7 @@ Global
{ADF71530-1C6D-4C0D-92F0-B731DCFB2F03} = {D071B979-9BB6-43AE-91DF-3C0A18D2B1A8}
{6279C845-92F8-4333-AB99-3D213163593C} = {5F123092-5F3D-48C3-88B8-A5BB9B4F9C75}
{EF116554-E884-49FD-80D7-14112D713E5E} = {5F123092-5F3D-48C3-88B8-A5BB9B4F9C75}
{554FFDC1-0D3B-4D89-863C-FFD67AF56B8B} = {D071B979-9BB6-43AE-91DF-3C0A18D2B1A8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {67EACD19-0CEA-4127-9842-549AA6FB84C9}

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

@ -1,4 +1,4 @@
#if !__WATCHOS__ && !__WASM__
#if !__WATCHOS__ && !__WASM__ && !UNO_REFERENCE_API
using System.Runtime.InteropServices;
namespace SkiaSharp.Views.GlesInterop

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

@ -0,0 +1,15 @@
<Project ToolsVersion="15.0">
<PropertyGroup>
<SkiaSharpBuildPropsImported>true</SkiaSharpBuildPropsImported>
<!--
Force all projects of this folder to use a different output
path to avoid intermediate output collisions
-->
<BaseOutputPath>bin\$(MSBuildProjectName)</BaseOutputPath>
<BaseIntermediateOutputPath>obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<DefaultItemExcludes>$(DefaultItemExcludes);obj/**;bin/**</DefaultItemExcludes>
</PropertyGroup>
</Project>

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

@ -0,0 +1,5 @@
<Project ToolsVersion="15.0">
</Project>

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

@ -0,0 +1,48 @@
#if UNO_REFERENCE_API && !__WASM__
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using SkiaSharp;
using Uno.Extensions;
using Uno.Foundation;
using Uno.Logging;
using Windows.ApplicationModel;
using Windows.Graphics.Display;
using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
namespace SkiaSharp.Views.UWP
{
public partial class SKXamlCanvas : FrameworkElement
{
public SKXamlCanvas()
{
}
private SKSize GetCanvasSize() => throw new NotImplementedException();
private static bool GetIsInitialized() => true;
private void OnDpiChanged(DisplayInformation sender, object args = null)
{
}
private void OnLoaded(object sender, RoutedEventArgs e)
{
}
private void OnUnloaded(object sender, RoutedEventArgs e)
{
}
private void DoInvalidate()
{
}
}
}
#endif

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

@ -14,9 +14,11 @@ using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
using Uno.UI.Runtime.WebAssembly;
namespace SkiaSharp.Views.UWP
{
[HtmlElement("canvas")]
public partial class SKXamlCanvas : FrameworkElement
{
private IntPtr pixels;
@ -26,7 +28,6 @@ namespace SkiaSharp.Views.UWP
private static bool designMode = DesignMode.DesignModeEnabled;
public SKXamlCanvas()
: base("canvas")
{
Loaded += OnLoaded;
Unloaded += OnUnloaded;
@ -114,7 +115,7 @@ namespace SkiaSharp.Views.UWP
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info));
}
WebAssemblyRuntime.InvokeJS($"SkiaSharp.SurfaceManager.invalidateCanvas({pixels}, \"{HtmlId}\", {info.Width}, {_pixelHeight});");
WebAssemblyRuntime.InvokeJS($"SkiaSharp.SurfaceManager.invalidateCanvas({pixels}, \"{this.GetHtmlId()}\", {info.Width}, {_pixelHeight});");
}
private unsafe void CreateBitmap(SKImageInfo info)

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

@ -83,13 +83,6 @@ namespace SkiaSharp.Views.UWP
}
}
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
drawable?.Dispose();
}
}
}
#endif

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

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<IsPackable>false</IsPackable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyName>SkiaSharp.Views.Uno</AssemblyName>
<LangVersion>8.0</LangVersion>
<!-- The "FilterAssemblies" task was not given a value for the required parameter "DesignTimeBuild".-->
<DesignTimeBuild>false</DesignTimeBuild>
<PackagingGroup>SkiaSharp</PackagingGroup>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Uno.UI.Runtime.WebAssembly" Version="3.0.5" />
<PackageReference Include="Microsoft.TypeScript.Compiler" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="3.3.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\SkiaSharp.Views.Shared\**\*.cs" Exclude="..\SkiaSharp.Views.Shared\Properties\**\*.cs" Link="SharedViews\%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="WasmScripts\*.js" />
</ItemGroup>
<ItemGroup>
<UpToDateCheckInput Include="ts\**\*" />
</ItemGroup>
<ItemGroup>
<TypeScriptCompile Remove="ts\SurfaceManager.ts" />
</ItemGroup>
<ItemGroup>
<UpToDateCheckInput Remove="ts\SurfaceManager.ts" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
<ProjectReference Include="..\..\..\binding\SkiaSharp.Wasm\SkiaSharp.Wasm.csproj" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="LinkerDefinition.Wasm.xml">
<LogicalName>$(AssemblyName).xml</LogicalName>
</EmbeddedResource>
</ItemGroup>
</Project>

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

@ -1,10 +1,11 @@
<Project Sdk="MSBuild.Sdk.Extras/2.0.54" ToolsVersion="15.0">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;xamarinios10;monoandroid80;monoandroid90;xamarinmac20</TargetFrameworks>
<TargetFrameworks>netstandard2.0;xamarinios10;monoandroid90;xamarinmac20</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GeneratePackageOnBuild Condition="'$(Configuration)'=='Release'">true</GeneratePackageOnBuild>
<NoWarn>$(NoWarm);NU1701</NoWarn>
<LangVersion>8.0</LangVersion>
<PackageId>Uno.SkiaSharp.Views</PackageId>
@ -12,43 +13,20 @@
<DesignTimeBuild>false</DesignTimeBuild>
<PackagingGroup>SkiaSharp</PackagingGroup>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="WasmScripts\*.js" />
</ItemGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
<DefineConstants>$(DefineConstants);__WASM__</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Uno.UI" Version="2.0.532" />
<PackageReference Include="Microsoft.TypeScript.Compiler" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="3.3.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
<EmbeddedResource Include="LinkerDefinition.Wasm.xml">
<LogicalName>$(AssemblyName).xml</LogicalName>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<UpToDateCheckInput Include="ts\**\*" />
<UnoRuntimeProjectReference Include="SkiaSharp.Views.Uno.Wasm.csproj" />
</ItemGroup>
<ItemGroup>
<TypeScriptCompile Remove="ts\SurfaceManager.ts" />
<Content Include="buildTransitive\**">
<PackagePath>buildTransitive</PackagePath>
<Pack>true</Pack>
</Content>
</ItemGroup>
<ItemGroup>
<UpToDateCheckInput Remove="ts\SurfaceManager.ts" />
<PackageReference Include="Uno.UI" Version="3.0.5" />
</ItemGroup>
<ItemGroup>
@ -77,26 +55,16 @@
<None Include="..\SkiaSharp.Views.Apple\**\*.cs" Link="SharedViews\%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
<ProjectReference Include="..\..\..\binding\SkiaSharp.Wasm\SkiaSharp.Wasm.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='xamarinios10' or '$(TargetFramework)'=='xamarinmac20' or '$(TargetFramework)'=='monoandroid80' or '$(TargetFramework)'=='monoandroid90'">
<PackageReference Include="SkiaSharp" Version="1.68.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
<PackageReference Include="SkiaSharp" Version="1.68.0" PrivateAssets="all" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='monoandroid80' or '$(TargetFramework)'=='monoandroid90'">
<Compile Include="..\SkiaSharp.Views.Android\AndroidExtensions.cs" Link="AndroidExtensions.cs" />
</ItemGroup>
<!--
Adjust the items list generate by the microsoft.typescript.msbuild package.
If those items are not removed, they end-up packaged in nuget, and get parsed
incorrectly as duplicate typescript files.
-->
<Target Name="AdjustPackContent" BeforeTargets="GetTypeScriptOutputForPublishing">
<ItemGroup>
<GeneratedJavascript Remove="@(GeneratedJavascript)" />
</ItemGroup>
</Target>
</Project>

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

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project>
<ItemGroup>
<UnoRuntimeEnabledPackage Include="SkiaSharp.Views.Uno" />
</ItemGroup>
</Project>