зеркало из https://github.com/mono/SkiaSharp.git
Function pointers and LibraryImport (#2917)
* Update generator to emit function pointers * Regenerate interop files * Enable USE_LIBRARY_IMPORT in HarfBuzzSharp * Enable USE_LIBRARY_IMPORT on SkiaSharp * Set DisableRuntimeMarshalling on HarfBuzzSharp * Replace remaining DllImports with LibraryImport on SkiaSharp * Set DisableRuntimeMarshalling on SkiaSharp as well * Fix missed proxy definition * Regenerate skia api with a correct submodule version * Collections literals are not supported on the CI .NET SDK * An attempt to fix Tizen build * Forgot about partial * Set UnmanagedType.LPStr on evas_gl_proc_address_get instead * Set USE_LIBRARY_IMPORT on remaining projects too * Update generator tool to generate DelegateProxy as well * Regenerate HarfBuzz and SkiaSharp with new DelegateProxy source gen * Regenerate other projects as well * Add `protected internal` to test classes too, since this project has InternalsVisibleTo configured * Disable DelegateTypesAreValid and DelegateTypesHaveAttributes tests on .NET 7+ build, see comments * Reduce warnings noise * Update binding/SkiaSharp/GRGlInterface.cs Co-authored-by: Filip Navara <filip.navara@gmail.com> * Add missing USE_LIBRARY_IMPORT defines * Update binding/SkiaSharp/GRGlInterface.cs * Also needs USE_LIBRARY_IMPORT --------- Co-authored-by: Matthew Leibowitz <mattleibow@live.com> Co-authored-by: Filip Navara <filip.navara@gmail.com>
This commit is contained in:
Родитель
6058ab0c79
Коммит
9cbf9c80b7
|
@ -25,20 +25,6 @@ namespace SkiaSharp
|
||||||
{
|
{
|
||||||
// normal delegates
|
// normal delegates
|
||||||
|
|
||||||
[MethodImpl (MethodImplOptions.AggressiveInlining)]
|
|
||||||
public static T Create<T> (object managedDel, T nativeDel, out GCHandle gch, out IntPtr contextPtr)
|
|
||||||
{
|
|
||||||
if (managedDel == null) {
|
|
||||||
gch = default (GCHandle);
|
|
||||||
contextPtr = IntPtr.Zero;
|
|
||||||
return default (T);
|
|
||||||
}
|
|
||||||
|
|
||||||
gch = GCHandle.Alloc (managedDel);
|
|
||||||
contextPtr = GCHandle.ToIntPtr (gch);
|
|
||||||
return nativeDel;
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl (MethodImplOptions.AggressiveInlining)]
|
[MethodImpl (MethodImplOptions.AggressiveInlining)]
|
||||||
public static void Create (object managedDel, out GCHandle gch, out IntPtr contextPtr)
|
public static void Create (object managedDel, out GCHandle gch, out IntPtr contextPtr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace HarfBuzzSharp
|
namespace HarfBuzzSharp
|
||||||
|
@ -84,7 +83,8 @@ namespace HarfBuzzSharp
|
||||||
|
|
||||||
private static IntPtr Create (IntPtr data, int length, MemoryMode mode, ReleaseDelegate releaseProc)
|
private static IntPtr Create (IntPtr data, int length, MemoryMode mode, ReleaseDelegate releaseProc)
|
||||||
{
|
{
|
||||||
var proxy = DelegateProxies.Create (releaseProc, DelegateProxies.ReleaseDelegateProxy, out _, out var ctx);
|
DelegateProxies.Create (releaseProc, out _, out var ctx);
|
||||||
|
var proxy = releaseProc != null ? DelegateProxies.DestroyProxy : null;
|
||||||
return HarfBuzzApi.hb_blob_create ((void*)data, (uint)length, mode, (void*)ctx, proxy);
|
return HarfBuzzApi.hb_blob_create ((void*)data, (uint)length, mode, (void*)ctx, proxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
// ReSharper disable PartialMethodParameterNameMismatch
|
||||||
|
|
||||||
namespace HarfBuzzSharp
|
namespace HarfBuzzSharp
|
||||||
{
|
{
|
||||||
|
@ -11,15 +13,7 @@ namespace HarfBuzzSharp
|
||||||
|
|
||||||
internal static unsafe partial class DelegateProxies
|
internal static unsafe partial class DelegateProxies
|
||||||
{
|
{
|
||||||
// references to the proxy implementations
|
private static partial void DestroyProxyImplementation (void* context)
|
||||||
public static readonly DestroyProxyDelegate ReleaseDelegateProxy = ReleaseDelegateProxyImplementation;
|
|
||||||
public static readonly DestroyProxyDelegate ReleaseDelegateProxyForMulti = ReleaseDelegateProxyImplementationForMulti;
|
|
||||||
public static readonly ReferenceTableProxyDelegate GetTableDelegateProxy = GetTableDelegateProxyImplementation;
|
|
||||||
|
|
||||||
// internal proxy implementations
|
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (DestroyProxyDelegate))]
|
|
||||||
private static void ReleaseDelegateProxyImplementation (void* context)
|
|
||||||
{
|
{
|
||||||
var del = Get<ReleaseDelegate> ((IntPtr)context, out var gch);
|
var del = Get<ReleaseDelegate> ((IntPtr)context, out var gch);
|
||||||
try {
|
try {
|
||||||
|
@ -29,16 +23,7 @@ namespace HarfBuzzSharp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (ReferenceTableProxyDelegate))]
|
private static partial void DestroyProxyImplementationForMulti (void* context)
|
||||||
private static IntPtr GetTableDelegateProxyImplementation (IntPtr face, uint tag, void* context)
|
|
||||||
{
|
|
||||||
GetMultiUserData<GetTableDelegate, Face> ((IntPtr)context, out var getTable, out var userData, out _);
|
|
||||||
var blob = getTable.Invoke (userData, tag);
|
|
||||||
return blob?.Handle ?? IntPtr.Zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (DestroyProxyDelegate))]
|
|
||||||
private static void ReleaseDelegateProxyImplementationForMulti (void* context)
|
|
||||||
{
|
{
|
||||||
var del = GetMulti<ReleaseDelegate> ((IntPtr)context, out var gch);
|
var del = GetMulti<ReleaseDelegate> ((IntPtr)context, out var gch);
|
||||||
try {
|
try {
|
||||||
|
@ -47,5 +32,12 @@ namespace HarfBuzzSharp
|
||||||
gch.Free ();
|
gch.Free ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static partial IntPtr ReferenceTableProxyImplementation (IntPtr face, uint tag, void* context)
|
||||||
|
{
|
||||||
|
GetMultiUserData<GetTableDelegate, Face> ((IntPtr)context, out var getTable, out var userData, out _);
|
||||||
|
var blob = getTable.Invoke (userData, tag);
|
||||||
|
return blob?.Handle ?? IntPtr.Zero;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
// ReSharper disable PartialMethodParameterNameMismatch
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
@ -30,24 +31,9 @@ namespace HarfBuzzSharp
|
||||||
|
|
||||||
internal static unsafe partial class DelegateProxies
|
internal static unsafe partial class DelegateProxies
|
||||||
{
|
{
|
||||||
// references to the proxy implementations
|
|
||||||
public static readonly FontGetFontExtentsProxyDelegate FontExtentsProxy = FontExtentsProxyImplementation;
|
|
||||||
public static readonly FontGetNominalGlyphProxyDelegate NominalGlyphProxy = NominalGlyphProxyImplementation;
|
|
||||||
public static readonly FontGetVariationGlyphProxyDelegate VariationGlyphProxy = VariationGlyphProxyImplementation;
|
|
||||||
public static readonly FontGetNominalGlyphsProxyDelegate NominalGlyphsProxy = NominalGlyphsProxyImplementation;
|
|
||||||
public static readonly FontGetGlyphAdvanceProxyDelegate GlyphAdvanceProxy = GlyphAdvanceProxyImplementation;
|
|
||||||
public static readonly FontGetGlyphAdvancesProxyDelegate GlyphAdvancesProxy = GlyphAdvancesProxyImplementation;
|
|
||||||
public static readonly FontGetGlyphOriginProxyDelegate GlyphOriginProxy = GlyphOriginProxyImplementation;
|
|
||||||
public static readonly FontGetGlyphKerningProxyDelegate GlyphKerningProxy = GlyphKerningProxyImplementation;
|
|
||||||
public static readonly FontGetGlyphExtentsProxyDelegate GlyphExtentsProxy = GlyphExtentsProxyImplementation;
|
|
||||||
public static readonly FontGetGlyphContourPointProxyDelegate GlyphContourPointProxy = GlyphContourPointProxyImplementation;
|
|
||||||
public static readonly FontGetGlyphNameProxyDelegate GlyphNameProxy = GlyphNameProxyImplementation;
|
|
||||||
public static readonly FontGetGlyphFromNameProxyDelegate GlyphFromNameProxy = GlyphFromNameProxyImplementation;
|
|
||||||
|
|
||||||
// internal proxy implementations
|
// internal proxy implementations
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (FontGetFontExtentsProxyDelegate))]
|
private static partial bool FontGetFontExtentsProxyImplementation (IntPtr font, void* fontData, FontExtents* extents, void* context)
|
||||||
private static bool FontExtentsProxyImplementation (IntPtr font, void* fontData, FontExtents* extents, void* context)
|
|
||||||
{
|
{
|
||||||
var del = GetMulti<FontExtentsDelegate> ((IntPtr)context, out _);
|
var del = GetMulti<FontExtentsDelegate> ((IntPtr)context, out _);
|
||||||
var userData = GetMultiUserData<FontUserData> ((IntPtr)fontData, out _);
|
var userData = GetMultiUserData<FontUserData> ((IntPtr)fontData, out _);
|
||||||
|
@ -57,8 +43,7 @@ namespace HarfBuzzSharp
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (FontGetNominalGlyphProxyDelegate))]
|
private static partial bool FontGetNominalGlyphProxyImplementation (IntPtr font, void* fontData, uint unicode, uint* glyph, void* context)
|
||||||
private static bool NominalGlyphProxyImplementation (IntPtr font, void* fontData, uint unicode, uint* glyph, void* context)
|
|
||||||
{
|
{
|
||||||
var del = GetMulti<NominalGlyphDelegate> ((IntPtr)context, out _);
|
var del = GetMulti<NominalGlyphDelegate> ((IntPtr)context, out _);
|
||||||
var userData = GetMultiUserData<FontUserData> ((IntPtr)fontData, out _);
|
var userData = GetMultiUserData<FontUserData> ((IntPtr)fontData, out _);
|
||||||
|
@ -68,8 +53,7 @@ namespace HarfBuzzSharp
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (FontGetNominalGlyphsProxyDelegate))]
|
private static partial uint FontGetNominalGlyphsProxyImplementation (IntPtr font, void* fontData, uint count, uint* firstUnicode, uint unicodeStride, uint* firstGlyph, uint glyphStride, void* context)
|
||||||
private static uint NominalGlyphsProxyImplementation (IntPtr font, void* fontData, uint count, uint* firstUnicode, uint unicodeStride, uint* firstGlyph, uint glyphStride, void* context)
|
|
||||||
{
|
{
|
||||||
var del = GetMulti<NominalGlyphsDelegate> ((IntPtr)context, out _);
|
var del = GetMulti<NominalGlyphsDelegate> ((IntPtr)context, out _);
|
||||||
var unicodes = new ReadOnlySpan<uint> (firstUnicode, (int)count);
|
var unicodes = new ReadOnlySpan<uint> (firstUnicode, (int)count);
|
||||||
|
@ -78,8 +62,7 @@ namespace HarfBuzzSharp
|
||||||
return del.Invoke (userData.Font, userData.FontData, count, unicodes, glyphs);
|
return del.Invoke (userData.Font, userData.FontData, count, unicodes, glyphs);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (FontGetVariationGlyphProxyDelegate))]
|
private static partial bool FontGetVariationGlyphProxyImplementation (IntPtr font, void* fontData, uint unicode, uint variationSelector, uint* glyph, void* context)
|
||||||
private static bool VariationGlyphProxyImplementation (IntPtr font, void* fontData, uint unicode, uint variationSelector, uint* glyph, void* context)
|
|
||||||
{
|
{
|
||||||
var del = GetMulti<VariationGlyphDelegate> ((IntPtr)context, out _);
|
var del = GetMulti<VariationGlyphDelegate> ((IntPtr)context, out _);
|
||||||
var userData = GetMultiUserData<FontUserData> ((IntPtr)fontData, out _);
|
var userData = GetMultiUserData<FontUserData> ((IntPtr)fontData, out _);
|
||||||
|
@ -89,16 +72,14 @@ namespace HarfBuzzSharp
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (FontGetGlyphAdvanceProxyDelegate))]
|
private static partial int FontGetGlyphAdvanceProxyImplementation (IntPtr font, void* fontData, uint glyph, void* context)
|
||||||
private static int GlyphAdvanceProxyImplementation (IntPtr font, void* fontData, uint glyph, void* context)
|
|
||||||
{
|
{
|
||||||
var del = GetMulti<GlyphAdvanceDelegate> ((IntPtr)context, out _);
|
var del = GetMulti<GlyphAdvanceDelegate> ((IntPtr)context, out _);
|
||||||
var userData = GetMultiUserData<FontUserData> ((IntPtr)fontData, out _);
|
var userData = GetMultiUserData<FontUserData> ((IntPtr)fontData, out _);
|
||||||
return del.Invoke (userData.Font, userData.FontData, glyph);
|
return del.Invoke (userData.Font, userData.FontData, glyph);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (FontGetGlyphAdvancesProxyDelegate))]
|
private static partial void FontGetGlyphAdvancesProxyImplementation (IntPtr font, void* fontData, uint count, uint* firstGlyph, uint glyphStride, int* firstAdvance, uint advanceStride, void* context)
|
||||||
private static void GlyphAdvancesProxyImplementation (IntPtr font, void* fontData, uint count, uint* firstGlyph, uint glyphStride, int* firstAdvance, uint advanceStride, void* context)
|
|
||||||
{
|
{
|
||||||
var del = GetMulti<GlyphAdvancesDelegate> ((IntPtr)context, out _);
|
var del = GetMulti<GlyphAdvancesDelegate> ((IntPtr)context, out _);
|
||||||
var glyphs = new ReadOnlySpan<uint> (firstGlyph, (int)count);
|
var glyphs = new ReadOnlySpan<uint> (firstGlyph, (int)count);
|
||||||
|
@ -107,8 +88,7 @@ namespace HarfBuzzSharp
|
||||||
del.Invoke (userData.Font, userData.FontData, count, glyphs, advances);
|
del.Invoke (userData.Font, userData.FontData, count, glyphs, advances);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (FontGetGlyphOriginProxyDelegate))]
|
private static partial bool FontGetGlyphOriginProxyImplementation (IntPtr font, void* fontData, uint glyph, int* x, int* y, void* context)
|
||||||
private static bool GlyphOriginProxyImplementation (IntPtr font, void* fontData, uint glyph, int* x, int* y, void* context)
|
|
||||||
{
|
{
|
||||||
var del = GetMulti<GlyphOriginDelegate> ((IntPtr)context, out _);
|
var del = GetMulti<GlyphOriginDelegate> ((IntPtr)context, out _);
|
||||||
var userData = GetMultiUserData<FontUserData> ((IntPtr)fontData, out _);
|
var userData = GetMultiUserData<FontUserData> ((IntPtr)fontData, out _);
|
||||||
|
@ -120,16 +100,14 @@ namespace HarfBuzzSharp
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (FontGetGlyphKerningProxyDelegate))]
|
private static partial int FontGetGlyphKerningProxyImplementation (IntPtr font, void* fontData, uint firstGlyph, uint secondGlyph, void* context)
|
||||||
private static int GlyphKerningProxyImplementation (IntPtr font, void* fontData, uint firstGlyph, uint secondGlyph, void* context)
|
|
||||||
{
|
{
|
||||||
var del = GetMulti<GlyphKerningDelegate> ((IntPtr)context, out _);
|
var del = GetMulti<GlyphKerningDelegate> ((IntPtr)context, out _);
|
||||||
var userData = GetMultiUserData<FontUserData> ((IntPtr)fontData, out _);
|
var userData = GetMultiUserData<FontUserData> ((IntPtr)fontData, out _);
|
||||||
return del.Invoke (userData.Font, userData.FontData, firstGlyph, secondGlyph);
|
return del.Invoke (userData.Font, userData.FontData, firstGlyph, secondGlyph);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (FontGetGlyphExtentsProxyDelegate))]
|
private static partial bool FontGetGlyphExtentsProxyImplementation (IntPtr font, void* fontData, uint glyph, GlyphExtents* extents, void* context)
|
||||||
private static bool GlyphExtentsProxyImplementation (IntPtr font, void* fontData, uint glyph, GlyphExtents* extents, void* context)
|
|
||||||
{
|
{
|
||||||
var del = GetMulti<GlyphExtentsDelegate> ((IntPtr)context, out _);
|
var del = GetMulti<GlyphExtentsDelegate> ((IntPtr)context, out _);
|
||||||
var userData = GetMultiUserData<FontUserData> ((IntPtr)fontData, out _);
|
var userData = GetMultiUserData<FontUserData> ((IntPtr)fontData, out _);
|
||||||
|
@ -139,8 +117,7 @@ namespace HarfBuzzSharp
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (FontGetGlyphContourPointProxyDelegate))]
|
private static partial bool FontGetGlyphContourPointProxyImplementation (IntPtr font, void* fontData, uint glyph, uint pointIndex, int* x, int* y, void* context)
|
||||||
private static bool GlyphContourPointProxyImplementation (IntPtr font, void* fontData, uint glyph, uint pointIndex, int* x, int* y, void* context)
|
|
||||||
{
|
{
|
||||||
var del = GetMulti<GlyphContourPointDelegate> ((IntPtr)context, out _);
|
var del = GetMulti<GlyphContourPointDelegate> ((IntPtr)context, out _);
|
||||||
var userData = GetMultiUserData<FontUserData> ((IntPtr)fontData, out _);
|
var userData = GetMultiUserData<FontUserData> ((IntPtr)fontData, out _);
|
||||||
|
@ -152,8 +129,7 @@ namespace HarfBuzzSharp
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (FontGetGlyphNameProxyDelegate))]
|
private static partial bool FontGetGlyphNameProxyImplementation (IntPtr font, void* fontData, uint glyph, void* nameBuffer, uint size, void* context)
|
||||||
private static bool GlyphNameProxyImplementation (IntPtr font, void* fontData, uint glyph, void* nameBuffer, uint size, void* context)
|
|
||||||
{
|
{
|
||||||
var del = GetMulti<GlyphNameDelegate> ((IntPtr)context, out _);
|
var del = GetMulti<GlyphNameDelegate> ((IntPtr)context, out _);
|
||||||
var userData = GetMultiUserData<FontUserData> ((IntPtr)fontData, out _);
|
var userData = GetMultiUserData<FontUserData> ((IntPtr)fontData, out _);
|
||||||
|
@ -166,8 +142,7 @@ namespace HarfBuzzSharp
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (FontGetGlyphFromNameProxyDelegate))]
|
private static partial bool FontGetGlyphFromNameProxyImplementation (IntPtr font, void* fontData, void* name, int len, uint* glyph, void* context)
|
||||||
private static bool GlyphFromNameProxyImplementation (IntPtr font, void* fontData, void* name, int len, uint* glyph, void* context)
|
|
||||||
{
|
{
|
||||||
var del = GetMulti<GlyphFromNameDelegate> ((IntPtr)context, out _);
|
var del = GetMulti<GlyphFromNameDelegate> ((IntPtr)context, out _);
|
||||||
var userData = GetMultiUserData<FontUserData> ((IntPtr)fontData, out _);
|
var userData = GetMultiUserData<FontUserData> ((IntPtr)fontData, out _);
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
// ReSharper disable PartialMethodParameterNameMismatch
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace HarfBuzzSharp
|
namespace HarfBuzzSharp
|
||||||
{
|
{
|
||||||
|
@ -18,43 +21,31 @@ namespace HarfBuzzSharp
|
||||||
|
|
||||||
internal static unsafe partial class DelegateProxies
|
internal static unsafe partial class DelegateProxies
|
||||||
{
|
{
|
||||||
public static readonly UnicodeCombiningClassProxyDelegate CombiningClassProxy = CombiningClassProxyImplementation;
|
private static partial int UnicodeCombiningClassProxyImplementation (IntPtr ufuncs, uint unicode, void* context)
|
||||||
public static readonly UnicodeGeneralCategoryProxyDelegate GeneralCategoryProxy = GeneralCategoryProxyImplementation;
|
|
||||||
public static readonly UnicodeMirroringProxyDelegate MirroringProxy = MirroringProxyImplementation;
|
|
||||||
public static readonly UnicodeScriptProxyDelegate ScriptProxy = ScriptProxyImplementation;
|
|
||||||
public static readonly UnicodeComposeProxyDelegate ComposeProxy = ComposeProxyImplementation;
|
|
||||||
public static readonly UnicodeDecomposeProxyDelegate DecomposeProxy = DecomposeProxyImplementation;
|
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (UnicodeCombiningClassProxyDelegate))]
|
|
||||||
private static int CombiningClassProxyImplementation (IntPtr ufuncs, uint unicode, void* context)
|
|
||||||
{
|
{
|
||||||
GetMultiUserData<CombiningClassDelegate, UnicodeFunctions> ((IntPtr)context, out var del, out var functions, out _);
|
GetMultiUserData<CombiningClassDelegate, UnicodeFunctions> ((IntPtr)context, out var del, out var functions, out _);
|
||||||
return (int)del.Invoke (functions, unicode);
|
return (int)del.Invoke (functions, unicode);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (UnicodeGeneralCategoryProxyDelegate))]
|
private static partial int UnicodeGeneralCategoryProxyImplementation (IntPtr ufuncs, uint unicode, void* context)
|
||||||
private static int GeneralCategoryProxyImplementation (IntPtr ufuncs, uint unicode, void* context)
|
|
||||||
{
|
{
|
||||||
GetMultiUserData<GeneralCategoryDelegate, UnicodeFunctions> ((IntPtr)context, out var del, out var functions, out _);
|
GetMultiUserData<GeneralCategoryDelegate, UnicodeFunctions> ((IntPtr)context, out var del, out var functions, out _);
|
||||||
return (int)del.Invoke (functions, unicode);
|
return (int)del.Invoke (functions, unicode);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (UnicodeMirroringProxyDelegate))]
|
private static partial uint UnicodeMirroringProxyImplementation (IntPtr ufuncs, uint unicode, void* context)
|
||||||
private static uint MirroringProxyImplementation (IntPtr ufuncs, uint unicode, void* context)
|
|
||||||
{
|
{
|
||||||
GetMultiUserData<MirroringDelegate, UnicodeFunctions> ((IntPtr)context, out var del, out var functions, out _);
|
GetMultiUserData<MirroringDelegate, UnicodeFunctions> ((IntPtr)context, out var del, out var functions, out _);
|
||||||
return del.Invoke (functions, unicode);
|
return del.Invoke (functions, unicode);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (UnicodeScriptProxyDelegate))]
|
private static partial uint UnicodeScriptProxyImplementation (IntPtr ufuncs, uint unicode, void* context)
|
||||||
private static uint ScriptProxyImplementation (IntPtr ufuncs, uint unicode, void* context)
|
|
||||||
{
|
{
|
||||||
GetMultiUserData<ScriptDelegate, UnicodeFunctions> ((IntPtr)context, out var del, out var functions, out _);
|
GetMultiUserData<ScriptDelegate, UnicodeFunctions> ((IntPtr)context, out var del, out var functions, out _);
|
||||||
return del.Invoke (functions, unicode);
|
return del.Invoke (functions, unicode);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (UnicodeComposeProxyDelegate))]
|
private static partial bool UnicodeComposeProxyImplementation (IntPtr ufuncs, uint a, uint b, uint* ab, void* context)
|
||||||
private static bool ComposeProxyImplementation (IntPtr ufuncs, uint a, uint b, uint* ab, void* context)
|
|
||||||
{
|
{
|
||||||
GetMultiUserData<ComposeDelegate, UnicodeFunctions> ((IntPtr)context, out var del, out var functions, out _);
|
GetMultiUserData<ComposeDelegate, UnicodeFunctions> ((IntPtr)context, out var del, out var functions, out _);
|
||||||
var result = del.Invoke (functions, a, b, out var abManaged);
|
var result = del.Invoke (functions, a, b, out var abManaged);
|
||||||
|
@ -63,8 +54,7 @@ namespace HarfBuzzSharp
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (UnicodeDecomposeProxyDelegate))]
|
private static partial bool UnicodeDecomposeProxyImplementation (IntPtr ufuncs, uint ab, uint* a, uint* b, void* context)
|
||||||
private static bool DecomposeProxyImplementation (IntPtr ufuncs, uint ab, uint* a, uint* b, void* context)
|
|
||||||
{
|
{
|
||||||
GetMultiUserData<DecomposeDelegate, UnicodeFunctions> ((IntPtr)context, out var del, out var functions, out _);
|
GetMultiUserData<DecomposeDelegate, UnicodeFunctions> ((IntPtr)context, out var del, out var functions, out _);
|
||||||
var result = del.Invoke (functions, ab, out var aManaged, out var bManaged);
|
var result = del.Invoke (functions, ab, out var aManaged, out var bManaged);
|
||||||
|
|
|
@ -41,9 +41,9 @@ namespace HarfBuzzSharp
|
||||||
throw new ArgumentNullException (nameof (getTable));
|
throw new ArgumentNullException (nameof (getTable));
|
||||||
|
|
||||||
Handle = HarfBuzzApi.hb_face_create_for_tables (
|
Handle = HarfBuzzApi.hb_face_create_for_tables (
|
||||||
DelegateProxies.GetTableDelegateProxy,
|
DelegateProxies.ReferenceTableProxy,
|
||||||
(void*)DelegateProxies.CreateMultiUserData (getTable, destroy, this),
|
(void*)DelegateProxies.CreateMultiUserData (getTable, destroy, this),
|
||||||
DelegateProxies.ReleaseDelegateProxyForMulti);
|
DelegateProxies.DestroyProxyForMulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Face (IntPtr handle)
|
internal Face (IntPtr handle)
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace HarfBuzzSharp
|
||||||
|
|
||||||
var container = new FontUserData (this, fontData);
|
var container = new FontUserData (this, fontData);
|
||||||
var ctx = DelegateProxies.CreateMultiUserData (destroy, container);
|
var ctx = DelegateProxies.CreateMultiUserData (destroy, container);
|
||||||
HarfBuzzApi.hb_font_set_funcs (Handle, fontFunctions.Handle, (void*)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
|
HarfBuzzApi.hb_font_set_funcs (Handle, fontFunctions.Handle, (void*)ctx, DelegateProxies.DestroyProxyForMulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GetScale (out int xScale, out int yScale)
|
public void GetScale (out int xScale, out int yScale)
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace HarfBuzzSharp
|
||||||
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
||||||
|
|
||||||
HarfBuzzApi.hb_font_funcs_set_font_h_extents_func (
|
HarfBuzzApi.hb_font_funcs_set_font_h_extents_func (
|
||||||
Handle, DelegateProxies.FontExtentsProxy, (void*)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
|
Handle, DelegateProxies.FontGetFontExtentsProxy, (void*)ctx, DelegateProxies.DestroyProxyForMulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetVerticalFontExtentsDelegate (FontExtentsDelegate del, ReleaseDelegate destroy = null)
|
public void SetVerticalFontExtentsDelegate (FontExtentsDelegate del, ReleaseDelegate destroy = null)
|
||||||
|
@ -42,7 +42,7 @@ namespace HarfBuzzSharp
|
||||||
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
||||||
|
|
||||||
HarfBuzzApi.hb_font_funcs_set_font_v_extents_func (
|
HarfBuzzApi.hb_font_funcs_set_font_v_extents_func (
|
||||||
Handle, DelegateProxies.FontExtentsProxy, (void*)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
|
Handle, DelegateProxies.FontGetFontExtentsProxy, (void*)ctx, DelegateProxies.DestroyProxyForMulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetNominalGlyphDelegate (NominalGlyphDelegate del, ReleaseDelegate destroy = null)
|
public void SetNominalGlyphDelegate (NominalGlyphDelegate del, ReleaseDelegate destroy = null)
|
||||||
|
@ -52,7 +52,7 @@ namespace HarfBuzzSharp
|
||||||
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
||||||
|
|
||||||
HarfBuzzApi.hb_font_funcs_set_nominal_glyph_func (
|
HarfBuzzApi.hb_font_funcs_set_nominal_glyph_func (
|
||||||
Handle, DelegateProxies.NominalGlyphProxy, (void*)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
|
Handle, DelegateProxies.FontGetNominalGlyphProxy, (void*)ctx, DelegateProxies.DestroyProxyForMulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetNominalGlyphsDelegate (NominalGlyphsDelegate del, ReleaseDelegate destroy = null)
|
public void SetNominalGlyphsDelegate (NominalGlyphsDelegate del, ReleaseDelegate destroy = null)
|
||||||
|
@ -62,7 +62,7 @@ namespace HarfBuzzSharp
|
||||||
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
||||||
|
|
||||||
HarfBuzzApi.hb_font_funcs_set_nominal_glyphs_func (
|
HarfBuzzApi.hb_font_funcs_set_nominal_glyphs_func (
|
||||||
Handle, DelegateProxies.NominalGlyphsProxy, (void*)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
|
Handle, DelegateProxies.FontGetNominalGlyphsProxy, (void*)ctx, DelegateProxies.DestroyProxyForMulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetVariationGlyphDelegate (VariationGlyphDelegate del, ReleaseDelegate destroy = null)
|
public void SetVariationGlyphDelegate (VariationGlyphDelegate del, ReleaseDelegate destroy = null)
|
||||||
|
@ -72,7 +72,7 @@ namespace HarfBuzzSharp
|
||||||
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
||||||
|
|
||||||
HarfBuzzApi.hb_font_funcs_set_variation_glyph_func (
|
HarfBuzzApi.hb_font_funcs_set_variation_glyph_func (
|
||||||
Handle, DelegateProxies.VariationGlyphProxy, (void*)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
|
Handle, DelegateProxies.FontGetVariationGlyphProxy, (void*)ctx, DelegateProxies.DestroyProxyForMulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetHorizontalGlyphAdvanceDelegate (GlyphAdvanceDelegate del, ReleaseDelegate destroy = null)
|
public void SetHorizontalGlyphAdvanceDelegate (GlyphAdvanceDelegate del, ReleaseDelegate destroy = null)
|
||||||
|
@ -82,7 +82,7 @@ namespace HarfBuzzSharp
|
||||||
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
||||||
|
|
||||||
HarfBuzzApi.hb_font_funcs_set_glyph_h_advance_func (
|
HarfBuzzApi.hb_font_funcs_set_glyph_h_advance_func (
|
||||||
Handle, DelegateProxies.GlyphAdvanceProxy, (void*)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
|
Handle, DelegateProxies.FontGetGlyphAdvanceProxy, (void*)ctx, DelegateProxies.DestroyProxyForMulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetVerticalGlyphAdvanceDelegate (GlyphAdvanceDelegate del, ReleaseDelegate destroy = null)
|
public void SetVerticalGlyphAdvanceDelegate (GlyphAdvanceDelegate del, ReleaseDelegate destroy = null)
|
||||||
|
@ -92,7 +92,7 @@ namespace HarfBuzzSharp
|
||||||
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
||||||
|
|
||||||
HarfBuzzApi.hb_font_funcs_set_glyph_v_advance_func (
|
HarfBuzzApi.hb_font_funcs_set_glyph_v_advance_func (
|
||||||
Handle, DelegateProxies.GlyphAdvanceProxy, (void*)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
|
Handle, DelegateProxies.FontGetGlyphAdvanceProxy, (void*)ctx, DelegateProxies.DestroyProxyForMulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetHorizontalGlyphAdvancesDelegate (GlyphAdvancesDelegate del, ReleaseDelegate destroy = null)
|
public void SetHorizontalGlyphAdvancesDelegate (GlyphAdvancesDelegate del, ReleaseDelegate destroy = null)
|
||||||
|
@ -102,7 +102,7 @@ namespace HarfBuzzSharp
|
||||||
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
||||||
|
|
||||||
HarfBuzzApi.hb_font_funcs_set_glyph_h_advances_func (
|
HarfBuzzApi.hb_font_funcs_set_glyph_h_advances_func (
|
||||||
Handle, DelegateProxies.GlyphAdvancesProxy, (void*)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
|
Handle, DelegateProxies.FontGetGlyphAdvancesProxy, (void*)ctx, DelegateProxies.DestroyProxyForMulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetVerticalGlyphAdvancesDelegate (GlyphAdvancesDelegate del, ReleaseDelegate destroy = null)
|
public void SetVerticalGlyphAdvancesDelegate (GlyphAdvancesDelegate del, ReleaseDelegate destroy = null)
|
||||||
|
@ -112,7 +112,7 @@ namespace HarfBuzzSharp
|
||||||
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
||||||
|
|
||||||
HarfBuzzApi.hb_font_funcs_set_glyph_v_advances_func (
|
HarfBuzzApi.hb_font_funcs_set_glyph_v_advances_func (
|
||||||
Handle, DelegateProxies.GlyphAdvancesProxy, (void*)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
|
Handle, DelegateProxies.FontGetGlyphAdvancesProxy, (void*)ctx, DelegateProxies.DestroyProxyForMulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetHorizontalGlyphOriginDelegate (GlyphOriginDelegate del, ReleaseDelegate destroy = null)
|
public void SetHorizontalGlyphOriginDelegate (GlyphOriginDelegate del, ReleaseDelegate destroy = null)
|
||||||
|
@ -122,7 +122,7 @@ namespace HarfBuzzSharp
|
||||||
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
||||||
|
|
||||||
HarfBuzzApi.hb_font_funcs_set_glyph_h_origin_func (
|
HarfBuzzApi.hb_font_funcs_set_glyph_h_origin_func (
|
||||||
Handle, DelegateProxies.GlyphOriginProxy, (void*)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
|
Handle, DelegateProxies.FontGetGlyphOriginProxy, (void*)ctx, DelegateProxies.DestroyProxyForMulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetVerticalGlyphOriginDelegate (GlyphOriginDelegate del, ReleaseDelegate destroy = null)
|
public void SetVerticalGlyphOriginDelegate (GlyphOriginDelegate del, ReleaseDelegate destroy = null)
|
||||||
|
@ -132,7 +132,7 @@ namespace HarfBuzzSharp
|
||||||
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
||||||
|
|
||||||
HarfBuzzApi.hb_font_funcs_set_glyph_v_origin_func (
|
HarfBuzzApi.hb_font_funcs_set_glyph_v_origin_func (
|
||||||
Handle, DelegateProxies.GlyphOriginProxy, (void*)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
|
Handle, DelegateProxies.FontGetGlyphOriginProxy, (void*)ctx, DelegateProxies.DestroyProxyForMulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetHorizontalGlyphKerningDelegate (GlyphKerningDelegate del, ReleaseDelegate destroy = null)
|
public void SetHorizontalGlyphKerningDelegate (GlyphKerningDelegate del, ReleaseDelegate destroy = null)
|
||||||
|
@ -142,7 +142,7 @@ namespace HarfBuzzSharp
|
||||||
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
||||||
|
|
||||||
HarfBuzzApi.hb_font_funcs_set_glyph_h_kerning_func (
|
HarfBuzzApi.hb_font_funcs_set_glyph_h_kerning_func (
|
||||||
Handle, DelegateProxies.GlyphKerningProxy, (void*)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
|
Handle, DelegateProxies.FontGetGlyphKerningProxy, (void*)ctx, DelegateProxies.DestroyProxyForMulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetGlyphExtentsDelegate (GlyphExtentsDelegate del, ReleaseDelegate destroy = null)
|
public void SetGlyphExtentsDelegate (GlyphExtentsDelegate del, ReleaseDelegate destroy = null)
|
||||||
|
@ -152,7 +152,7 @@ namespace HarfBuzzSharp
|
||||||
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
||||||
|
|
||||||
HarfBuzzApi.hb_font_funcs_set_glyph_extents_func (
|
HarfBuzzApi.hb_font_funcs_set_glyph_extents_func (
|
||||||
Handle, DelegateProxies.GlyphExtentsProxy, (void*)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
|
Handle, DelegateProxies.FontGetGlyphExtentsProxy, (void*)ctx, DelegateProxies.DestroyProxyForMulti);
|
||||||
}
|
}
|
||||||
public void SetGlyphContourPointDelegate (GlyphContourPointDelegate del, ReleaseDelegate destroy = null)
|
public void SetGlyphContourPointDelegate (GlyphContourPointDelegate del, ReleaseDelegate destroy = null)
|
||||||
{
|
{
|
||||||
|
@ -161,7 +161,7 @@ namespace HarfBuzzSharp
|
||||||
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
||||||
|
|
||||||
HarfBuzzApi.hb_font_funcs_set_glyph_contour_point_func (
|
HarfBuzzApi.hb_font_funcs_set_glyph_contour_point_func (
|
||||||
Handle, DelegateProxies.GlyphContourPointProxy, (void*)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
|
Handle, DelegateProxies.FontGetGlyphContourPointProxy, (void*)ctx, DelegateProxies.DestroyProxyForMulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetGlyphNameDelegate (GlyphNameDelegate del, ReleaseDelegate destroy = null)
|
public void SetGlyphNameDelegate (GlyphNameDelegate del, ReleaseDelegate destroy = null)
|
||||||
|
@ -171,7 +171,7 @@ namespace HarfBuzzSharp
|
||||||
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
||||||
|
|
||||||
HarfBuzzApi.hb_font_funcs_set_glyph_name_func (
|
HarfBuzzApi.hb_font_funcs_set_glyph_name_func (
|
||||||
Handle, DelegateProxies.GlyphNameProxy, (void*)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
|
Handle, DelegateProxies.FontGetGlyphNameProxy, (void*)ctx, DelegateProxies.DestroyProxyForMulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetGlyphFromNameDelegate (GlyphFromNameDelegate del, ReleaseDelegate destroy = null)
|
public void SetGlyphFromNameDelegate (GlyphFromNameDelegate del, ReleaseDelegate destroy = null)
|
||||||
|
@ -181,7 +181,7 @@ namespace HarfBuzzSharp
|
||||||
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
var ctx = DelegateProxies.CreateMulti (del, destroy);
|
||||||
|
|
||||||
HarfBuzzApi.hb_font_funcs_set_glyph_from_name_func (
|
HarfBuzzApi.hb_font_funcs_set_glyph_from_name_func (
|
||||||
Handle, DelegateProxies.GlyphFromNameProxy, (void*)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
|
Handle, DelegateProxies.FontGetGlyphFromNameProxy, (void*)ctx, DelegateProxies.DestroyProxyForMulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose (bool disposing) =>
|
protected override void Dispose (bool disposing) =>
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -6,10 +6,15 @@
|
||||||
<PackagingGroup>HarfBuzzSharp</PackagingGroup>
|
<PackagingGroup>HarfBuzzSharp</PackagingGroup>
|
||||||
<DefineConstants>$(DefineConstants);HARFBUZZ</DefineConstants>
|
<DefineConstants>$(DefineConstants);HARFBUZZ</DefineConstants>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<WarningsAsErrors>$(WarningsAsErrors);CA1420;CA1421;</WarningsAsErrors>
|
||||||
|
<NoWarn>$(NoWarn);CS8826</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))">
|
<PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))">
|
||||||
<DefineConstants>$(DefineConstants);USE_DELEGATES</DefineConstants>
|
<DefineConstants>$(DefineConstants);USE_DELEGATES</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">
|
||||||
|
<DefineConstants>$(DefineConstants);USE_LIBRARY_IMPORT</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup Condition="'$(BuildingInsideVisualStudio)' != 'true'">
|
<ItemGroup Condition="'$(BuildingInsideVisualStudio)' != 'true'">
|
||||||
<ProjectReference Include="..\HarfBuzzSharp.NativeAssets.Android\HarfBuzzSharp.NativeAssets.Android.csproj" Condition="$(TargetFramework.Contains('-android'))" />
|
<ProjectReference Include="..\HarfBuzzSharp.NativeAssets.Android\HarfBuzzSharp.NativeAssets.Android.csproj" Condition="$(TargetFramework.Contains('-android'))" />
|
||||||
<ProjectReference Include="..\HarfBuzzSharp.NativeAssets.iOS\HarfBuzzSharp.NativeAssets.iOS.csproj" Condition="$(TargetFramework.Contains('-ios'))" />
|
<ProjectReference Include="..\HarfBuzzSharp.NativeAssets.iOS\HarfBuzzSharp.NativeAssets.iOS.csproj" Condition="$(TargetFramework.Contains('-ios'))" />
|
||||||
|
|
|
@ -62,17 +62,6 @@ namespace HarfBuzzSharp
|
||||||
GC.SuppressFinalize (this);
|
GC.SuppressFinalize (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static IntPtr StructureArrayToPtr<T> (IReadOnlyList<T> items)
|
|
||||||
{
|
|
||||||
var size = Marshal.SizeOf<T> ();
|
|
||||||
var memory = Marshal.AllocCoTaskMem (size * items.Count);
|
|
||||||
for (var i = 0; i < items.Count; i++) {
|
|
||||||
var ptr = new IntPtr (memory.ToInt64 () + (i * size));
|
|
||||||
Marshal.StructureToPtr (items[i], ptr, true);
|
|
||||||
}
|
|
||||||
return memory;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static IEnumerable<string> PtrToStringArray (IntPtr intPtr)
|
internal static IEnumerable<string> PtrToStringArray (IntPtr intPtr)
|
||||||
{
|
{
|
||||||
if (intPtr != IntPtr.Zero) {
|
if (intPtr != IntPtr.Zero) {
|
||||||
|
|
|
@ -27,3 +27,7 @@ using System.Runtime.CompilerServices;
|
||||||
[assembly: Foundation.LinkerSafe]
|
[assembly: Foundation.LinkerSafe]
|
||||||
#pragma warning restore CS0618 // Type or member is obsolete
|
#pragma warning restore CS0618 // Type or member is obsolete
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if NET7_0_OR_GREATER
|
||||||
|
[assembly: DisableRuntimeMarshalling]
|
||||||
|
#endif
|
||||||
|
|
|
@ -97,7 +97,7 @@ namespace HarfBuzzSharp
|
||||||
|
|
||||||
var ctx = DelegateProxies.CreateMultiUserData (del, destroy, this);
|
var ctx = DelegateProxies.CreateMultiUserData (del, destroy, this);
|
||||||
HarfBuzzApi.hb_unicode_funcs_set_combining_class_func (
|
HarfBuzzApi.hb_unicode_funcs_set_combining_class_func (
|
||||||
Handle, DelegateProxies.CombiningClassProxy, (void*)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
|
Handle, DelegateProxies.UnicodeCombiningClassProxy, (void*)ctx, DelegateProxies.DestroyProxyForMulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetGeneralCategoryDelegate (GeneralCategoryDelegate del, ReleaseDelegate destroy = null)
|
public void SetGeneralCategoryDelegate (GeneralCategoryDelegate del, ReleaseDelegate destroy = null)
|
||||||
|
@ -106,7 +106,7 @@ namespace HarfBuzzSharp
|
||||||
|
|
||||||
var ctx = DelegateProxies.CreateMultiUserData (del, destroy, this);
|
var ctx = DelegateProxies.CreateMultiUserData (del, destroy, this);
|
||||||
HarfBuzzApi.hb_unicode_funcs_set_general_category_func (
|
HarfBuzzApi.hb_unicode_funcs_set_general_category_func (
|
||||||
Handle, DelegateProxies.GeneralCategoryProxy, (void*)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
|
Handle, DelegateProxies.UnicodeGeneralCategoryProxy, (void*)ctx, DelegateProxies.DestroyProxyForMulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetMirroringDelegate (MirroringDelegate del, ReleaseDelegate destroy = null)
|
public void SetMirroringDelegate (MirroringDelegate del, ReleaseDelegate destroy = null)
|
||||||
|
@ -115,7 +115,7 @@ namespace HarfBuzzSharp
|
||||||
|
|
||||||
var ctx = DelegateProxies.CreateMultiUserData (del, destroy, this);
|
var ctx = DelegateProxies.CreateMultiUserData (del, destroy, this);
|
||||||
HarfBuzzApi.hb_unicode_funcs_set_mirroring_func (
|
HarfBuzzApi.hb_unicode_funcs_set_mirroring_func (
|
||||||
Handle, DelegateProxies.MirroringProxy, (void*)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
|
Handle, DelegateProxies.UnicodeMirroringProxy, (void*)ctx, DelegateProxies.DestroyProxyForMulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetScriptDelegate (ScriptDelegate del, ReleaseDelegate destroy = null)
|
public void SetScriptDelegate (ScriptDelegate del, ReleaseDelegate destroy = null)
|
||||||
|
@ -124,7 +124,7 @@ namespace HarfBuzzSharp
|
||||||
|
|
||||||
var ctx = DelegateProxies.CreateMultiUserData (del, destroy, this);
|
var ctx = DelegateProxies.CreateMultiUserData (del, destroy, this);
|
||||||
HarfBuzzApi.hb_unicode_funcs_set_script_func (
|
HarfBuzzApi.hb_unicode_funcs_set_script_func (
|
||||||
Handle, DelegateProxies.ScriptProxy, (void*)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
|
Handle, DelegateProxies.UnicodeScriptProxy, (void*)ctx, DelegateProxies.DestroyProxyForMulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetComposeDelegate (ComposeDelegate del, ReleaseDelegate destroy = null)
|
public void SetComposeDelegate (ComposeDelegate del, ReleaseDelegate destroy = null)
|
||||||
|
@ -133,7 +133,7 @@ namespace HarfBuzzSharp
|
||||||
|
|
||||||
var ctx = DelegateProxies.CreateMultiUserData (del, destroy, this);
|
var ctx = DelegateProxies.CreateMultiUserData (del, destroy, this);
|
||||||
HarfBuzzApi.hb_unicode_funcs_set_compose_func (
|
HarfBuzzApi.hb_unicode_funcs_set_compose_func (
|
||||||
Handle, DelegateProxies.ComposeProxy, (void*)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
|
Handle, DelegateProxies.UnicodeComposeProxy, (void*)ctx, DelegateProxies.DestroyProxyForMulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetDecomposeDelegate (DecomposeDelegate del, ReleaseDelegate destroy = null)
|
public void SetDecomposeDelegate (DecomposeDelegate del, ReleaseDelegate destroy = null)
|
||||||
|
@ -142,7 +142,7 @@ namespace HarfBuzzSharp
|
||||||
|
|
||||||
var ctx = DelegateProxies.CreateMultiUserData (del, destroy, this);
|
var ctx = DelegateProxies.CreateMultiUserData (del, destroy, this);
|
||||||
HarfBuzzApi.hb_unicode_funcs_set_decompose_func (
|
HarfBuzzApi.hb_unicode_funcs_set_decompose_func (
|
||||||
Handle, DelegateProxies.DecomposeProxy, (void*)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
|
Handle, DelegateProxies.UnicodeDecomposeProxy, (void*)ctx, DelegateProxies.DestroyProxyForMulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void VerifyParameters (Delegate del)
|
private void VerifyParameters (Delegate del)
|
||||||
|
|
|
@ -34,3 +34,7 @@ using System.Runtime.CompilerServices;
|
||||||
[assembly: Foundation.LinkerSafe]
|
[assembly: Foundation.LinkerSafe]
|
||||||
#pragma warning restore CS0618 // Type or member is obsolete
|
#pragma warning restore CS0618 // Type or member is obsolete
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if NET7_0_OR_GREATER
|
||||||
|
[assembly: DisableRuntimeMarshalling]
|
||||||
|
#endif
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
#region Namespaces
|
#region Namespaces
|
||||||
|
|
||||||
|
@ -17,6 +18,7 @@ using gr_recording_context_t = System.IntPtr;
|
||||||
using gr_vk_extensions_t = System.IntPtr;
|
using gr_vk_extensions_t = System.IntPtr;
|
||||||
using gr_vk_memory_allocator_t = System.IntPtr;
|
using gr_vk_memory_allocator_t = System.IntPtr;
|
||||||
using gr_vkinterface_t = System.IntPtr;
|
using gr_vkinterface_t = System.IntPtr;
|
||||||
|
using sk_bbh_factory_t = System.IntPtr;
|
||||||
using sk_bitmap_t = System.IntPtr;
|
using sk_bitmap_t = System.IntPtr;
|
||||||
using sk_blender_t = System.IntPtr;
|
using sk_blender_t = System.IntPtr;
|
||||||
using sk_canvas_t = System.IntPtr;
|
using sk_canvas_t = System.IntPtr;
|
||||||
|
@ -59,6 +61,7 @@ using sk_region_iterator_t = System.IntPtr;
|
||||||
using sk_region_spanerator_t = System.IntPtr;
|
using sk_region_spanerator_t = System.IntPtr;
|
||||||
using sk_region_t = System.IntPtr;
|
using sk_region_t = System.IntPtr;
|
||||||
using sk_rrect_t = System.IntPtr;
|
using sk_rrect_t = System.IntPtr;
|
||||||
|
using sk_rtree_factory_t = System.IntPtr;
|
||||||
using sk_runtimeeffect_t = System.IntPtr;
|
using sk_runtimeeffect_t = System.IntPtr;
|
||||||
using sk_shader_t = System.IntPtr;
|
using sk_shader_t = System.IntPtr;
|
||||||
using sk_stream_asset_t = System.IntPtr;
|
using sk_stream_asset_t = System.IntPtr;
|
||||||
|
@ -110,8 +113,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// skresources_resource_provider_t* skresources_caching_resource_provider_proxy_make(skresources_resource_provider_t* rp)
|
// skresources_resource_provider_t* skresources_caching_resource_provider_proxy_make(skresources_resource_provider_t* rp)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial skresources_resource_provider_t skresources_caching_resource_provider_proxy_make (skresources_resource_provider_t rp);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern skresources_resource_provider_t skresources_caching_resource_provider_proxy_make (skresources_resource_provider_t rp);
|
internal static extern skresources_resource_provider_t skresources_caching_resource_provider_proxy_make (skresources_resource_provider_t rp);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -124,8 +132,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// skresources_resource_provider_t* skresources_data_uri_resource_provider_proxy_make(skresources_resource_provider_t* rp, bool predecode)
|
// skresources_resource_provider_t* skresources_data_uri_resource_provider_proxy_make(skresources_resource_provider_t* rp, bool predecode)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial skresources_resource_provider_t skresources_data_uri_resource_provider_proxy_make (skresources_resource_provider_t rp, [MarshalAs (UnmanagedType.I1)] bool predecode);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern skresources_resource_provider_t skresources_data_uri_resource_provider_proxy_make (skresources_resource_provider_t rp, [MarshalAs (UnmanagedType.I1)] bool predecode);
|
internal static extern skresources_resource_provider_t skresources_data_uri_resource_provider_proxy_make (skresources_resource_provider_t rp, [MarshalAs (UnmanagedType.I1)] bool predecode);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -138,8 +151,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// skresources_resource_provider_t* skresources_file_resource_provider_make(sk_string_t* base_dir, bool predecode)
|
// skresources_resource_provider_t* skresources_file_resource_provider_make(sk_string_t* base_dir, bool predecode)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial skresources_resource_provider_t skresources_file_resource_provider_make (sk_string_t base_dir, [MarshalAs (UnmanagedType.I1)] bool predecode);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern skresources_resource_provider_t skresources_file_resource_provider_make (sk_string_t base_dir, [MarshalAs (UnmanagedType.I1)] bool predecode);
|
internal static extern skresources_resource_provider_t skresources_file_resource_provider_make (sk_string_t base_dir, [MarshalAs (UnmanagedType.I1)] bool predecode);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -152,8 +170,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// void skresources_resource_provider_delete(skresources_resource_provider_t* instance)
|
// void skresources_resource_provider_delete(skresources_resource_provider_t* instance)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial void skresources_resource_provider_delete (skresources_resource_provider_t instance);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern void skresources_resource_provider_delete (skresources_resource_provider_t instance);
|
internal static extern void skresources_resource_provider_delete (skresources_resource_provider_t instance);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -166,8 +189,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// sk_data_t* skresources_resource_provider_load(skresources_resource_provider_t* instance, const char* path, const char* name)
|
// sk_data_t* skresources_resource_provider_load(skresources_resource_provider_t* instance, const char* path, const char* name)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial sk_data_t skresources_resource_provider_load (skresources_resource_provider_t instance, [MarshalAs (UnmanagedType.LPStr)] String path, [MarshalAs (UnmanagedType.LPStr)] String name);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern sk_data_t skresources_resource_provider_load (skresources_resource_provider_t instance, [MarshalAs (UnmanagedType.LPStr)] String path, [MarshalAs (UnmanagedType.LPStr)] String name);
|
internal static extern sk_data_t skresources_resource_provider_load (skresources_resource_provider_t instance, [MarshalAs (UnmanagedType.LPStr)] String path, [MarshalAs (UnmanagedType.LPStr)] String name);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -180,8 +208,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// skresources_external_track_asset_t* skresources_resource_provider_load_audio_asset(skresources_resource_provider_t* instance, const char* path, const char* name, const char* id)
|
// skresources_external_track_asset_t* skresources_resource_provider_load_audio_asset(skresources_resource_provider_t* instance, const char* path, const char* name, const char* id)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial skresources_external_track_asset_t skresources_resource_provider_load_audio_asset (skresources_resource_provider_t instance, [MarshalAs (UnmanagedType.LPStr)] String path, [MarshalAs (UnmanagedType.LPStr)] String name, [MarshalAs (UnmanagedType.LPStr)] String id);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern skresources_external_track_asset_t skresources_resource_provider_load_audio_asset (skresources_resource_provider_t instance, [MarshalAs (UnmanagedType.LPStr)] String path, [MarshalAs (UnmanagedType.LPStr)] String name, [MarshalAs (UnmanagedType.LPStr)] String id);
|
internal static extern skresources_external_track_asset_t skresources_resource_provider_load_audio_asset (skresources_resource_provider_t instance, [MarshalAs (UnmanagedType.LPStr)] String path, [MarshalAs (UnmanagedType.LPStr)] String name, [MarshalAs (UnmanagedType.LPStr)] String id);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -194,8 +227,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// skresources_image_asset_t* skresources_resource_provider_load_image_asset(skresources_resource_provider_t* instance, const char* path, const char* name, const char* id)
|
// skresources_image_asset_t* skresources_resource_provider_load_image_asset(skresources_resource_provider_t* instance, const char* path, const char* name, const char* id)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial skresources_image_asset_t skresources_resource_provider_load_image_asset (skresources_resource_provider_t instance, [MarshalAs (UnmanagedType.LPStr)] String path, [MarshalAs (UnmanagedType.LPStr)] String name, [MarshalAs (UnmanagedType.LPStr)] String id);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern skresources_image_asset_t skresources_resource_provider_load_image_asset (skresources_resource_provider_t instance, [MarshalAs (UnmanagedType.LPStr)] String path, [MarshalAs (UnmanagedType.LPStr)] String name, [MarshalAs (UnmanagedType.LPStr)] String id);
|
internal static extern skresources_image_asset_t skresources_resource_provider_load_image_asset (skresources_resource_provider_t instance, [MarshalAs (UnmanagedType.LPStr)] String path, [MarshalAs (UnmanagedType.LPStr)] String name, [MarshalAs (UnmanagedType.LPStr)] String id);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -208,8 +246,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// sk_typeface_t* skresources_resource_provider_load_typeface(skresources_resource_provider_t* instance, const char* name, const char* url)
|
// sk_typeface_t* skresources_resource_provider_load_typeface(skresources_resource_provider_t* instance, const char* name, const char* url)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial sk_typeface_t skresources_resource_provider_load_typeface (skresources_resource_provider_t instance, [MarshalAs (UnmanagedType.LPStr)] String name, [MarshalAs (UnmanagedType.LPStr)] String url);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern sk_typeface_t skresources_resource_provider_load_typeface (skresources_resource_provider_t instance, [MarshalAs (UnmanagedType.LPStr)] String name, [MarshalAs (UnmanagedType.LPStr)] String url);
|
internal static extern sk_typeface_t skresources_resource_provider_load_typeface (skresources_resource_provider_t instance, [MarshalAs (UnmanagedType.LPStr)] String name, [MarshalAs (UnmanagedType.LPStr)] String url);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -222,8 +265,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// void skresources_resource_provider_ref(skresources_resource_provider_t* instance)
|
// void skresources_resource_provider_ref(skresources_resource_provider_t* instance)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial void skresources_resource_provider_ref (skresources_resource_provider_t instance);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern void skresources_resource_provider_ref (skresources_resource_provider_t instance);
|
internal static extern void skresources_resource_provider_ref (skresources_resource_provider_t instance);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -236,8 +284,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// void skresources_resource_provider_unref(skresources_resource_provider_t* instance)
|
// void skresources_resource_provider_unref(skresources_resource_provider_t* instance)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial void skresources_resource_provider_unref (skresources_resource_provider_t instance);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern void skresources_resource_provider_unref (skresources_resource_provider_t instance);
|
internal static extern void skresources_resource_provider_unref (skresources_resource_provider_t instance);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -256,7 +309,9 @@ namespace SkiaSharp
|
||||||
#endregion Functions
|
#endregion Functions
|
||||||
|
|
||||||
#region Delegates
|
#region Delegates
|
||||||
|
#if !USE_LIBRARY_IMPORT
|
||||||
|
|
||||||
|
#endif // !USE_LIBRARY_IMPORT
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Structs
|
#region Structs
|
||||||
|
@ -266,3 +321,7 @@ namespace SkiaSharp
|
||||||
#region Enums
|
#region Enums
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region DelegateProxies
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
|
@ -8,10 +8,14 @@
|
||||||
<PackageDescription>SkiaSharp Skottie provides a Lottie implementation using the SkiaSharp library.</PackageDescription>
|
<PackageDescription>SkiaSharp Skottie provides a Lottie implementation using the SkiaSharp library.</PackageDescription>
|
||||||
<PackageTags>skottie;lottie</PackageTags>
|
<PackageTags>skottie;lottie</PackageTags>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<WarningsAsErrors>$(WarningsAsErrors);CA1420;CA1421;</WarningsAsErrors>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))">
|
<PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))">
|
||||||
<DefineConstants>$(DefineConstants);USE_DELEGATES</DefineConstants>
|
<DefineConstants>$(DefineConstants);USE_DELEGATES</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">
|
||||||
|
<DefineConstants>$(DefineConstants);USE_LIBRARY_IMPORT</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\SkiaSharp\SkiaSharp.csproj" />
|
<ProjectReference Include="..\SkiaSharp\SkiaSharp.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -33,3 +33,7 @@ using System.Runtime.CompilerServices;
|
||||||
[assembly: Foundation.LinkerSafe]
|
[assembly: Foundation.LinkerSafe]
|
||||||
#pragma warning restore CS0618 // Type or member is obsolete
|
#pragma warning restore CS0618 // Type or member is obsolete
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if NET7_0_OR_GREATER
|
||||||
|
[assembly: DisableRuntimeMarshalling]
|
||||||
|
#endif
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
#region Namespaces
|
#region Namespaces
|
||||||
|
|
||||||
|
@ -17,6 +18,7 @@ using gr_recording_context_t = System.IntPtr;
|
||||||
using gr_vk_extensions_t = System.IntPtr;
|
using gr_vk_extensions_t = System.IntPtr;
|
||||||
using gr_vk_memory_allocator_t = System.IntPtr;
|
using gr_vk_memory_allocator_t = System.IntPtr;
|
||||||
using gr_vkinterface_t = System.IntPtr;
|
using gr_vkinterface_t = System.IntPtr;
|
||||||
|
using sk_bbh_factory_t = System.IntPtr;
|
||||||
using sk_bitmap_t = System.IntPtr;
|
using sk_bitmap_t = System.IntPtr;
|
||||||
using sk_blender_t = System.IntPtr;
|
using sk_blender_t = System.IntPtr;
|
||||||
using sk_canvas_t = System.IntPtr;
|
using sk_canvas_t = System.IntPtr;
|
||||||
|
@ -59,6 +61,7 @@ using sk_region_iterator_t = System.IntPtr;
|
||||||
using sk_region_spanerator_t = System.IntPtr;
|
using sk_region_spanerator_t = System.IntPtr;
|
||||||
using sk_region_t = System.IntPtr;
|
using sk_region_t = System.IntPtr;
|
||||||
using sk_rrect_t = System.IntPtr;
|
using sk_rrect_t = System.IntPtr;
|
||||||
|
using sk_rtree_factory_t = System.IntPtr;
|
||||||
using sk_runtimeeffect_t = System.IntPtr;
|
using sk_runtimeeffect_t = System.IntPtr;
|
||||||
using sk_shader_t = System.IntPtr;
|
using sk_shader_t = System.IntPtr;
|
||||||
using sk_stream_asset_t = System.IntPtr;
|
using sk_stream_asset_t = System.IntPtr;
|
||||||
|
@ -110,8 +113,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// void sksg_invalidation_controller_begin(sksg_invalidation_controller_t* instance)
|
// void sksg_invalidation_controller_begin(sksg_invalidation_controller_t* instance)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial void sksg_invalidation_controller_begin (sksg_invalidation_controller_t instance);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern void sksg_invalidation_controller_begin (sksg_invalidation_controller_t instance);
|
internal static extern void sksg_invalidation_controller_begin (sksg_invalidation_controller_t instance);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -124,8 +132,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// void sksg_invalidation_controller_delete(sksg_invalidation_controller_t* instance)
|
// void sksg_invalidation_controller_delete(sksg_invalidation_controller_t* instance)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial void sksg_invalidation_controller_delete (sksg_invalidation_controller_t instance);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern void sksg_invalidation_controller_delete (sksg_invalidation_controller_t instance);
|
internal static extern void sksg_invalidation_controller_delete (sksg_invalidation_controller_t instance);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -138,8 +151,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// void sksg_invalidation_controller_end(sksg_invalidation_controller_t* instance)
|
// void sksg_invalidation_controller_end(sksg_invalidation_controller_t* instance)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial void sksg_invalidation_controller_end (sksg_invalidation_controller_t instance);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern void sksg_invalidation_controller_end (sksg_invalidation_controller_t instance);
|
internal static extern void sksg_invalidation_controller_end (sksg_invalidation_controller_t instance);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -152,8 +170,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// void sksg_invalidation_controller_get_bounds(sksg_invalidation_controller_t* instance, sk_rect_t* bounds)
|
// void sksg_invalidation_controller_get_bounds(sksg_invalidation_controller_t* instance, sk_rect_t* bounds)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial void sksg_invalidation_controller_get_bounds (sksg_invalidation_controller_t instance, SKRect* bounds);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern void sksg_invalidation_controller_get_bounds (sksg_invalidation_controller_t instance, SKRect* bounds);
|
internal static extern void sksg_invalidation_controller_get_bounds (sksg_invalidation_controller_t instance, SKRect* bounds);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -166,8 +189,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// void sksg_invalidation_controller_inval(sksg_invalidation_controller_t* instance, sk_rect_t* rect, sk_matrix_t* matrix)
|
// void sksg_invalidation_controller_inval(sksg_invalidation_controller_t* instance, sk_rect_t* rect, sk_matrix_t* matrix)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial void sksg_invalidation_controller_inval (sksg_invalidation_controller_t instance, SKRect* rect, SKMatrix* matrix);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern void sksg_invalidation_controller_inval (sksg_invalidation_controller_t instance, SKRect* rect, SKMatrix* matrix);
|
internal static extern void sksg_invalidation_controller_inval (sksg_invalidation_controller_t instance, SKRect* rect, SKMatrix* matrix);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -180,8 +208,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// sksg_invalidation_controller_t* sksg_invalidation_controller_new()
|
// sksg_invalidation_controller_t* sksg_invalidation_controller_new()
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial sksg_invalidation_controller_t sksg_invalidation_controller_new ();
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern sksg_invalidation_controller_t sksg_invalidation_controller_new ();
|
internal static extern sksg_invalidation_controller_t sksg_invalidation_controller_new ();
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -194,8 +227,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// void sksg_invalidation_controller_reset(sksg_invalidation_controller_t* instance)
|
// void sksg_invalidation_controller_reset(sksg_invalidation_controller_t* instance)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial void sksg_invalidation_controller_reset (sksg_invalidation_controller_t instance);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern void sksg_invalidation_controller_reset (sksg_invalidation_controller_t instance);
|
internal static extern void sksg_invalidation_controller_reset (sksg_invalidation_controller_t instance);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -214,7 +252,9 @@ namespace SkiaSharp
|
||||||
#endregion Functions
|
#endregion Functions
|
||||||
|
|
||||||
#region Delegates
|
#region Delegates
|
||||||
|
#if !USE_LIBRARY_IMPORT
|
||||||
|
|
||||||
|
#endif // !USE_LIBRARY_IMPORT
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Structs
|
#region Structs
|
||||||
|
@ -224,3 +264,7 @@ namespace SkiaSharp
|
||||||
#region Enums
|
#region Enums
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region DelegateProxies
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
|
@ -8,10 +8,14 @@
|
||||||
<PackageDescription>SkiaSharp Skottie provides a Lottie implementation using the SkiaSharp library.</PackageDescription>
|
<PackageDescription>SkiaSharp Skottie provides a Lottie implementation using the SkiaSharp library.</PackageDescription>
|
||||||
<PackageTags>skottie;lottie</PackageTags>
|
<PackageTags>skottie;lottie</PackageTags>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<WarningsAsErrors>$(WarningsAsErrors);CA1420;CA1421;</WarningsAsErrors>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))">
|
<PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))">
|
||||||
<DefineConstants>$(DefineConstants);USE_DELEGATES</DefineConstants>
|
<DefineConstants>$(DefineConstants);USE_DELEGATES</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">
|
||||||
|
<DefineConstants>$(DefineConstants);USE_LIBRARY_IMPORT</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\SkiaSharp\SkiaSharp.csproj" />
|
<ProjectReference Include="..\SkiaSharp\SkiaSharp.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -34,3 +34,7 @@ using System.Runtime.CompilerServices;
|
||||||
[assembly: Foundation.LinkerSafe]
|
[assembly: Foundation.LinkerSafe]
|
||||||
#pragma warning restore CS0618 // Type or member is obsolete
|
#pragma warning restore CS0618 // Type or member is obsolete
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if NET7_0_OR_GREATER
|
||||||
|
[assembly: DisableRuntimeMarshalling]
|
||||||
|
#endif
|
||||||
|
|
|
@ -8,10 +8,14 @@
|
||||||
<PackageDescription>SkiaSharp Skottie provides a Lottie implementation using the SkiaSharp library.</PackageDescription>
|
<PackageDescription>SkiaSharp Skottie provides a Lottie implementation using the SkiaSharp library.</PackageDescription>
|
||||||
<PackageTags>skottie;lottie</PackageTags>
|
<PackageTags>skottie;lottie</PackageTags>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<WarningsAsErrors>$(WarningsAsErrors);CA1420;CA1421;</WarningsAsErrors>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))">
|
<PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))">
|
||||||
<DefineConstants>$(DefineConstants);USE_DELEGATES</DefineConstants>
|
<DefineConstants>$(DefineConstants);USE_DELEGATES</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">
|
||||||
|
<DefineConstants>$(DefineConstants);USE_LIBRARY_IMPORT</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\SkiaSharp\SkiaSharp.csproj" />
|
<ProjectReference Include="..\SkiaSharp\SkiaSharp.csproj" />
|
||||||
<ProjectReference Include="..\SkiaSharp.SceneGraph\SkiaSharp.SceneGraph.csproj" />
|
<ProjectReference Include="..\SkiaSharp.SceneGraph\SkiaSharp.SceneGraph.csproj" />
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
#region Namespaces
|
#region Namespaces
|
||||||
|
|
||||||
|
@ -17,6 +18,7 @@ using gr_recording_context_t = System.IntPtr;
|
||||||
using gr_vk_extensions_t = System.IntPtr;
|
using gr_vk_extensions_t = System.IntPtr;
|
||||||
using gr_vk_memory_allocator_t = System.IntPtr;
|
using gr_vk_memory_allocator_t = System.IntPtr;
|
||||||
using gr_vkinterface_t = System.IntPtr;
|
using gr_vkinterface_t = System.IntPtr;
|
||||||
|
using sk_bbh_factory_t = System.IntPtr;
|
||||||
using sk_bitmap_t = System.IntPtr;
|
using sk_bitmap_t = System.IntPtr;
|
||||||
using sk_blender_t = System.IntPtr;
|
using sk_blender_t = System.IntPtr;
|
||||||
using sk_canvas_t = System.IntPtr;
|
using sk_canvas_t = System.IntPtr;
|
||||||
|
@ -59,6 +61,7 @@ using sk_region_iterator_t = System.IntPtr;
|
||||||
using sk_region_spanerator_t = System.IntPtr;
|
using sk_region_spanerator_t = System.IntPtr;
|
||||||
using sk_region_t = System.IntPtr;
|
using sk_region_t = System.IntPtr;
|
||||||
using sk_rrect_t = System.IntPtr;
|
using sk_rrect_t = System.IntPtr;
|
||||||
|
using sk_rtree_factory_t = System.IntPtr;
|
||||||
using sk_runtimeeffect_t = System.IntPtr;
|
using sk_runtimeeffect_t = System.IntPtr;
|
||||||
using sk_shader_t = System.IntPtr;
|
using sk_shader_t = System.IntPtr;
|
||||||
using sk_stream_asset_t = System.IntPtr;
|
using sk_stream_asset_t = System.IntPtr;
|
||||||
|
@ -110,8 +113,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// void skottie_animation_builder_delete(skottie_animation_builder_t* instance)
|
// void skottie_animation_builder_delete(skottie_animation_builder_t* instance)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial void skottie_animation_builder_delete (skottie_animation_builder_t instance);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern void skottie_animation_builder_delete (skottie_animation_builder_t instance);
|
internal static extern void skottie_animation_builder_delete (skottie_animation_builder_t instance);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -124,8 +132,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// void skottie_animation_builder_get_stats(skottie_animation_builder_t* instance, skottie_animation_builder_stats_t* stats)
|
// void skottie_animation_builder_get_stats(skottie_animation_builder_t* instance, skottie_animation_builder_stats_t* stats)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial void skottie_animation_builder_get_stats (skottie_animation_builder_t instance, AnimationBuilderStats* stats);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern void skottie_animation_builder_get_stats (skottie_animation_builder_t instance, AnimationBuilderStats* stats);
|
internal static extern void skottie_animation_builder_get_stats (skottie_animation_builder_t instance, AnimationBuilderStats* stats);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -138,8 +151,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// skottie_animation_t* skottie_animation_builder_make_from_data(skottie_animation_builder_t* instance, const char* data, size_t length)
|
// skottie_animation_t* skottie_animation_builder_make_from_data(skottie_animation_builder_t* instance, const char* data, size_t length)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial skottie_animation_t skottie_animation_builder_make_from_data (skottie_animation_builder_t instance, /* char */ void* data, /* size_t */ IntPtr length);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern skottie_animation_t skottie_animation_builder_make_from_data (skottie_animation_builder_t instance, /* char */ void* data, /* size_t */ IntPtr length);
|
internal static extern skottie_animation_t skottie_animation_builder_make_from_data (skottie_animation_builder_t instance, /* char */ void* data, /* size_t */ IntPtr length);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -152,8 +170,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// skottie_animation_t* skottie_animation_builder_make_from_file(skottie_animation_builder_t* instance, const char* path)
|
// skottie_animation_t* skottie_animation_builder_make_from_file(skottie_animation_builder_t* instance, const char* path)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial skottie_animation_t skottie_animation_builder_make_from_file (skottie_animation_builder_t instance, /* char */ void* path);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern skottie_animation_t skottie_animation_builder_make_from_file (skottie_animation_builder_t instance, /* char */ void* path);
|
internal static extern skottie_animation_t skottie_animation_builder_make_from_file (skottie_animation_builder_t instance, /* char */ void* path);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -166,8 +189,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// skottie_animation_t* skottie_animation_builder_make_from_stream(skottie_animation_builder_t* instance, sk_stream_t* stream)
|
// skottie_animation_t* skottie_animation_builder_make_from_stream(skottie_animation_builder_t* instance, sk_stream_t* stream)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial skottie_animation_t skottie_animation_builder_make_from_stream (skottie_animation_builder_t instance, sk_stream_t stream);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern skottie_animation_t skottie_animation_builder_make_from_stream (skottie_animation_builder_t instance, sk_stream_t stream);
|
internal static extern skottie_animation_t skottie_animation_builder_make_from_stream (skottie_animation_builder_t instance, sk_stream_t stream);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -180,8 +208,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// skottie_animation_t* skottie_animation_builder_make_from_string(skottie_animation_builder_t* instance, const char* data, size_t length)
|
// skottie_animation_t* skottie_animation_builder_make_from_string(skottie_animation_builder_t* instance, const char* data, size_t length)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial skottie_animation_t skottie_animation_builder_make_from_string (skottie_animation_builder_t instance, /* char */ void* data, /* size_t */ IntPtr length);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern skottie_animation_t skottie_animation_builder_make_from_string (skottie_animation_builder_t instance, /* char */ void* data, /* size_t */ IntPtr length);
|
internal static extern skottie_animation_t skottie_animation_builder_make_from_string (skottie_animation_builder_t instance, /* char */ void* data, /* size_t */ IntPtr length);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -194,8 +227,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// skottie_animation_builder_t* skottie_animation_builder_new(skottie_animation_builder_flags_t flags)
|
// skottie_animation_builder_t* skottie_animation_builder_new(skottie_animation_builder_flags_t flags)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial skottie_animation_builder_t skottie_animation_builder_new (AnimationBuilderFlags flags);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern skottie_animation_builder_t skottie_animation_builder_new (AnimationBuilderFlags flags);
|
internal static extern skottie_animation_builder_t skottie_animation_builder_new (AnimationBuilderFlags flags);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -208,8 +246,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// void skottie_animation_builder_set_font_manager(skottie_animation_builder_t* instance, sk_fontmgr_t* fontManager)
|
// void skottie_animation_builder_set_font_manager(skottie_animation_builder_t* instance, sk_fontmgr_t* fontManager)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial void skottie_animation_builder_set_font_manager (skottie_animation_builder_t instance, sk_fontmgr_t fontManager);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern void skottie_animation_builder_set_font_manager (skottie_animation_builder_t instance, sk_fontmgr_t fontManager);
|
internal static extern void skottie_animation_builder_set_font_manager (skottie_animation_builder_t instance, sk_fontmgr_t fontManager);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -222,8 +265,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// void skottie_animation_builder_set_resource_provider(skottie_animation_builder_t* instance, skottie_resource_provider_t* resourceProvider)
|
// void skottie_animation_builder_set_resource_provider(skottie_animation_builder_t* instance, skottie_resource_provider_t* resourceProvider)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial void skottie_animation_builder_set_resource_provider (skottie_animation_builder_t instance, skottie_resource_provider_t resourceProvider);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern void skottie_animation_builder_set_resource_provider (skottie_animation_builder_t instance, skottie_resource_provider_t resourceProvider);
|
internal static extern void skottie_animation_builder_set_resource_provider (skottie_animation_builder_t instance, skottie_resource_provider_t resourceProvider);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -236,8 +284,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// void skottie_animation_delete(skottie_animation_t* instance)
|
// void skottie_animation_delete(skottie_animation_t* instance)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial void skottie_animation_delete (skottie_animation_t instance);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern void skottie_animation_delete (skottie_animation_t instance);
|
internal static extern void skottie_animation_delete (skottie_animation_t instance);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -250,8 +303,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// double skottie_animation_get_duration(skottie_animation_t* instance)
|
// double skottie_animation_get_duration(skottie_animation_t* instance)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial Double skottie_animation_get_duration (skottie_animation_t instance);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern Double skottie_animation_get_duration (skottie_animation_t instance);
|
internal static extern Double skottie_animation_get_duration (skottie_animation_t instance);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -264,8 +322,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// double skottie_animation_get_fps(skottie_animation_t* instance)
|
// double skottie_animation_get_fps(skottie_animation_t* instance)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial Double skottie_animation_get_fps (skottie_animation_t instance);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern Double skottie_animation_get_fps (skottie_animation_t instance);
|
internal static extern Double skottie_animation_get_fps (skottie_animation_t instance);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -278,8 +341,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// double skottie_animation_get_in_point(skottie_animation_t* instance)
|
// double skottie_animation_get_in_point(skottie_animation_t* instance)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial Double skottie_animation_get_in_point (skottie_animation_t instance);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern Double skottie_animation_get_in_point (skottie_animation_t instance);
|
internal static extern Double skottie_animation_get_in_point (skottie_animation_t instance);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -292,8 +360,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// double skottie_animation_get_out_point(skottie_animation_t* instance)
|
// double skottie_animation_get_out_point(skottie_animation_t* instance)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial Double skottie_animation_get_out_point (skottie_animation_t instance);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern Double skottie_animation_get_out_point (skottie_animation_t instance);
|
internal static extern Double skottie_animation_get_out_point (skottie_animation_t instance);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -306,8 +379,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// void skottie_animation_get_size(skottie_animation_t* instance, sk_size_t* size)
|
// void skottie_animation_get_size(skottie_animation_t* instance, sk_size_t* size)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial void skottie_animation_get_size (skottie_animation_t instance, SKSize* size);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern void skottie_animation_get_size (skottie_animation_t instance, SKSize* size);
|
internal static extern void skottie_animation_get_size (skottie_animation_t instance, SKSize* size);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -320,8 +398,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// void skottie_animation_get_version(skottie_animation_t* instance, sk_string_t* version)
|
// void skottie_animation_get_version(skottie_animation_t* instance, sk_string_t* version)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial void skottie_animation_get_version (skottie_animation_t instance, sk_string_t version);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern void skottie_animation_get_version (skottie_animation_t instance, sk_string_t version);
|
internal static extern void skottie_animation_get_version (skottie_animation_t instance, sk_string_t version);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -334,8 +417,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// skottie_animation_t* skottie_animation_make_from_data(const char* data, size_t length)
|
// skottie_animation_t* skottie_animation_make_from_data(const char* data, size_t length)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial skottie_animation_t skottie_animation_make_from_data (/* char */ void* data, /* size_t */ IntPtr length);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern skottie_animation_t skottie_animation_make_from_data (/* char */ void* data, /* size_t */ IntPtr length);
|
internal static extern skottie_animation_t skottie_animation_make_from_data (/* char */ void* data, /* size_t */ IntPtr length);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -348,8 +436,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// skottie_animation_t* skottie_animation_make_from_file(const char* path)
|
// skottie_animation_t* skottie_animation_make_from_file(const char* path)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial skottie_animation_t skottie_animation_make_from_file ([MarshalAs (UnmanagedType.LPStr)] String path);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern skottie_animation_t skottie_animation_make_from_file ([MarshalAs (UnmanagedType.LPStr)] String path);
|
internal static extern skottie_animation_t skottie_animation_make_from_file ([MarshalAs (UnmanagedType.LPStr)] String path);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -362,8 +455,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// skottie_animation_t* skottie_animation_make_from_stream(sk_stream_t* stream)
|
// skottie_animation_t* skottie_animation_make_from_stream(sk_stream_t* stream)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial skottie_animation_t skottie_animation_make_from_stream (sk_stream_t stream);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern skottie_animation_t skottie_animation_make_from_stream (sk_stream_t stream);
|
internal static extern skottie_animation_t skottie_animation_make_from_stream (sk_stream_t stream);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -376,8 +474,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// skottie_animation_t* skottie_animation_make_from_string(const char* data, size_t length)
|
// skottie_animation_t* skottie_animation_make_from_string(const char* data, size_t length)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial skottie_animation_t skottie_animation_make_from_string ([MarshalAs (UnmanagedType.LPStr)] String data, int length);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern skottie_animation_t skottie_animation_make_from_string ([MarshalAs (UnmanagedType.LPStr)] String data, int length);
|
internal static extern skottie_animation_t skottie_animation_make_from_string ([MarshalAs (UnmanagedType.LPStr)] String data, int length);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -390,8 +493,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// void skottie_animation_ref(skottie_animation_t* instance)
|
// void skottie_animation_ref(skottie_animation_t* instance)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial void skottie_animation_ref (skottie_animation_t instance);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern void skottie_animation_ref (skottie_animation_t instance);
|
internal static extern void skottie_animation_ref (skottie_animation_t instance);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -404,8 +512,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// void skottie_animation_render(skottie_animation_t* instance, sk_canvas_t* canvas, sk_rect_t* dst)
|
// void skottie_animation_render(skottie_animation_t* instance, sk_canvas_t* canvas, sk_rect_t* dst)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial void skottie_animation_render (skottie_animation_t instance, sk_canvas_t canvas, SKRect* dst);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern void skottie_animation_render (skottie_animation_t instance, sk_canvas_t canvas, SKRect* dst);
|
internal static extern void skottie_animation_render (skottie_animation_t instance, sk_canvas_t canvas, SKRect* dst);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -418,8 +531,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// void skottie_animation_render_with_flags(skottie_animation_t* instance, sk_canvas_t* canvas, sk_rect_t* dst, skottie_animation_renderflags_t flags)
|
// void skottie_animation_render_with_flags(skottie_animation_t* instance, sk_canvas_t* canvas, sk_rect_t* dst, skottie_animation_renderflags_t flags)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial void skottie_animation_render_with_flags (skottie_animation_t instance, sk_canvas_t canvas, SKRect* dst, AnimationRenderFlags flags);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern void skottie_animation_render_with_flags (skottie_animation_t instance, sk_canvas_t canvas, SKRect* dst, AnimationRenderFlags flags);
|
internal static extern void skottie_animation_render_with_flags (skottie_animation_t instance, sk_canvas_t canvas, SKRect* dst, AnimationRenderFlags flags);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -432,8 +550,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// void skottie_animation_seek(skottie_animation_t* instance, float t, sksg_invalidation_controller_t* ic)
|
// void skottie_animation_seek(skottie_animation_t* instance, float t, sksg_invalidation_controller_t* ic)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial void skottie_animation_seek (skottie_animation_t instance, Single t, sksg_invalidation_controller_t ic);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern void skottie_animation_seek (skottie_animation_t instance, Single t, sksg_invalidation_controller_t ic);
|
internal static extern void skottie_animation_seek (skottie_animation_t instance, Single t, sksg_invalidation_controller_t ic);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -446,8 +569,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// void skottie_animation_seek_frame(skottie_animation_t* instance, float t, sksg_invalidation_controller_t* ic)
|
// void skottie_animation_seek_frame(skottie_animation_t* instance, float t, sksg_invalidation_controller_t* ic)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial void skottie_animation_seek_frame (skottie_animation_t instance, Single t, sksg_invalidation_controller_t ic);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern void skottie_animation_seek_frame (skottie_animation_t instance, Single t, sksg_invalidation_controller_t ic);
|
internal static extern void skottie_animation_seek_frame (skottie_animation_t instance, Single t, sksg_invalidation_controller_t ic);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -460,8 +588,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// void skottie_animation_seek_frame_time(skottie_animation_t* instance, float t, sksg_invalidation_controller_t* ic)
|
// void skottie_animation_seek_frame_time(skottie_animation_t* instance, float t, sksg_invalidation_controller_t* ic)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial void skottie_animation_seek_frame_time (skottie_animation_t instance, Single t, sksg_invalidation_controller_t ic);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern void skottie_animation_seek_frame_time (skottie_animation_t instance, Single t, sksg_invalidation_controller_t ic);
|
internal static extern void skottie_animation_seek_frame_time (skottie_animation_t instance, Single t, sksg_invalidation_controller_t ic);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -474,8 +607,13 @@ namespace SkiaSharp
|
||||||
|
|
||||||
// void skottie_animation_unref(skottie_animation_t* instance)
|
// void skottie_animation_unref(skottie_animation_t* instance)
|
||||||
#if !USE_DELEGATES
|
#if !USE_DELEGATES
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport (SKIA)]
|
||||||
|
internal static partial void skottie_animation_unref (skottie_animation_t instance);
|
||||||
|
#else // !USE_LIBRARY_IMPORT
|
||||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern void skottie_animation_unref (skottie_animation_t instance);
|
internal static extern void skottie_animation_unref (skottie_animation_t instance);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
private partial class Delegates {
|
private partial class Delegates {
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
||||||
|
@ -494,7 +632,9 @@ namespace SkiaSharp
|
||||||
#endregion Functions
|
#endregion Functions
|
||||||
|
|
||||||
#region Delegates
|
#region Delegates
|
||||||
|
#if !USE_LIBRARY_IMPORT
|
||||||
|
|
||||||
|
#endif // !USE_LIBRARY_IMPORT
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Structs
|
#region Structs
|
||||||
|
@ -520,7 +660,9 @@ namespace SkiaSharp.Skottie {
|
||||||
private readonly /* size_t */ IntPtr fAnimatorCount;
|
private readonly /* size_t */ IntPtr fAnimatorCount;
|
||||||
|
|
||||||
public readonly bool Equals (AnimationBuilderStats obj) =>
|
public readonly bool Equals (AnimationBuilderStats obj) =>
|
||||||
|
#pragma warning disable CS8909
|
||||||
fTotalLoadTimeMS == obj.fTotalLoadTimeMS && fJsonParseTimeMS == obj.fJsonParseTimeMS && fSceneParseTimeMS == obj.fSceneParseTimeMS && fJsonSize == obj.fJsonSize && fAnimatorCount == obj.fAnimatorCount;
|
fTotalLoadTimeMS == obj.fTotalLoadTimeMS && fJsonParseTimeMS == obj.fJsonParseTimeMS && fSceneParseTimeMS == obj.fSceneParseTimeMS && fJsonSize == obj.fJsonSize && fAnimatorCount == obj.fAnimatorCount;
|
||||||
|
#pragma warning restore CS8909
|
||||||
|
|
||||||
public readonly override bool Equals (object obj) =>
|
public readonly override bool Equals (object obj) =>
|
||||||
obj is AnimationBuilderStats f && Equals (f);
|
obj is AnimationBuilderStats f && Equals (f);
|
||||||
|
@ -572,3 +714,7 @@ namespace SkiaSharp.Skottie {
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region DelegateProxies
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
// ReSharper disable InconsistentNaming
|
||||||
|
// ReSharper disable PartialMethodParameterNameMismatch
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace SkiaSharp
|
namespace SkiaSharp
|
||||||
|
@ -24,23 +27,11 @@ namespace SkiaSharp
|
||||||
|
|
||||||
public delegate void SKGlyphPathDelegate (SKPath path, SKMatrix matrix);
|
public delegate void SKGlyphPathDelegate (SKPath path, SKMatrix matrix);
|
||||||
|
|
||||||
internal unsafe static partial class DelegateProxies
|
internal static unsafe partial class DelegateProxies
|
||||||
{
|
{
|
||||||
// references to the proxy implementations
|
|
||||||
public static readonly SKBitmapReleaseProxyDelegate SKBitmapReleaseDelegateProxy = SKBitmapReleaseDelegateProxyImplementation;
|
|
||||||
public static readonly SKDataReleaseProxyDelegate SKDataReleaseDelegateProxy = SKDataReleaseDelegateProxyImplementation;
|
|
||||||
public static readonly SKImageRasterReleaseProxyDelegate SKImageRasterReleaseDelegateProxy = SKImageRasterReleaseDelegateProxyImplementation;
|
|
||||||
public static readonly SKImageRasterReleaseProxyDelegate SKImageRasterReleaseDelegateProxyForCoTaskMem = SKImageRasterReleaseDelegateProxyImplementationForCoTaskMem;
|
|
||||||
public static readonly SKImageTextureReleaseProxyDelegate SKImageTextureReleaseDelegateProxy = SKImageTextureReleaseDelegateProxyImplementation;
|
|
||||||
public static readonly SKSurfaceRasterReleaseProxyDelegate SKSurfaceReleaseDelegateProxy = SKSurfaceReleaseDelegateProxyImplementation;
|
|
||||||
public static readonly GRGlGetProcProxyDelegate GRGlGetProcDelegateProxy = GRGlGetProcDelegateProxyImplementation;
|
|
||||||
public static readonly GRVkGetProcProxyDelegate GRVkGetProcDelegateProxy = GRVkGetProcDelegateProxyImplementation;
|
|
||||||
public static readonly SKGlyphPathProxyDelegate SKGlyphPathDelegateProxy = SKGlyphPathDelegateProxyImplementation;
|
|
||||||
|
|
||||||
// internal proxy implementations
|
// internal proxy implementations
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKBitmapReleaseProxyDelegate))]
|
private static partial void SKBitmapReleaseProxyImplementation (void* address, void* context)
|
||||||
private static void SKBitmapReleaseDelegateProxyImplementation (void* address, void* context)
|
|
||||||
{
|
{
|
||||||
var del = Get<SKBitmapReleaseDelegate> ((IntPtr)context, out var gch);
|
var del = Get<SKBitmapReleaseDelegate> ((IntPtr)context, out var gch);
|
||||||
try {
|
try {
|
||||||
|
@ -50,8 +41,7 @@ namespace SkiaSharp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKDataReleaseProxyDelegate))]
|
private static partial void SKDataReleaseProxyImplementation (void* address, void* context)
|
||||||
private static void SKDataReleaseDelegateProxyImplementation (void* address, void* context)
|
|
||||||
{
|
{
|
||||||
var del = Get<SKDataReleaseDelegate> ((IntPtr)context, out var gch);
|
var del = Get<SKDataReleaseDelegate> ((IntPtr)context, out var gch);
|
||||||
try {
|
try {
|
||||||
|
@ -61,14 +51,7 @@ namespace SkiaSharp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKImageRasterReleaseProxyDelegate))]
|
private static partial void SKImageRasterReleaseProxyImplementation (void* pixels, void* context)
|
||||||
private static void SKImageRasterReleaseDelegateProxyImplementationForCoTaskMem (void* pixels, void* context)
|
|
||||||
{
|
|
||||||
Marshal.FreeCoTaskMem ((IntPtr)pixels);
|
|
||||||
}
|
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKImageRasterReleaseProxyDelegate))]
|
|
||||||
private static void SKImageRasterReleaseDelegateProxyImplementation (void* pixels, void* context)
|
|
||||||
{
|
{
|
||||||
var del = Get<SKImageRasterReleaseDelegate> ((IntPtr)context, out var gch);
|
var del = Get<SKImageRasterReleaseDelegate> ((IntPtr)context, out var gch);
|
||||||
try {
|
try {
|
||||||
|
@ -78,8 +61,7 @@ namespace SkiaSharp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKImageTextureReleaseProxyDelegate))]
|
private static partial void SKImageTextureReleaseProxyImplementation (void* context)
|
||||||
private static void SKImageTextureReleaseDelegateProxyImplementation (void* context)
|
|
||||||
{
|
{
|
||||||
var del = Get<SKImageTextureReleaseDelegate> ((IntPtr)context, out var gch);
|
var del = Get<SKImageTextureReleaseDelegate> ((IntPtr)context, out var gch);
|
||||||
try {
|
try {
|
||||||
|
@ -89,8 +71,7 @@ namespace SkiaSharp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKSurfaceRasterReleaseProxyDelegate))]
|
private static partial void SKSurfaceRasterReleaseProxyImplementation (void* address, void* context)
|
||||||
private static void SKSurfaceReleaseDelegateProxyImplementation (void* address, void* context)
|
|
||||||
{
|
{
|
||||||
var del = Get<SKSurfaceReleaseDelegate> ((IntPtr)context, out var gch);
|
var del = Get<SKSurfaceReleaseDelegate> ((IntPtr)context, out var gch);
|
||||||
try {
|
try {
|
||||||
|
@ -100,23 +81,25 @@ namespace SkiaSharp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (GRGlGetProcProxyDelegate))]
|
private static partial void SKImageRasterReleaseProxyImplementationForCoTaskMem (void* pixels, void* context)
|
||||||
private static IntPtr GRGlGetProcDelegateProxyImplementation (void* context, void* name)
|
{
|
||||||
|
Marshal.FreeCoTaskMem ((IntPtr)pixels);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static partial IntPtr GRGlGetProcProxyImplementation (void* context, void* name)
|
||||||
{
|
{
|
||||||
var del = Get<GRGlGetProcedureAddressDelegate> ((IntPtr)context, out _);
|
var del = Get<GRGlGetProcedureAddressDelegate> ((IntPtr)context, out _);
|
||||||
return del.Invoke (Marshal.PtrToStringAnsi ((IntPtr)name));
|
return del.Invoke (Marshal.PtrToStringAnsi ((IntPtr)name));
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (GRVkGetProcProxyDelegate))]
|
private static partial IntPtr GRVkGetProcProxyImplementation (void* context, void* name, IntPtr instance, IntPtr device)
|
||||||
private static IntPtr GRVkGetProcDelegateProxyImplementation (void* context, void* name, IntPtr instance, IntPtr device)
|
|
||||||
{
|
{
|
||||||
var del = Get<GRVkGetProcedureAddressDelegate> ((IntPtr)context, out _);
|
var del = Get<GRVkGetProcedureAddressDelegate> ((IntPtr)context, out _);
|
||||||
|
|
||||||
return del.Invoke (Marshal.PtrToStringAnsi ((IntPtr)name), instance, device);
|
return del.Invoke (Marshal.PtrToStringAnsi ((IntPtr)name), instance, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKGlyphPathProxyDelegate))]
|
private static partial void SKGlyphPathProxyImplementation (IntPtr pathOrNull, SKMatrix* matrix, void* context)
|
||||||
private static void SKGlyphPathDelegateProxyImplementation (IntPtr pathOrNull, SKMatrix* matrix, void* context)
|
|
||||||
{
|
{
|
||||||
var del = Get<SKGlyphPathDelegate> ((IntPtr)context, out _);
|
var del = Get<SKGlyphPathDelegate> ((IntPtr)context, out _);
|
||||||
var path = SKPath.GetObject (pathOrNull, false);
|
var path = SKPath.GetObject (pathOrNull, false);
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
// ReSharper disable InconsistentNaming
|
||||||
|
|
||||||
|
namespace SkiaSharp;
|
||||||
|
|
||||||
|
internal static unsafe partial class DelegateProxies
|
||||||
|
{
|
||||||
|
private static partial /* size_t */ IntPtr SKManagedDrawableApproximateBytesUsedProxyImplementation (IntPtr d, void* context)
|
||||||
|
{
|
||||||
|
var drawable = GetUserData<SKDrawable> ((IntPtr)context, out _);
|
||||||
|
return (IntPtr)drawable.OnGetApproximateBytesUsed ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static partial void SKManagedDrawableDestroyProxyImplementation (IntPtr d, void* context)
|
||||||
|
{
|
||||||
|
var drawable = GetUserData<SKDrawable> ((IntPtr)context, out var gch);
|
||||||
|
if (drawable != null) {
|
||||||
|
Interlocked.Exchange (ref drawable.fromNative, 1);
|
||||||
|
drawable.Dispose ();
|
||||||
|
}
|
||||||
|
gch.Free ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static partial void SKManagedDrawableDrawProxyImplementation (IntPtr d, void* context, IntPtr ccanvas)
|
||||||
|
{
|
||||||
|
var drawable = GetUserData<SKDrawable> ((IntPtr)context, out _);
|
||||||
|
drawable.OnDraw (SKCanvas.GetObject (ccanvas, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static partial void SKManagedDrawableGetBoundsProxyImplementation (IntPtr d, void* context, SKRect* rect)
|
||||||
|
{
|
||||||
|
var drawable = GetUserData<SKDrawable> ((IntPtr)context, out _);
|
||||||
|
var bounds = drawable.OnGetBounds ();
|
||||||
|
*rect = bounds;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static partial IntPtr SKManagedDrawableMakePictureSnapshotProxyImplementation (IntPtr d, void* context)
|
||||||
|
{
|
||||||
|
var drawable = GetUserData<SKDrawable> ((IntPtr)context, out _);
|
||||||
|
return drawable.OnSnapshot ()?.Handle ?? IntPtr.Zero;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,94 @@
|
||||||
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
// ReSharper disable InconsistentNaming
|
||||||
|
|
||||||
|
namespace SkiaSharp;
|
||||||
|
|
||||||
|
internal static unsafe partial class DelegateProxies
|
||||||
|
{
|
||||||
|
private static partial IntPtr SKManagedStreamDuplicateProxyImplementation (IntPtr s, void* context)
|
||||||
|
{
|
||||||
|
var stream = GetUserData<SKAbstractManagedStream> ((IntPtr)context, out _);
|
||||||
|
return stream.OnDuplicate ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static partial IntPtr SKManagedStreamForkProxyImplementation (IntPtr s, void* context)
|
||||||
|
{
|
||||||
|
var stream = GetUserData<SKAbstractManagedStream> ((IntPtr)context, out _);
|
||||||
|
return stream.OnFork ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static partial /* size_t */ IntPtr SKManagedStreamGetLengthProxyImplementation (IntPtr s, void* context)
|
||||||
|
{
|
||||||
|
var stream = GetUserData<SKAbstractManagedStream> ((IntPtr)context, out _);
|
||||||
|
return stream.OnGetLength ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static partial /* size_t */ IntPtr SKManagedStreamGetPositionProxyImplementation (IntPtr s, void* context)
|
||||||
|
{
|
||||||
|
var stream = GetUserData<SKAbstractManagedStream> ((IntPtr)context, out _);
|
||||||
|
return stream.OnGetPosition ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static partial bool SKManagedStreamHasLengthProxyImplementation (IntPtr s, void* context)
|
||||||
|
{
|
||||||
|
var stream = GetUserData<SKAbstractManagedStream> ((IntPtr)context, out _);
|
||||||
|
return stream.OnHasLength ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static partial void SKManagedStreamDestroyProxyImplementation (IntPtr s, void* context)
|
||||||
|
{
|
||||||
|
var stream = GetUserData<SKAbstractManagedStream> ((IntPtr)context, out var gch);
|
||||||
|
if (stream != null) {
|
||||||
|
Interlocked.Exchange (ref stream.fromNative, 1);
|
||||||
|
stream.Dispose ();
|
||||||
|
}
|
||||||
|
gch.Free ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static partial bool SKManagedStreamHasPositionProxyImplementation (IntPtr s, void* context)
|
||||||
|
{
|
||||||
|
var stream = GetUserData<SKAbstractManagedStream> ((IntPtr)context, out _);
|
||||||
|
return stream.OnHasPosition ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static partial bool SKManagedStreamIsAtEndProxyImplementation (IntPtr s, void* context)
|
||||||
|
{
|
||||||
|
var stream = GetUserData<SKAbstractManagedStream> ((IntPtr)context, out _);
|
||||||
|
return stream.OnIsAtEnd ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static partial bool SKManagedStreamMoveProxyImplementation (IntPtr s, void* context, int offset)
|
||||||
|
{
|
||||||
|
var stream = GetUserData<SKAbstractManagedStream> ((IntPtr)context, out _);
|
||||||
|
return stream.OnMove (offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static partial /* size_t */
|
||||||
|
IntPtr SKManagedStreamPeekProxyImplementation (IntPtr s, void* context, void* buffer, /* size_t */ IntPtr size)
|
||||||
|
{
|
||||||
|
var stream = GetUserData<SKAbstractManagedStream> ((IntPtr)context, out _);
|
||||||
|
return stream.OnPeek ((IntPtr)buffer, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static partial /* size_t */
|
||||||
|
IntPtr SKManagedStreamReadProxyImplementation (IntPtr s, void* context, void* buffer, /* size_t */ IntPtr size)
|
||||||
|
{
|
||||||
|
|
||||||
|
var stream = GetUserData<SKAbstractManagedStream> ((IntPtr)context, out _);
|
||||||
|
return stream.OnRead ((IntPtr)buffer, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static partial bool SKManagedStreamRewindProxyImplementation (IntPtr s, void* context)
|
||||||
|
{
|
||||||
|
var stream = GetUserData<SKAbstractManagedStream> ((IntPtr)context, out _);
|
||||||
|
return stream.OnRewind ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static partial bool SKManagedStreamSeekProxyImplementation (IntPtr s, void* context, /* size_t */
|
||||||
|
IntPtr position)
|
||||||
|
{
|
||||||
|
var stream = GetUserData<SKAbstractManagedStream> ((IntPtr)context, out _);
|
||||||
|
return stream.OnSeek (position);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
// ReSharper disable InconsistentNaming
|
||||||
|
|
||||||
|
namespace SkiaSharp;
|
||||||
|
|
||||||
|
internal static unsafe partial class DelegateProxies
|
||||||
|
{
|
||||||
|
private static partial void SKManagedTraceMemoryDumpDumpNumericValueProxyImplementation (IntPtr d,
|
||||||
|
void* context, /* char */ void* dumpName, /* char */ void* valueName, /* char */ void* units, ulong value)
|
||||||
|
{
|
||||||
|
var dump = GetUserData<SKTraceMemoryDump> ((IntPtr)context, out _);
|
||||||
|
dump.OnDumpNumericValue (
|
||||||
|
Marshal.PtrToStringAnsi ((IntPtr)dumpName),
|
||||||
|
Marshal.PtrToStringAnsi ((IntPtr)valueName),
|
||||||
|
Marshal.PtrToStringAnsi ((IntPtr)units),
|
||||||
|
value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static partial void SKManagedTraceMemoryDumpDumpStringValueProxyImplementation (IntPtr d,
|
||||||
|
void* context, /* char */ void* dumpName, /* char */ void* valueName, /* char */ void* value)
|
||||||
|
{
|
||||||
|
var dump = GetUserData<SKTraceMemoryDump> ((IntPtr)context, out _);
|
||||||
|
dump.OnDumpStringValue (
|
||||||
|
Marshal.PtrToStringAnsi ((IntPtr)dumpName),
|
||||||
|
Marshal.PtrToStringAnsi ((IntPtr)valueName),
|
||||||
|
Marshal.PtrToStringAnsi ((IntPtr)value));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
// ReSharper disable InconsistentNaming
|
||||||
|
|
||||||
|
namespace SkiaSharp;
|
||||||
|
|
||||||
|
internal static unsafe partial class DelegateProxies
|
||||||
|
{
|
||||||
|
private static partial /* size_t */ IntPtr SKManagedWStreamBytesWrittenProxyImplementation (IntPtr s, void* context)
|
||||||
|
{
|
||||||
|
var stream = GetUserData<SKAbstractManagedWStream> ((IntPtr)context, out _);
|
||||||
|
return stream.OnBytesWritten ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static partial void SKManagedWStreamDestroyProxyImplementation (IntPtr s, void* context)
|
||||||
|
{
|
||||||
|
var stream = GetUserData<SKAbstractManagedWStream> ((IntPtr)context, out var gch);
|
||||||
|
if (stream != null) {
|
||||||
|
Interlocked.Exchange (ref stream.fromNative, 1);
|
||||||
|
stream.Dispose ();
|
||||||
|
}
|
||||||
|
gch.Free ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static partial void SKManagedWStreamFlushProxyImplementation (IntPtr s, void* context)
|
||||||
|
{
|
||||||
|
var stream = GetUserData<SKAbstractManagedWStream> ((IntPtr)context, out _);
|
||||||
|
stream.OnFlush ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static partial bool SKManagedWStreamWriteProxyImplementation (IntPtr s, void* context,
|
||||||
|
void* buffer, /* size_t */ IntPtr size)
|
||||||
|
{
|
||||||
|
var stream = GetUserData<SKAbstractManagedWStream> ((IntPtr)context, out _);
|
||||||
|
return stream.OnWrite ((IntPtr)buffer, size);
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,11 +7,12 @@ using SkiaSharp.Internals;
|
||||||
|
|
||||||
#if __TIZEN__
|
#if __TIZEN__
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace SkiaSharp
|
namespace SkiaSharp
|
||||||
{
|
{
|
||||||
public unsafe class GRGlInterface : SKObject, ISKReferenceCounted, ISKSkipObjectRegistration
|
public unsafe partial class GRGlInterface : SKObject, ISKReferenceCounted, ISKSkipObjectRegistration
|
||||||
{
|
{
|
||||||
internal GRGlInterface (IntPtr h, bool owns)
|
internal GRGlInterface (IntPtr h, bool owns)
|
||||||
: base (h, owns)
|
: base (h, owns)
|
||||||
|
@ -50,7 +51,8 @@ namespace SkiaSharp
|
||||||
|
|
||||||
public static GRGlInterface Create (GRGlGetProcedureAddressDelegate get)
|
public static GRGlInterface Create (GRGlGetProcedureAddressDelegate get)
|
||||||
{
|
{
|
||||||
var proxy = DelegateProxies.Create (get, DelegateProxies.GRGlGetProcDelegateProxy, out var gch, out var ctx);
|
DelegateProxies.Create (get, out var gch, out var ctx);
|
||||||
|
var proxy = get != null ? DelegateProxies.GRGlGetProcProxy : null;
|
||||||
try {
|
try {
|
||||||
return GetObject (SkiaApi.gr_glinterface_assemble_interface ((void*)ctx, proxy));
|
return GetObject (SkiaApi.gr_glinterface_assemble_interface ((void*)ctx, proxy));
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -63,7 +65,8 @@ namespace SkiaSharp
|
||||||
|
|
||||||
public static GRGlInterface CreateOpenGl (GRGlGetProcedureAddressDelegate get)
|
public static GRGlInterface CreateOpenGl (GRGlGetProcedureAddressDelegate get)
|
||||||
{
|
{
|
||||||
var proxy = DelegateProxies.Create (get, DelegateProxies.GRGlGetProcDelegateProxy, out var gch, out var ctx);
|
DelegateProxies.Create (get, out var gch, out var ctx);
|
||||||
|
var proxy = get != null ? DelegateProxies.GRGlGetProcProxy : null;
|
||||||
try {
|
try {
|
||||||
return GetObject (SkiaApi.gr_glinterface_assemble_gl_interface ((void*)ctx, proxy));
|
return GetObject (SkiaApi.gr_glinterface_assemble_gl_interface ((void*)ctx, proxy));
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -73,7 +76,8 @@ namespace SkiaSharp
|
||||||
|
|
||||||
public static GRGlInterface CreateGles (GRGlGetProcedureAddressDelegate get)
|
public static GRGlInterface CreateGles (GRGlGetProcedureAddressDelegate get)
|
||||||
{
|
{
|
||||||
var proxy = DelegateProxies.Create (get, DelegateProxies.GRGlGetProcDelegateProxy, out var gch, out var ctx);
|
DelegateProxies.Create (get, out var gch, out var ctx);
|
||||||
|
var proxy = get != null ? DelegateProxies.GRGlGetProcProxy : null;
|
||||||
try {
|
try {
|
||||||
return GetObject (SkiaApi.gr_glinterface_assemble_gles_interface ((void*)ctx, proxy));
|
return GetObject (SkiaApi.gr_glinterface_assemble_gles_interface ((void*)ctx, proxy));
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -83,7 +87,8 @@ namespace SkiaSharp
|
||||||
|
|
||||||
public static GRGlInterface CreateWebGl (GRGlGetProcedureAddressDelegate get)
|
public static GRGlInterface CreateWebGl (GRGlGetProcedureAddressDelegate get)
|
||||||
{
|
{
|
||||||
var proxy = DelegateProxies.Create (get, DelegateProxies.GRGlGetProcDelegateProxy, out var gch, out var ctx);
|
DelegateProxies.Create (get, out var gch, out var ctx);
|
||||||
|
var proxy = get != null ? DelegateProxies.GRGlGetProcProxy : null;
|
||||||
try {
|
try {
|
||||||
return GetObject (SkiaApi.gr_glinterface_assemble_webgl_interface ((void*)ctx, proxy));
|
return GetObject (SkiaApi.gr_glinterface_assemble_webgl_interface ((void*)ctx, proxy));
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -117,7 +122,7 @@ namespace SkiaSharp
|
||||||
//
|
//
|
||||||
|
|
||||||
#if (NETSTANDARD || NET6_0_OR_GREATER || NET40_OR_GREATER) && (!NETPLATFORM || WINDOWS)
|
#if (NETSTANDARD || NET6_0_OR_GREATER || NET40_OR_GREATER) && (!NETPLATFORM || WINDOWS)
|
||||||
private static class AngleLoader
|
private static partial class AngleLoader
|
||||||
{
|
{
|
||||||
private static readonly IntPtr libEGL;
|
private static readonly IntPtr libEGL;
|
||||||
private static readonly IntPtr libGLESv2;
|
private static readonly IntPtr libGLESv2;
|
||||||
|
@ -132,6 +137,12 @@ namespace SkiaSharp
|
||||||
private static extern IntPtr GetProcAddress (IntPtr hModule, [MarshalAs (UnmanagedType.LPStr)] string lpProcName);
|
private static extern IntPtr GetProcAddress (IntPtr hModule, [MarshalAs (UnmanagedType.LPStr)] string lpProcName);
|
||||||
|
|
||||||
private static IntPtr LoadLibrary (string lpFileName) => LoadPackagedLibrary(lpFileName, 0);
|
private static IntPtr LoadLibrary (string lpFileName) => LoadPackagedLibrary(lpFileName, 0);
|
||||||
|
#elif USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport ("Kernel32.dll", SetLastError = true, EntryPoint = "LoadLibraryW", StringMarshalling = StringMarshalling.Utf16)]
|
||||||
|
private static partial IntPtr LoadLibrary (string lpFileName);
|
||||||
|
|
||||||
|
[LibraryImport ("Kernel32.dll", SetLastError = true)]
|
||||||
|
private static partial IntPtr GetProcAddress (IntPtr hModule, [MarshalAs (UnmanagedType.LPStr)] string lpProcName);
|
||||||
#else
|
#else
|
||||||
[DllImport ("Kernel32.dll", SetLastError = true, CharSet = CharSet.Ansi)]
|
[DllImport ("Kernel32.dll", SetLastError = true, CharSet = CharSet.Ansi)]
|
||||||
private static extern IntPtr LoadLibrary ([MarshalAs (UnmanagedType.LPStr)] string lpFileName);
|
private static extern IntPtr LoadLibrary ([MarshalAs (UnmanagedType.LPStr)] string lpFileName);
|
||||||
|
@ -140,8 +151,13 @@ namespace SkiaSharp
|
||||||
private static extern IntPtr GetProcAddress (IntPtr hModule, [MarshalAs (UnmanagedType.LPStr)] string lpProcName);
|
private static extern IntPtr GetProcAddress (IntPtr hModule, [MarshalAs (UnmanagedType.LPStr)] string lpProcName);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport ("libEGL.dll")]
|
||||||
|
private static partial IntPtr eglGetProcAddress ([MarshalAs (UnmanagedType.LPStr)] string procname);
|
||||||
|
#else
|
||||||
[DllImport ("libEGL.dll")]
|
[DllImport ("libEGL.dll")]
|
||||||
private static extern IntPtr eglGetProcAddress ([MarshalAs (UnmanagedType.LPStr)] string procname);
|
private static extern IntPtr eglGetProcAddress ([MarshalAs (UnmanagedType.LPStr)] string procname);
|
||||||
|
#endif
|
||||||
|
|
||||||
static AngleLoader()
|
static AngleLoader()
|
||||||
{
|
{
|
||||||
|
@ -183,7 +199,7 @@ namespace SkiaSharp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __TIZEN__
|
#if __TIZEN__
|
||||||
private class EvasGlLoader
|
private partial class EvasGlLoader
|
||||||
{
|
{
|
||||||
private const string libevas = "libevas.so.1";
|
private const string libevas = "libevas.so.1";
|
||||||
|
|
||||||
|
@ -194,17 +210,17 @@ namespace SkiaSharp
|
||||||
private readonly IntPtr glEvas;
|
private readonly IntPtr glEvas;
|
||||||
private readonly EvasGlApi api;
|
private readonly EvasGlApi api;
|
||||||
|
|
||||||
[DllImport (libevas)]
|
[LibraryImport (libevas)]
|
||||||
internal static extern IntPtr evas_gl_api_get (IntPtr evas_gl);
|
internal static partial IntPtr evas_gl_api_get (IntPtr evas_gl);
|
||||||
|
|
||||||
[DllImport (libevas)]
|
[LibraryImport (libevas)]
|
||||||
internal static extern IntPtr evas_gl_context_api_get (IntPtr evas_gl, IntPtr ctx);
|
internal static partial IntPtr evas_gl_context_api_get (IntPtr evas_gl, IntPtr ctx);
|
||||||
|
|
||||||
[DllImport (libevas)]
|
[LibraryImport (libevas)]
|
||||||
internal static extern IntPtr evas_gl_current_context_get (IntPtr evas_gl);
|
internal static partial IntPtr evas_gl_current_context_get (IntPtr evas_gl);
|
||||||
|
|
||||||
[DllImport (libevas)]
|
[LibraryImport(libevas)]
|
||||||
internal static extern IntPtr evas_gl_proc_address_get (IntPtr evas_gl, string name);
|
internal static partial IntPtr evas_gl_proc_address_get (IntPtr evas_gl, [MarshalAs (UnmanagedType.LPStr)] string name);
|
||||||
|
|
||||||
static EvasGlLoader ()
|
static EvasGlLoader ()
|
||||||
{
|
{
|
||||||
|
@ -213,7 +229,7 @@ namespace SkiaSharp
|
||||||
apiFields = EvasGlApiType.GetFields (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
|
apiFields = EvasGlApiType.GetFields (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EvasGlLoader (IntPtr evas)
|
public unsafe EvasGlLoader (IntPtr evas)
|
||||||
{
|
{
|
||||||
glEvas = evas;
|
glEvas = evas;
|
||||||
var glContext = evas_gl_current_context_get (glEvas);
|
var glContext = evas_gl_current_context_get (glEvas);
|
||||||
|
@ -222,7 +238,7 @@ namespace SkiaSharp
|
||||||
? evas_gl_context_api_get (glEvas, glContext)
|
? evas_gl_context_api_get (glEvas, glContext)
|
||||||
: evas_gl_api_get (glEvas);
|
: evas_gl_api_get (glEvas);
|
||||||
|
|
||||||
api = Marshal.PtrToStructure<EvasGlApi> (apiPtr);
|
api = *(EvasGlApi*)apiPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IntPtr GetFunctionPointer (string name)
|
public IntPtr GetFunctionPointer (string name)
|
||||||
|
|
|
@ -12,7 +12,6 @@ namespace SkiaSharp
|
||||||
public unsafe class GRVkBackendContext : IDisposable
|
public unsafe class GRVkBackendContext : IDisposable
|
||||||
{
|
{
|
||||||
private GRVkGetProcedureAddressDelegate getProc;
|
private GRVkGetProcedureAddressDelegate getProc;
|
||||||
private GRVkGetProcProxyDelegate getProcProxy;
|
|
||||||
private GCHandle getProcHandle;
|
private GCHandle getProcHandle;
|
||||||
private void* getProcContext;
|
private void* getProcContext;
|
||||||
|
|
||||||
|
@ -58,12 +57,11 @@ namespace SkiaSharp
|
||||||
if (getProcHandle.IsAllocated)
|
if (getProcHandle.IsAllocated)
|
||||||
getProcHandle.Free ();
|
getProcHandle.Free ();
|
||||||
|
|
||||||
getProcProxy = null;
|
|
||||||
getProcHandle = default;
|
getProcHandle = default;
|
||||||
getProcContext = null;
|
getProcContext = null;
|
||||||
|
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
getProcProxy = DelegateProxies.Create (value, DelegateProxies.GRVkGetProcDelegateProxy, out var gch, out var ctx);
|
DelegateProxies.Create (value, out var gch, out var ctx);
|
||||||
getProcHandle = gch;
|
getProcHandle = gch;
|
||||||
getProcContext = (void*)ctx;
|
getProcContext = (void*)ctx;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +82,7 @@ namespace SkiaSharp
|
||||||
fDeviceFeatures = VkPhysicalDeviceFeatures,
|
fDeviceFeatures = VkPhysicalDeviceFeatures,
|
||||||
fDeviceFeatures2 = VkPhysicalDeviceFeatures2,
|
fDeviceFeatures2 = VkPhysicalDeviceFeatures2,
|
||||||
fGetProcUserData = getProcContext,
|
fGetProcUserData = getProcContext,
|
||||||
fGetProc = getProcProxy,
|
fGetProc = getProcContext is not null ? DelegateProxies.GRVkGetProcProxy : null,
|
||||||
fProtectedContext = ProtectedContext ? (byte)1 : (byte)0
|
fProtectedContext = ProtectedContext ? (byte)1 : (byte)0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,11 @@ namespace SkiaSharp
|
||||||
|
|
||||||
public void Initialize (GRVkGetProcedureAddressDelegate getProc, IntPtr vkInstance, IntPtr vkPhysicalDevice, string[] instanceExtensions, string[] deviceExtensions)
|
public void Initialize (GRVkGetProcedureAddressDelegate getProc, IntPtr vkInstance, IntPtr vkPhysicalDevice, string[] instanceExtensions, string[] deviceExtensions)
|
||||||
{
|
{
|
||||||
var proxy = DelegateProxies.Create (getProc, DelegateProxies.GRVkGetProcDelegateProxy, out var gch, out var ctx);
|
DelegateProxies.Create (getProc, out var gch, out var ctx);
|
||||||
try {
|
try {
|
||||||
var ie = instanceExtensions;
|
var ie = instanceExtensions;
|
||||||
var de = deviceExtensions;
|
var de = deviceExtensions;
|
||||||
|
var proxy = getProc != null ? DelegateProxies.GRVkGetProcProxy : null;
|
||||||
SkiaApi.gr_vk_extensions_init (Handle, proxy, (void*)ctx, vkInstance, vkPhysicalDevice, (uint)(ie?.Length ?? 0), ie, (uint)(de?.Length ?? 0), de);
|
SkiaApi.gr_vk_extensions_init (Handle, proxy, (void*)ctx, vkInstance, vkPhysicalDevice, (uint)(ie?.Length ?? 0), ie, (uint)(de?.Length ?? 0), de);
|
||||||
} finally {
|
} finally {
|
||||||
gch.Free ();
|
gch.Free ();
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
|
@ -38,7 +39,7 @@ namespace SkiaSharp.Internals
|
||||||
/// Helper class to create a IPlatformLock instance, by default according to the current platform
|
/// Helper class to create a IPlatformLock instance, by default according to the current platform
|
||||||
/// but also client toolkits can plugin their own implementation.
|
/// but also client toolkits can plugin their own implementation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class PlatformLock
|
public static partial class PlatformLock
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a platform lock
|
/// Creates a platform lock
|
||||||
|
@ -92,11 +93,11 @@ namespace SkiaSharp.Internals
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Windows platform lock uses Win32 CRITICAL_SECTION
|
/// Windows platform lock uses Win32 CRITICAL_SECTION
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class NonAlertableWin32Lock : IPlatformLock
|
partial class NonAlertableWin32Lock : IPlatformLock
|
||||||
{
|
{
|
||||||
public NonAlertableWin32Lock ()
|
public NonAlertableWin32Lock ()
|
||||||
{
|
{
|
||||||
_cs = Marshal.AllocHGlobal (Marshal.SizeOf<CRITICAL_SECTION> ());
|
_cs = Marshal.AllocHGlobal (Unsafe.SizeOf<CRITICAL_SECTION>());
|
||||||
if (_cs == IntPtr.Zero)
|
if (_cs == IntPtr.Zero)
|
||||||
throw new OutOfMemoryException ("Failed to allocate memory for critical section");
|
throw new OutOfMemoryException ("Failed to allocate memory for critical section");
|
||||||
|
|
||||||
|
@ -146,6 +147,17 @@ namespace SkiaSharp.Internals
|
||||||
public UIntPtr SpinCount;
|
public UIntPtr SpinCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport ("Kernel32.dll", SetLastError = true)]
|
||||||
|
[return: MarshalAs (UnmanagedType.Bool)]
|
||||||
|
private static partial bool InitializeCriticalSectionEx (IntPtr lpCriticalSection, uint dwSpinCount, uint Flags);
|
||||||
|
[LibraryImport ("Kernel32.dll")]
|
||||||
|
private static partial void DeleteCriticalSection (IntPtr lpCriticalSection);
|
||||||
|
[LibraryImport ("Kernel32.dll")]
|
||||||
|
private static partial void EnterCriticalSection (IntPtr lpCriticalSection);
|
||||||
|
[LibraryImport ("Kernel32.dll")]
|
||||||
|
private static partial void LeaveCriticalSection (IntPtr lpCriticalSection);
|
||||||
|
#else
|
||||||
[DllImport ("Kernel32.dll", SetLastError = true)]
|
[DllImport ("Kernel32.dll", SetLastError = true)]
|
||||||
[return: MarshalAs (UnmanagedType.Bool)]
|
[return: MarshalAs (UnmanagedType.Bool)]
|
||||||
static extern bool InitializeCriticalSectionEx (IntPtr lpCriticalSection, uint dwSpinCount, uint Flags);
|
static extern bool InitializeCriticalSectionEx (IntPtr lpCriticalSection, uint dwSpinCount, uint Flags);
|
||||||
|
@ -155,6 +167,7 @@ namespace SkiaSharp.Internals
|
||||||
static extern void EnterCriticalSection (IntPtr lpCriticalSection);
|
static extern void EnterCriticalSection (IntPtr lpCriticalSection);
|
||||||
[DllImport ("Kernel32.dll")]
|
[DllImport ("Kernel32.dll")]
|
||||||
static extern void LeaveCriticalSection (IntPtr lpCriticalSection);
|
static extern void LeaveCriticalSection (IntPtr lpCriticalSection);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,3 +62,7 @@ using System.Runtime.CompilerServices;
|
||||||
[assembly: Foundation.LinkerSafe]
|
[assembly: Foundation.LinkerSafe]
|
||||||
#pragma warning restore CS0618 // Type or member is obsolete
|
#pragma warning restore CS0618 // Type or member is obsolete
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if NET7_0_OR_GREATER
|
||||||
|
[assembly: DisableRuntimeMarshalling]
|
||||||
|
#endif
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace SkiaSharp
|
namespace SkiaSharp
|
||||||
|
@ -10,24 +9,24 @@ namespace SkiaSharp
|
||||||
{
|
{
|
||||||
private static readonly SKManagedStreamDelegates delegates;
|
private static readonly SKManagedStreamDelegates delegates;
|
||||||
|
|
||||||
private int fromNative;
|
internal int fromNative;
|
||||||
|
|
||||||
static SKAbstractManagedStream ()
|
static SKAbstractManagedStream ()
|
||||||
{
|
{
|
||||||
delegates = new SKManagedStreamDelegates {
|
delegates = new SKManagedStreamDelegates {
|
||||||
fRead = ReadInternal,
|
fRead = DelegateProxies.SKManagedStreamReadProxy,
|
||||||
fPeek = PeekInternal,
|
fPeek = DelegateProxies.SKManagedStreamPeekProxy,
|
||||||
fIsAtEnd = IsAtEndInternal,
|
fIsAtEnd = DelegateProxies.SKManagedStreamIsAtEndProxy,
|
||||||
fHasPosition = HasPositionInternal,
|
fHasPosition = DelegateProxies.SKManagedStreamHasPositionProxy,
|
||||||
fHasLength = HasLengthInternal,
|
fHasLength = DelegateProxies.SKManagedStreamHasLengthProxy,
|
||||||
fRewind = RewindInternal,
|
fRewind = DelegateProxies.SKManagedStreamRewindProxy,
|
||||||
fGetPosition = GetPositionInternal,
|
fGetPosition = DelegateProxies.SKManagedStreamGetPositionProxy,
|
||||||
fSeek = SeekInternal,
|
fSeek = DelegateProxies.SKManagedStreamSeekProxy,
|
||||||
fMove = MoveInternal,
|
fMove = DelegateProxies.SKManagedStreamMoveProxy,
|
||||||
fGetLength = GetLengthInternal,
|
fGetLength = DelegateProxies.SKManagedStreamGetLengthProxy,
|
||||||
fDuplicate = DuplicateInternal,
|
fDuplicate = DelegateProxies.SKManagedStreamDuplicateProxy,
|
||||||
fFork = ForkInternal,
|
fFork = DelegateProxies.SKManagedStreamForkProxy,
|
||||||
fDestroy = DestroyInternal,
|
fDestroy = DelegateProxies.SKManagedStreamDestroyProxy,
|
||||||
};
|
};
|
||||||
SkiaApi.sk_managedstream_set_procs (delegates);
|
SkiaApi.sk_managedstream_set_procs (delegates);
|
||||||
}
|
}
|
||||||
|
@ -53,130 +52,35 @@ namespace SkiaSharp
|
||||||
SkiaApi.sk_managedstream_destroy (Handle);
|
SkiaApi.sk_managedstream_destroy (Handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract IntPtr OnRead (IntPtr buffer, IntPtr size);
|
protected internal abstract IntPtr OnRead (IntPtr buffer, IntPtr size);
|
||||||
|
|
||||||
protected abstract IntPtr OnPeek (IntPtr buffer, IntPtr size);
|
protected internal abstract IntPtr OnPeek (IntPtr buffer, IntPtr size);
|
||||||
|
|
||||||
protected abstract bool OnIsAtEnd ();
|
protected internal abstract bool OnIsAtEnd ();
|
||||||
|
|
||||||
protected abstract bool OnHasPosition ();
|
protected internal abstract bool OnHasPosition ();
|
||||||
|
|
||||||
protected abstract bool OnHasLength ();
|
protected internal abstract bool OnHasLength ();
|
||||||
|
|
||||||
protected abstract bool OnRewind ();
|
protected internal abstract bool OnRewind ();
|
||||||
|
|
||||||
protected abstract IntPtr OnGetPosition ();
|
protected internal abstract IntPtr OnGetPosition ();
|
||||||
|
|
||||||
protected abstract IntPtr OnGetLength ();
|
protected internal abstract IntPtr OnGetLength ();
|
||||||
|
|
||||||
protected abstract bool OnSeek (IntPtr position);
|
protected internal abstract bool OnSeek (IntPtr position);
|
||||||
|
|
||||||
protected abstract bool OnMove (int offset);
|
protected internal abstract bool OnMove (int offset);
|
||||||
|
|
||||||
protected abstract IntPtr OnCreateNew ();
|
protected internal abstract IntPtr OnCreateNew ();
|
||||||
|
|
||||||
protected virtual IntPtr OnFork ()
|
protected internal virtual IntPtr OnFork ()
|
||||||
{
|
{
|
||||||
var stream = OnCreateNew ();
|
var stream = OnCreateNew ();
|
||||||
SkiaApi.sk_stream_seek (stream, SkiaApi.sk_stream_get_position (Handle));
|
SkiaApi.sk_stream_seek (stream, SkiaApi.sk_stream_get_position (Handle));
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual IntPtr OnDuplicate () => OnCreateNew ();
|
protected internal virtual IntPtr OnDuplicate () => OnCreateNew ();
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKManagedStreamReadProxyDelegate))]
|
|
||||||
private static IntPtr ReadInternal (IntPtr s, void* context, void* buffer, IntPtr size)
|
|
||||||
{
|
|
||||||
var stream = DelegateProxies.GetUserData<SKAbstractManagedStream> ((IntPtr)context, out _);
|
|
||||||
return stream.OnRead ((IntPtr)buffer, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKManagedStreamPeekProxyDelegate))]
|
|
||||||
private static IntPtr PeekInternal (IntPtr s, void* context, void* buffer, IntPtr size)
|
|
||||||
{
|
|
||||||
var stream = DelegateProxies.GetUserData<SKAbstractManagedStream> ((IntPtr)context, out _);
|
|
||||||
return stream.OnPeek ((IntPtr)buffer, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKManagedStreamIsAtEndProxyDelegate))]
|
|
||||||
private static bool IsAtEndInternal (IntPtr s, void* context)
|
|
||||||
{
|
|
||||||
var stream = DelegateProxies.GetUserData<SKAbstractManagedStream> ((IntPtr)context, out _);
|
|
||||||
return stream.OnIsAtEnd ();
|
|
||||||
}
|
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKManagedStreamHasPositionProxyDelegate))]
|
|
||||||
private static bool HasPositionInternal (IntPtr s, void* context)
|
|
||||||
{
|
|
||||||
var stream = DelegateProxies.GetUserData<SKAbstractManagedStream> ((IntPtr)context, out _);
|
|
||||||
return stream.OnHasPosition ();
|
|
||||||
}
|
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKManagedStreamHasLengthProxyDelegate))]
|
|
||||||
private static bool HasLengthInternal (IntPtr s, void* context)
|
|
||||||
{
|
|
||||||
var stream = DelegateProxies.GetUserData<SKAbstractManagedStream> ((IntPtr)context, out _);
|
|
||||||
return stream.OnHasLength ();
|
|
||||||
}
|
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKManagedStreamRewindProxyDelegate))]
|
|
||||||
private static bool RewindInternal (IntPtr s, void* context)
|
|
||||||
{
|
|
||||||
var stream = DelegateProxies.GetUserData<SKAbstractManagedStream> ((IntPtr)context, out _);
|
|
||||||
return stream.OnRewind ();
|
|
||||||
}
|
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKManagedStreamGetPositionProxyDelegate))]
|
|
||||||
private static IntPtr GetPositionInternal (IntPtr s, void* context)
|
|
||||||
{
|
|
||||||
var stream = DelegateProxies.GetUserData<SKAbstractManagedStream> ((IntPtr)context, out _);
|
|
||||||
return stream.OnGetPosition ();
|
|
||||||
}
|
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKManagedStreamSeekProxyDelegate))]
|
|
||||||
private static bool SeekInternal (IntPtr s, void* context, IntPtr position)
|
|
||||||
{
|
|
||||||
var stream = DelegateProxies.GetUserData<SKAbstractManagedStream> ((IntPtr)context, out _);
|
|
||||||
return stream.OnSeek (position);
|
|
||||||
}
|
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKManagedStreamMoveProxyDelegate))]
|
|
||||||
private static bool MoveInternal (IntPtr s, void* context, int offset)
|
|
||||||
{
|
|
||||||
var stream = DelegateProxies.GetUserData<SKAbstractManagedStream> ((IntPtr)context, out _);
|
|
||||||
return stream.OnMove (offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKManagedStreamGetLengthProxyDelegate))]
|
|
||||||
private static IntPtr GetLengthInternal (IntPtr s, void* context)
|
|
||||||
{
|
|
||||||
var stream = DelegateProxies.GetUserData<SKAbstractManagedStream> ((IntPtr)context, out _);
|
|
||||||
return stream.OnGetLength ();
|
|
||||||
}
|
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKManagedStreamDuplicateProxyDelegate))]
|
|
||||||
private static IntPtr DuplicateInternal (IntPtr s, void* context)
|
|
||||||
{
|
|
||||||
var stream = DelegateProxies.GetUserData<SKAbstractManagedStream> ((IntPtr)context, out _);
|
|
||||||
return stream.OnDuplicate ();
|
|
||||||
}
|
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKManagedStreamForkProxyDelegate))]
|
|
||||||
private static IntPtr ForkInternal (IntPtr s, void* context)
|
|
||||||
{
|
|
||||||
var stream = DelegateProxies.GetUserData<SKAbstractManagedStream> ((IntPtr)context, out _);
|
|
||||||
return stream.OnFork ();
|
|
||||||
}
|
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKManagedStreamDestroyProxyDelegate))]
|
|
||||||
private static void DestroyInternal (IntPtr s, void* context)
|
|
||||||
{
|
|
||||||
var stream = DelegateProxies.GetUserData<SKAbstractManagedStream> ((IntPtr)context, out var gch);
|
|
||||||
if (stream != null) {
|
|
||||||
Interlocked.Exchange (ref stream.fromNative, 1);
|
|
||||||
stream.Dispose ();
|
|
||||||
}
|
|
||||||
gch.Free ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
|
@ -10,15 +11,15 @@ namespace SkiaSharp
|
||||||
{
|
{
|
||||||
private static readonly SKManagedWStreamDelegates delegates;
|
private static readonly SKManagedWStreamDelegates delegates;
|
||||||
|
|
||||||
private int fromNative;
|
internal int fromNative;
|
||||||
|
|
||||||
static SKAbstractManagedWStream ()
|
static SKAbstractManagedWStream ()
|
||||||
{
|
{
|
||||||
delegates = new SKManagedWStreamDelegates {
|
delegates = new SKManagedWStreamDelegates {
|
||||||
fWrite = WriteInternal,
|
fWrite = DelegateProxies.SKManagedWStreamWriteProxy,
|
||||||
fFlush = FlushInternal,
|
fFlush = DelegateProxies.SKManagedWStreamFlushProxy,
|
||||||
fBytesWritten = BytesWrittenInternal,
|
fBytesWritten = DelegateProxies.SKManagedWStreamBytesWrittenProxy,
|
||||||
fDestroy = DestroyInternal,
|
fDestroy = DelegateProxies.SKManagedWStreamDestroyProxy
|
||||||
};
|
};
|
||||||
|
|
||||||
SkiaApi.sk_managedwstream_set_procs (delegates);
|
SkiaApi.sk_managedwstream_set_procs (delegates);
|
||||||
|
@ -45,42 +46,10 @@ namespace SkiaSharp
|
||||||
SkiaApi.sk_managedwstream_destroy (Handle);
|
SkiaApi.sk_managedwstream_destroy (Handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract bool OnWrite (IntPtr buffer, IntPtr size);
|
protected internal abstract bool OnWrite (IntPtr buffer, IntPtr size);
|
||||||
|
|
||||||
protected abstract void OnFlush ();
|
protected internal abstract void OnFlush ();
|
||||||
|
|
||||||
protected abstract IntPtr OnBytesWritten ();
|
protected internal abstract IntPtr OnBytesWritten ();
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKManagedWStreamWriteProxyDelegate))]
|
|
||||||
private static bool WriteInternal (IntPtr s, void* context, void* 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)
|
|
||||||
{
|
|
||||||
var stream = DelegateProxies.GetUserData<SKAbstractManagedWStream> ((IntPtr)context, out _);
|
|
||||||
stream.OnFlush ();
|
|
||||||
}
|
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKManagedWStreamBytesWrittenProxyDelegate))]
|
|
||||||
private static IntPtr BytesWrittenInternal (IntPtr s, void* context)
|
|
||||||
{
|
|
||||||
var stream = DelegateProxies.GetUserData<SKAbstractManagedWStream> ((IntPtr)context, out _);
|
|
||||||
return stream.OnBytesWritten ();
|
|
||||||
}
|
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKManagedWStreamDestroyProxyDelegate))]
|
|
||||||
private static void DestroyInternal (IntPtr s, void* context)
|
|
||||||
{
|
|
||||||
var stream = DelegateProxies.GetUserData<SKAbstractManagedWStream> ((IntPtr)context, out var gch);
|
|
||||||
if (stream != null) {
|
|
||||||
Interlocked.Exchange (ref stream.fromNative, 1);
|
|
||||||
stream.Dispose ();
|
|
||||||
}
|
|
||||||
gch.Free ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ using SkiaSharp.Internals;
|
||||||
|
|
||||||
namespace SkiaSharp
|
namespace SkiaSharp
|
||||||
{
|
{
|
||||||
public class SKAutoCoInitialize : IDisposable
|
public partial class SKAutoCoInitialize : IDisposable
|
||||||
{
|
{
|
||||||
private long hResult;
|
private long hResult;
|
||||||
|
|
||||||
|
@ -41,10 +41,16 @@ namespace SkiaSharp
|
||||||
private const uint COINIT_DISABLE_OLE1DDE = 0x4;
|
private const uint COINIT_DISABLE_OLE1DDE = 0x4;
|
||||||
private const uint COINIT_SPEED_OVER_MEMORY = 0x8;
|
private const uint COINIT_SPEED_OVER_MEMORY = 0x8;
|
||||||
|
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
[LibraryImport("ole32.dll", SetLastError = true)]
|
||||||
|
private static partial long CoInitializeEx(IntPtr pvReserved, uint dwCoInit);
|
||||||
|
[LibraryImport("ole32.dll", SetLastError = true)]
|
||||||
|
private static partial void CoUninitialize();
|
||||||
|
#else
|
||||||
[DllImport("ole32.dll", CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.StdCall)]
|
[DllImport("ole32.dll", CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.StdCall)]
|
||||||
private static extern long CoInitializeEx([In, Optional] IntPtr pvReserved, [In] uint dwCoInit);
|
private static extern long CoInitializeEx([In, Optional] IntPtr pvReserved, [In] uint dwCoInit);
|
||||||
|
|
||||||
[DllImport("ole32.dll", CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.StdCall)]
|
[DllImport("ole32.dll", CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.StdCall)]
|
||||||
private static extern void CoUninitialize();
|
private static extern void CoUninitialize();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -609,7 +609,8 @@ namespace SkiaSharp
|
||||||
var del = releaseProc != null && context != null
|
var del = releaseProc != null && context != null
|
||||||
? new SKBitmapReleaseDelegate ((addr, _) => releaseProc (addr, context))
|
? new SKBitmapReleaseDelegate ((addr, _) => releaseProc (addr, context))
|
||||||
: releaseProc;
|
: releaseProc;
|
||||||
var proxy = DelegateProxies.Create (del, DelegateProxies.SKBitmapReleaseDelegateProxy, out _, out var ctx);
|
DelegateProxies.Create (del, out _, out var ctx);
|
||||||
|
var proxy = del is not null ? DelegateProxies.SKBitmapReleaseProxy : null;
|
||||||
return SkiaApi.sk_bitmap_install_pixels (Handle, &cinfo, (void*)pixels, (IntPtr)rowBytes, proxy, (void*)ctx);
|
return SkiaApi.sk_bitmap_install_pixels (Handle, &cinfo, (void*)pixels, (IntPtr)rowBytes, proxy, (void*)ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -186,7 +186,7 @@ namespace SkiaSharp
|
||||||
throw new ArgumentNullException (nameof (stream));
|
throw new ArgumentNullException (nameof (stream));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return GetObject (SkiaApi.sk_data_new_from_stream (stream.Handle, (IntPtr)length));
|
return GetObject (SkiaApi.sk_data_new_from_stream (stream.Handle, (IntPtr)length));
|
||||||
} finally {
|
} finally {
|
||||||
GC.KeepAlive(stream);
|
GC.KeepAlive(stream);
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,8 @@ namespace SkiaSharp
|
||||||
var del = releaseProc != null && context != null
|
var del = releaseProc != null && context != null
|
||||||
? new SKDataReleaseDelegate ((addr, _) => releaseProc (addr, context))
|
? new SKDataReleaseDelegate ((addr, _) => releaseProc (addr, context))
|
||||||
: releaseProc;
|
: releaseProc;
|
||||||
var proxy = DelegateProxies.Create (del, DelegateProxies.SKDataReleaseDelegateProxy, out _, out var ctx);
|
DelegateProxies.Create (del, out _, out var ctx);
|
||||||
|
var proxy = del is not null ? DelegateProxies.SKDataReleaseProxy : null;
|
||||||
return GetObject (SkiaApi.sk_data_new_with_proc ((void*)address, (IntPtr)length, proxy, (void*)ctx));
|
return GetObject (SkiaApi.sk_data_new_with_proc ((void*)address, (IntPtr)length, proxy, (void*)ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace SkiaSharp
|
namespace SkiaSharp
|
||||||
|
@ -10,16 +9,16 @@ namespace SkiaSharp
|
||||||
{
|
{
|
||||||
private static readonly SKManagedDrawableDelegates delegates;
|
private static readonly SKManagedDrawableDelegates delegates;
|
||||||
|
|
||||||
private int fromNative;
|
internal int fromNative;
|
||||||
|
|
||||||
static SKDrawable ()
|
static SKDrawable ()
|
||||||
{
|
{
|
||||||
delegates = new SKManagedDrawableDelegates {
|
delegates = new SKManagedDrawableDelegates {
|
||||||
fDraw = DrawInternal,
|
fDraw = DelegateProxies.SKManagedDrawableDrawProxy,
|
||||||
fGetBounds = GetBoundsInternal,
|
fGetBounds = DelegateProxies.SKManagedDrawableGetBoundsProxy,
|
||||||
fApproximateBytesUsed = ApproximateBytesUsedInternal,
|
fApproximateBytesUsed = DelegateProxies.SKManagedDrawableApproximateBytesUsedProxy,
|
||||||
fMakePictureSnapshot = MakePictureSnapshotInternal,
|
fMakePictureSnapshot = DelegateProxies.SKManagedDrawableMakePictureSnapshotProxy,
|
||||||
fDestroy = DestroyInternal,
|
fDestroy = DelegateProxies.SKManagedDrawableDestroyProxy
|
||||||
};
|
};
|
||||||
|
|
||||||
SkiaApi.sk_manageddrawable_set_procs (delegates);
|
SkiaApi.sk_manageddrawable_set_procs (delegates);
|
||||||
|
@ -87,15 +86,15 @@ namespace SkiaSharp
|
||||||
public void NotifyDrawingChanged () =>
|
public void NotifyDrawingChanged () =>
|
||||||
SkiaApi.sk_drawable_notify_drawing_changed (Handle);
|
SkiaApi.sk_drawable_notify_drawing_changed (Handle);
|
||||||
|
|
||||||
protected virtual void OnDraw (SKCanvas canvas)
|
protected internal virtual void OnDraw (SKCanvas canvas)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual int OnGetApproximateBytesUsed () => 0;
|
protected internal virtual int OnGetApproximateBytesUsed () => 0;
|
||||||
|
|
||||||
protected virtual SKRect OnGetBounds () => SKRect.Empty;
|
protected internal virtual SKRect OnGetBounds () => SKRect.Empty;
|
||||||
|
|
||||||
protected virtual SKPicture OnSnapshot ()
|
protected internal virtual SKPicture OnSnapshot ()
|
||||||
{
|
{
|
||||||
using var recorder = new SKPictureRecorder ();
|
using var recorder = new SKPictureRecorder ();
|
||||||
var canvas = recorder.BeginRecording (Bounds);
|
var canvas = recorder.BeginRecording (Bounds);
|
||||||
|
@ -103,46 +102,6 @@ namespace SkiaSharp
|
||||||
return recorder.EndRecording ();
|
return recorder.EndRecording ();
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKManagedDrawableDrawProxyDelegate))]
|
|
||||||
private static void DrawInternal (IntPtr d, void* 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)
|
|
||||||
{
|
|
||||||
var drawable = DelegateProxies.GetUserData<SKDrawable> ((IntPtr)context, out _);
|
|
||||||
var bounds = drawable.OnGetBounds ();
|
|
||||||
*rect = bounds;
|
|
||||||
}
|
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKManagedDrawableApproximateBytesUsedProxyDelegate))]
|
|
||||||
private static IntPtr ApproximateBytesUsedInternal (IntPtr d, void* context)
|
|
||||||
{
|
|
||||||
var drawable = DelegateProxies.GetUserData<SKDrawable> ((IntPtr)context, out _);
|
|
||||||
return (IntPtr)drawable.OnGetApproximateBytesUsed ();
|
|
||||||
}
|
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKManagedDrawableMakePictureSnapshotProxyDelegate))]
|
|
||||||
private static IntPtr MakePictureSnapshotInternal (IntPtr d, void* 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)
|
|
||||||
{
|
|
||||||
var drawable = DelegateProxies.GetUserData<SKDrawable> ((IntPtr)context, out var gch);
|
|
||||||
if (drawable != null) {
|
|
||||||
Interlocked.Exchange (ref drawable.fromNative, 1);
|
|
||||||
drawable.Dispose ();
|
|
||||||
}
|
|
||||||
gch.Free ();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static SKDrawable GetObject (IntPtr handle) =>
|
internal static SKDrawable GetObject (IntPtr handle) =>
|
||||||
GetOrAddObject (handle, (h, o) => new SKDrawable (h, o));
|
GetOrAddObject (handle, (h, o) => new SKDrawable (h, o));
|
||||||
}
|
}
|
||||||
|
|
|
@ -793,7 +793,8 @@ namespace SkiaSharp
|
||||||
|
|
||||||
public void GetGlyphPaths (ReadOnlySpan<ushort> glyphs, SKGlyphPathDelegate glyphPathDelegate)
|
public void GetGlyphPaths (ReadOnlySpan<ushort> glyphs, SKGlyphPathDelegate glyphPathDelegate)
|
||||||
{
|
{
|
||||||
var proxy = DelegateProxies.Create (glyphPathDelegate, DelegateProxies.SKGlyphPathDelegateProxy, out var gch, out var ctx);
|
DelegateProxies.Create (glyphPathDelegate, out var gch, out var ctx);
|
||||||
|
var proxy = glyphPathDelegate is not null ? DelegateProxies.SKGlyphPathProxy : null;
|
||||||
try {
|
try {
|
||||||
fixed (ushort* g = glyphs) {
|
fixed (ushort* g = glyphs) {
|
||||||
SkiaApi.sk_font_get_paths (Handle, g, glyphs.Length, proxy, (void*)ctx);
|
SkiaApi.sk_font_get_paths (Handle, g, glyphs.Length, proxy, (void*)ctx);
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace SkiaSharp
|
||||||
base.DisposeManaged ();
|
base.DisposeManaged ();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IntPtr OnRead (IntPtr buffer, IntPtr size)
|
protected internal override IntPtr OnRead (IntPtr buffer, IntPtr size)
|
||||||
{
|
{
|
||||||
var start = offset;
|
var start = offset;
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ namespace SkiaSharp
|
||||||
return (IntPtr)(offset - start);
|
return (IntPtr)(offset - start);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IntPtr OnPeek (IntPtr buffer, IntPtr size)
|
protected internal override IntPtr OnPeek (IntPtr buffer, IntPtr size)
|
||||||
{
|
{
|
||||||
if (offset >= bufferLength)
|
if (offset >= bufferLength)
|
||||||
{
|
{
|
||||||
|
@ -143,7 +143,7 @@ namespace SkiaSharp
|
||||||
return (IntPtr)bytesRead;
|
return (IntPtr)bytesRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnIsAtEnd ()
|
protected internal override bool OnIsAtEnd ()
|
||||||
{
|
{
|
||||||
if (offset < bufferedSoFar)
|
if (offset < bufferedSoFar)
|
||||||
{
|
{
|
||||||
|
@ -155,7 +155,7 @@ namespace SkiaSharp
|
||||||
return stream.IsAtEnd;
|
return stream.IsAtEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnRewind ()
|
protected internal override bool OnRewind ()
|
||||||
{
|
{
|
||||||
// only allow a rewind if we have not exceeded the buffer.
|
// only allow a rewind if we have not exceeded the buffer.
|
||||||
if (offset <= bufferLength)
|
if (offset <= bufferLength)
|
||||||
|
@ -167,23 +167,23 @@ namespace SkiaSharp
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHasLength () => hasLength;
|
protected internal override bool OnHasLength () => hasLength;
|
||||||
|
|
||||||
protected override IntPtr OnGetLength () => (IntPtr)streamLength;
|
protected internal override IntPtr OnGetLength () => (IntPtr)streamLength;
|
||||||
|
|
||||||
// seeking is not supported
|
// seeking is not supported
|
||||||
protected override bool OnHasPosition () => false;
|
protected internal override bool OnHasPosition () => false;
|
||||||
|
|
||||||
// seeking is not supported
|
// seeking is not supported
|
||||||
protected override IntPtr OnGetPosition () => (IntPtr)0;
|
protected internal override IntPtr OnGetPosition () => (IntPtr)0;
|
||||||
|
|
||||||
// seeking is not supported
|
// seeking is not supported
|
||||||
protected override bool OnSeek (IntPtr position) => false;
|
protected internal override bool OnSeek (IntPtr position) => false;
|
||||||
|
|
||||||
// seeking is not supported
|
// seeking is not supported
|
||||||
protected override bool OnMove (int offset) => false;
|
protected internal override bool OnMove (int offset) => false;
|
||||||
|
|
||||||
// duplicating or forking is not supported
|
// duplicating or forking is not supported
|
||||||
protected override IntPtr OnCreateNew () => IntPtr.Zero;
|
protected internal override IntPtr OnCreateNew () => IntPtr.Zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace SkiaSharp
|
||||||
var pixels = Marshal.AllocCoTaskMem (info.BytesSize);
|
var pixels = Marshal.AllocCoTaskMem (info.BytesSize);
|
||||||
using (var pixmap = new SKPixmap (info, pixels)) {
|
using (var pixmap = new SKPixmap (info, pixels)) {
|
||||||
// don't use the managed version as that is just extra overhead which isn't necessary
|
// don't use the managed version as that is just extra overhead which isn't necessary
|
||||||
return GetObject (SkiaApi.sk_image_new_raster (pixmap.Handle, DelegateProxies.SKImageRasterReleaseDelegateProxyForCoTaskMem, null));
|
return GetObject (SkiaApi.sk_image_new_raster (pixmap.Handle, DelegateProxies.SKImageRasterReleaseProxyForCoTaskMem, null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +148,8 @@ namespace SkiaSharp
|
||||||
var del = releaseProc != null && releaseContext != null
|
var del = releaseProc != null && releaseContext != null
|
||||||
? new SKImageRasterReleaseDelegate ((addr, _) => releaseProc (addr, releaseContext))
|
? new SKImageRasterReleaseDelegate ((addr, _) => releaseProc (addr, releaseContext))
|
||||||
: releaseProc;
|
: releaseProc;
|
||||||
var proxy = DelegateProxies.Create (del, DelegateProxies.SKImageRasterReleaseDelegateProxy, out _, out var ctx);
|
DelegateProxies.Create (del, out _, out var ctx);
|
||||||
|
var proxy = del is not null ? DelegateProxies.SKImageRasterReleaseProxy : null;
|
||||||
return GetObject (SkiaApi.sk_image_new_raster (pixmap.Handle, proxy, (void*)ctx));
|
return GetObject (SkiaApi.sk_image_new_raster (pixmap.Handle, proxy, (void*)ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,7 +290,8 @@ namespace SkiaSharp
|
||||||
var del = releaseProc != null && releaseContext != null
|
var del = releaseProc != null && releaseContext != null
|
||||||
? new SKImageTextureReleaseDelegate ((_) => releaseProc (releaseContext))
|
? new SKImageTextureReleaseDelegate ((_) => releaseProc (releaseContext))
|
||||||
: releaseProc;
|
: releaseProc;
|
||||||
var proxy = DelegateProxies.Create (del, DelegateProxies.SKImageTextureReleaseDelegateProxy, out _, out var ctx);
|
DelegateProxies.Create (del, out _, out var ctx);
|
||||||
|
var proxy = del is not null ? DelegateProxies.SKImageTextureReleaseProxy : null;
|
||||||
return GetObject (SkiaApi.sk_image_new_from_texture (context.Handle, texture.Handle, origin, colorType.ToNative (), alpha, cs, proxy, (void*)ctx));
|
return GetObject (SkiaApi.sk_image_new_from_texture (context.Handle, texture.Handle, origin, colorType.ToNative (), alpha, cs, proxy, (void*)ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,14 +111,14 @@ namespace SkiaSharp
|
||||||
return (IntPtr)len;
|
return (IntPtr)len;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IntPtr OnRead (IntPtr buffer, IntPtr size)
|
protected internal override IntPtr OnRead (IntPtr buffer, IntPtr size)
|
||||||
{
|
{
|
||||||
VerifyOriginal ();
|
VerifyOriginal ();
|
||||||
|
|
||||||
return OnReadManagedStream (buffer, size);
|
return OnReadManagedStream (buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IntPtr OnPeek (IntPtr buffer, IntPtr size)
|
protected internal override IntPtr OnPeek (IntPtr buffer, IntPtr size)
|
||||||
{
|
{
|
||||||
VerifyOriginal ();
|
VerifyOriginal ();
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ namespace SkiaSharp
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnIsAtEnd ()
|
protected internal override bool OnIsAtEnd ()
|
||||||
{
|
{
|
||||||
VerifyOriginal ();
|
VerifyOriginal ();
|
||||||
|
|
||||||
|
@ -141,21 +141,21 @@ namespace SkiaSharp
|
||||||
return stream.Position >= stream.Length;
|
return stream.Position >= stream.Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHasPosition ()
|
protected internal override bool OnHasPosition ()
|
||||||
{
|
{
|
||||||
VerifyOriginal ();
|
VerifyOriginal ();
|
||||||
|
|
||||||
return stream.CanSeek;
|
return stream.CanSeek;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHasLength ()
|
protected internal override bool OnHasLength ()
|
||||||
{
|
{
|
||||||
VerifyOriginal ();
|
VerifyOriginal ();
|
||||||
|
|
||||||
return stream.CanSeek;
|
return stream.CanSeek;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnRewind ()
|
protected internal override bool OnRewind ()
|
||||||
{
|
{
|
||||||
VerifyOriginal ();
|
VerifyOriginal ();
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ namespace SkiaSharp
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IntPtr OnGetPosition ()
|
protected internal override IntPtr OnGetPosition ()
|
||||||
{
|
{
|
||||||
VerifyOriginal ();
|
VerifyOriginal ();
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ namespace SkiaSharp
|
||||||
return (IntPtr)stream.Position;
|
return (IntPtr)stream.Position;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IntPtr OnGetLength ()
|
protected internal override IntPtr OnGetLength ()
|
||||||
{
|
{
|
||||||
VerifyOriginal ();
|
VerifyOriginal ();
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ namespace SkiaSharp
|
||||||
return (IntPtr)stream.Length;
|
return (IntPtr)stream.Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnSeek (IntPtr position)
|
protected internal override bool OnSeek (IntPtr position)
|
||||||
{
|
{
|
||||||
VerifyOriginal ();
|
VerifyOriginal ();
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ namespace SkiaSharp
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMove (int offset)
|
protected internal override bool OnMove (int offset)
|
||||||
{
|
{
|
||||||
VerifyOriginal ();
|
VerifyOriginal ();
|
||||||
|
|
||||||
|
@ -208,14 +208,14 @@ namespace SkiaSharp
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IntPtr OnCreateNew ()
|
protected internal override IntPtr OnCreateNew ()
|
||||||
{
|
{
|
||||||
VerifyOriginal ();
|
VerifyOriginal ();
|
||||||
|
|
||||||
return IntPtr.Zero;
|
return IntPtr.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IntPtr OnDuplicate ()
|
protected internal override IntPtr OnDuplicate ()
|
||||||
{
|
{
|
||||||
VerifyOriginal ();
|
VerifyOriginal ();
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ namespace SkiaSharp
|
||||||
return newStream.Handle;
|
return newStream.Handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IntPtr OnFork ()
|
protected internal override IntPtr OnFork ()
|
||||||
{
|
{
|
||||||
VerifyOriginal ();
|
VerifyOriginal ();
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace SkiaSharp
|
||||||
base.DisposeManaged ();
|
base.DisposeManaged ();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnWrite (IntPtr buffer, IntPtr size)
|
protected internal override bool OnWrite (IntPtr buffer, IntPtr size)
|
||||||
{
|
{
|
||||||
var count = (int)size;
|
var count = (int)size;
|
||||||
using var managedBuffer = Utils.RentArray<byte> (count);
|
using var managedBuffer = Utils.RentArray<byte> (count);
|
||||||
|
@ -53,12 +53,12 @@ namespace SkiaSharp
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnFlush ()
|
protected internal override void OnFlush ()
|
||||||
{
|
{
|
||||||
stream.Flush ();
|
stream.Flush ();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IntPtr OnBytesWritten ()
|
protected internal override IntPtr OnBytesWritten ()
|
||||||
{
|
{
|
||||||
return (IntPtr)stream.Position;
|
return (IntPtr)stream.Position;
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,24 +206,6 @@ namespace SkiaSharp
|
||||||
|
|
||||||
return owner;
|
return owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static T[] PtrToStructureArray<T> (IntPtr intPtr, int count)
|
|
||||||
{
|
|
||||||
var items = new T[count];
|
|
||||||
var size = Marshal.SizeOf<T> ();
|
|
||||||
for (var i = 0; i < count; i++) {
|
|
||||||
var newPtr = new IntPtr (intPtr.ToInt64 () + (i * size));
|
|
||||||
items[i] = Marshal.PtrToStructure<T> (newPtr);
|
|
||||||
}
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static T PtrToStructure<T> (IntPtr intPtr, int index)
|
|
||||||
{
|
|
||||||
var size = Marshal.SizeOf<T> ();
|
|
||||||
var newPtr = new IntPtr (intPtr.ToInt64 () + (index * size));
|
|
||||||
return Marshal.PtrToStructure<T> (newPtr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class SKNativeObject : IDisposable
|
public abstract class SKNativeObject : IDisposable
|
||||||
|
|
|
@ -68,7 +68,8 @@ namespace SkiaSharp
|
||||||
var del = releaseProc != null && context != null
|
var del = releaseProc != null && context != null
|
||||||
? new SKSurfaceReleaseDelegate ((addr, _) => releaseProc (addr, context))
|
? new SKSurfaceReleaseDelegate ((addr, _) => releaseProc (addr, context))
|
||||||
: releaseProc;
|
: releaseProc;
|
||||||
var proxy = DelegateProxies.Create (del, DelegateProxies.SKSurfaceReleaseDelegateProxy, out _, out var ctx);
|
DelegateProxies.Create (del, out _, out var ctx);
|
||||||
|
var proxy = del != null ? DelegateProxies.SKSurfaceRasterReleaseProxy : null;
|
||||||
return GetObject (SkiaApi.sk_surface_new_raster_direct (&cinfo, (void*)pixels, (IntPtr)rowBytes, proxy, (void*)ctx, props?.Handle ?? IntPtr.Zero));
|
return GetObject (SkiaApi.sk_surface_new_raster_direct (&cinfo, (void*)pixels, (IntPtr)rowBytes, proxy, (void*)ctx, props?.Handle ?? IntPtr.Zero));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace SkiaSharp
|
namespace SkiaSharp
|
||||||
{
|
{
|
||||||
|
@ -13,8 +12,8 @@ namespace SkiaSharp
|
||||||
static SKTraceMemoryDump ()
|
static SKTraceMemoryDump ()
|
||||||
{
|
{
|
||||||
delegates = new SKManagedTraceMemoryDumpDelegates {
|
delegates = new SKManagedTraceMemoryDumpDelegates {
|
||||||
fDumpNumericValue = DumpNumericValueInternal,
|
fDumpNumericValue = DelegateProxies.SKManagedTraceMemoryDumpDumpNumericValueProxy,
|
||||||
fDumpStringValue = DumpStringValueInternal,
|
fDumpStringValue = DelegateProxies.SKManagedTraceMemoryDumpDumpStringValueProxy,
|
||||||
};
|
};
|
||||||
|
|
||||||
SkiaApi.sk_managedtracememorydump_set_procs (delegates);
|
SkiaApi.sk_managedtracememorydump_set_procs (delegates);
|
||||||
|
@ -39,35 +38,12 @@ namespace SkiaSharp
|
||||||
gch.Free ();
|
gch.Free ();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnDumpNumericValue (string dumpName, string valueName, string units, ulong value)
|
protected internal virtual void OnDumpNumericValue (string dumpName, string valueName, string units, ulong value)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnDumpStringValue (string dumpName, string valueName, string value)
|
protected internal virtual void OnDumpStringValue (string dumpName, string valueName, string value)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// impl
|
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKManagedTraceMemoryDumpDumpNumericValueProxyDelegate))]
|
|
||||||
private static void DumpNumericValueInternal (IntPtr d, void* context, void* dumpName, void* valueName, void* units, ulong value)
|
|
||||||
{
|
|
||||||
var dump = DelegateProxies.GetUserData<SKTraceMemoryDump> ((IntPtr)context, out _);
|
|
||||||
dump.OnDumpNumericValue (
|
|
||||||
Marshal.PtrToStringAnsi ((IntPtr)dumpName),
|
|
||||||
Marshal.PtrToStringAnsi ((IntPtr)valueName),
|
|
||||||
Marshal.PtrToStringAnsi ((IntPtr)units),
|
|
||||||
value);
|
|
||||||
}
|
|
||||||
|
|
||||||
[MonoPInvokeCallback (typeof (SKManagedTraceMemoryDumpDumpStringValueProxyDelegate))]
|
|
||||||
private static void DumpStringValueInternal (IntPtr d, void* context, void* dumpName, void* valueName, void* value)
|
|
||||||
{
|
|
||||||
var dump = DelegateProxies.GetUserData<SKTraceMemoryDump> ((IntPtr)context, out _);
|
|
||||||
dump.OnDumpStringValue (
|
|
||||||
Marshal.PtrToStringAnsi ((IntPtr)dumpName),
|
|
||||||
Marshal.PtrToStringAnsi ((IntPtr)valueName),
|
|
||||||
Marshal.PtrToStringAnsi ((IntPtr)value));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -6,10 +6,15 @@
|
||||||
<PackagingGroup>SkiaSharp</PackagingGroup>
|
<PackagingGroup>SkiaSharp</PackagingGroup>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
|
||||||
|
<WarningsAsErrors>$(WarningsAsErrors);CA1420;CA1421;</WarningsAsErrors>
|
||||||
|
<NoWarn>$(NoWarn);CS8826</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))">
|
<PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))">
|
||||||
<DefineConstants>$(DefineConstants);USE_DELEGATES</DefineConstants>
|
<DefineConstants>$(DefineConstants);USE_DELEGATES</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">
|
||||||
|
<DefineConstants>$(DefineConstants);USE_LIBRARY_IMPORT</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup Condition="'$(BuildingInsideVisualStudio)' != 'true'">
|
<ItemGroup Condition="'$(BuildingInsideVisualStudio)' != 'true'">
|
||||||
<ProjectReference Include="..\SkiaSharp.NativeAssets.Android\SkiaSharp.NativeAssets.Android.csproj" Condition="$(TargetFramework.Contains('-android'))" />
|
<ProjectReference Include="..\SkiaSharp.NativeAssets.Android\SkiaSharp.NativeAssets.Android.csproj" Condition="$(TargetFramework.Contains('-android'))" />
|
||||||
<ProjectReference Include="..\SkiaSharp.NativeAssets.iOS\SkiaSharp.NativeAssets.iOS.csproj" Condition="$(TargetFramework.Contains('-ios'))" />
|
<ProjectReference Include="..\SkiaSharp.NativeAssets.iOS\SkiaSharp.NativeAssets.iOS.csproj" Condition="$(TargetFramework.Contains('-ios'))" />
|
||||||
|
|
|
@ -231,6 +231,11 @@
|
||||||
"-1": "int"
|
"-1": "int"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"hb_unicode_combining_category_func_t": {
|
||||||
|
"parameters": {
|
||||||
|
"-1": "int"
|
||||||
|
}
|
||||||
|
},
|
||||||
"hb_font_get_glyph_from_name": {
|
"hb_font_get_glyph_from_name": {
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"1": "[MarshalAs (UnmanagedType.LPStr)] String"
|
"1": "[MarshalAs (UnmanagedType.LPStr)] String"
|
||||||
|
@ -265,6 +270,23 @@
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"1": "[MarshalAs (UnmanagedType.LPStr)] String"
|
"1": "[MarshalAs (UnmanagedType.LPStr)] String"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"hb_destroy_func_t": {
|
||||||
|
"proxySuffixes": [
|
||||||
|
"", "ForMulti"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"hb_unicode_decompose_compatibility_func_t": {
|
||||||
|
"generateProxy": false
|
||||||
|
},
|
||||||
|
"hb_unicode_eastasian_width_func_t": {
|
||||||
|
"generateProxy": false
|
||||||
|
},
|
||||||
|
"hb_buffer_message_func_t": {
|
||||||
|
"generateProxy": false
|
||||||
|
},
|
||||||
|
"hb_font_get_glyph_func_t": {
|
||||||
|
"generateProxy": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -405,6 +405,9 @@
|
||||||
},
|
},
|
||||||
"functions": {
|
"functions": {
|
||||||
// delegates
|
// delegates
|
||||||
|
"gr_gl_func_ptr": {
|
||||||
|
"generateProxy": false
|
||||||
|
},
|
||||||
"gr_gl_get_proc": {
|
"gr_gl_get_proc": {
|
||||||
"cs": "GRGlGetProcProxyDelegate",
|
"cs": "GRGlGetProcProxyDelegate",
|
||||||
"parameters": {
|
"parameters": {
|
||||||
|
@ -412,7 +415,8 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"gr_vk_func_ptr": {
|
"gr_vk_func_ptr": {
|
||||||
"convention": "stdcall"
|
"convention": "stdcall",
|
||||||
|
"generateProxy": false
|
||||||
},
|
},
|
||||||
"gr_vk_get_proc": {
|
"gr_vk_get_proc": {
|
||||||
"cs": "GRVkGetProcProxyDelegate",
|
"cs": "GRVkGetProcProxyDelegate",
|
||||||
|
@ -479,6 +483,11 @@
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"1": "[MarshalAs (UnmanagedType.LPStr)] String"
|
"1": "[MarshalAs (UnmanagedType.LPStr)] String"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"sk_image_raster_release_proc": {
|
||||||
|
"proxySuffixes": [
|
||||||
|
"", "ForCoTaskMem"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,10 @@
|
||||||
<Platforms>AnyCPU;x64;x86</Platforms>
|
<Platforms>AnyCPU;x64;x86</Platforms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">
|
||||||
|
<DefineConstants>$(DefineConstants);USE_LIBRARY_IMPORT</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.2" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.2" />
|
||||||
<PackageReference Include="xunit" Version="2.4.2" />
|
<PackageReference Include="xunit" Version="2.4.2" />
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
<SignAssembly>false</SignAssembly>
|
<SignAssembly>false</SignAssembly>
|
||||||
<SkipGenerateAssemblyVersionInfo>true</SkipGenerateAssemblyVersionInfo>
|
<SkipGenerateAssemblyVersionInfo>true</SkipGenerateAssemblyVersionInfo>
|
||||||
<SkipMDocGenerateDocs>true</SkipMDocGenerateDocs>
|
<SkipMDocGenerateDocs>true</SkipMDocGenerateDocs>
|
||||||
|
<DefineConstants>$(DefineConstants);USE_LIBRARY_IMPORT</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<AssemblyName>SkiaSharp.Tests</AssemblyName>
|
<AssemblyName>SkiaSharp.Tests</AssemblyName>
|
||||||
<SkipGenerateAssemblyVersionInfo>true</SkipGenerateAssemblyVersionInfo>
|
<SkipGenerateAssemblyVersionInfo>true</SkipGenerateAssemblyVersionInfo>
|
||||||
<SkipMDocGenerateDocs>true</SkipMDocGenerateDocs>
|
<SkipMDocGenerateDocs>true</SkipMDocGenerateDocs>
|
||||||
|
<DefineConstants>$(DefineConstants);USE_LIBRARY_IMPORT</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>$(TFMCurrent)</TargetFrameworks>
|
<TargetFrameworks>$(TFMCurrent)</TargetFrameworks>
|
||||||
<DefineConstants>$(DefineConstants);USE_LIBRARY_LOADER</DefineConstants>
|
<DefineConstants>$(DefineConstants);USE_LIBRARY_LOADER;USE_LIBRARY_IMPORT</DefineConstants>
|
||||||
<RootNamespace>SkiaSharp.Tests</RootNamespace>
|
<RootNamespace>SkiaSharp.Tests</RootNamespace>
|
||||||
<AssemblyName>SkiaSharp.Tests</AssemblyName>
|
<AssemblyName>SkiaSharp.Tests</AssemblyName>
|
||||||
<SkipGenerateAssemblyVersionInfo>true</SkipGenerateAssemblyVersionInfo>
|
<SkipGenerateAssemblyVersionInfo>true</SkipGenerateAssemblyVersionInfo>
|
||||||
|
|
|
@ -61,9 +61,15 @@ namespace SkiaSharp.Tests
|
||||||
public void DelegateTypesAreValid()
|
public void DelegateTypesAreValid()
|
||||||
{
|
{
|
||||||
var del = InteropDelegatesData;
|
var del = InteropDelegatesData;
|
||||||
|
#if USE_LIBRARY_IMPORT
|
||||||
|
// Targets using USE_LIBRARY_IMPORT don't have delegates generated as they are not used.
|
||||||
|
Assert.Empty(del);
|
||||||
|
#else
|
||||||
Assert.NotEmpty(del);
|
Assert.NotEmpty(del);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !USE_LIBRARY_IMPORT
|
||||||
[Trait(Traits.Category.Key, Traits.Category.Values.Api)]
|
[Trait(Traits.Category.Key, Traits.Category.Values.Api)]
|
||||||
[SkippableTheory]
|
[SkippableTheory]
|
||||||
[MemberData(nameof(InteropDelegatesData))]
|
[MemberData(nameof(InteropDelegatesData))]
|
||||||
|
@ -71,6 +77,7 @@ namespace SkiaSharp.Tests
|
||||||
{
|
{
|
||||||
Assert.NotNull(delegateType.GetCustomAttribute<UnmanagedFunctionPointerAttribute>());
|
Assert.NotNull(delegateType.GetCustomAttribute<UnmanagedFunctionPointerAttribute>());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
[Trait(Traits.Category.Key, Traits.Category.Values.Api)]
|
[Trait(Traits.Category.Key, Traits.Category.Values.Api)]
|
||||||
[SkippableTheory]
|
[SkippableTheory]
|
||||||
|
|
|
@ -4,26 +4,26 @@ namespace SkiaSharp.Tests
|
||||||
{
|
{
|
||||||
public class ManagedStream : SKAbstractManagedStream
|
public class ManagedStream : SKAbstractManagedStream
|
||||||
{
|
{
|
||||||
protected override IntPtr OnRead (IntPtr buffer, IntPtr size) => (IntPtr)0;
|
protected internal override IntPtr OnRead (IntPtr buffer, IntPtr size) => (IntPtr)0;
|
||||||
|
|
||||||
protected override IntPtr OnPeek (IntPtr buffer, IntPtr size) => (IntPtr)0;
|
protected internal override IntPtr OnPeek (IntPtr buffer, IntPtr size) => (IntPtr)0;
|
||||||
|
|
||||||
protected override bool OnIsAtEnd () => false;
|
protected internal override bool OnIsAtEnd () => false;
|
||||||
|
|
||||||
protected override bool OnHasPosition () => false;
|
protected internal override bool OnHasPosition () => false;
|
||||||
|
|
||||||
protected override bool OnHasLength () => false;
|
protected internal override bool OnHasLength () => false;
|
||||||
|
|
||||||
protected override bool OnRewind () => false;
|
protected internal override bool OnRewind () => false;
|
||||||
|
|
||||||
protected override IntPtr OnGetPosition () => (IntPtr)0;
|
protected internal override IntPtr OnGetPosition () => (IntPtr)0;
|
||||||
|
|
||||||
protected override IntPtr OnGetLength () => (IntPtr)0;
|
protected internal override IntPtr OnGetLength () => (IntPtr)0;
|
||||||
|
|
||||||
protected override bool OnSeek (IntPtr position) => false;
|
protected internal override bool OnSeek (IntPtr position) => false;
|
||||||
|
|
||||||
protected override bool OnMove (int offset) => false;
|
protected internal override bool OnMove (int offset) => false;
|
||||||
|
|
||||||
protected override IntPtr OnCreateNew () => IntPtr.Zero;
|
protected internal override IntPtr OnCreateNew () => IntPtr.Zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,28 +107,28 @@ namespace SkiaSharp.Tests
|
||||||
public int SnapshotFireCount;
|
public int SnapshotFireCount;
|
||||||
public int ApproxBytesCount;
|
public int ApproxBytesCount;
|
||||||
|
|
||||||
protected override void OnDraw(SKCanvas canvas)
|
protected internal override void OnDraw(SKCanvas canvas)
|
||||||
{
|
{
|
||||||
DrawFireCount++;
|
DrawFireCount++;
|
||||||
|
|
||||||
canvas.DrawColor(SKColors.Blue);
|
canvas.DrawColor(SKColors.Blue);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override SKRect OnGetBounds()
|
protected internal override SKRect OnGetBounds()
|
||||||
{
|
{
|
||||||
BoundsFireCount++;
|
BoundsFireCount++;
|
||||||
|
|
||||||
return SKRect.Create(100, 100);
|
return SKRect.Create(100, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override SKPicture OnSnapshot()
|
protected internal override SKPicture OnSnapshot()
|
||||||
{
|
{
|
||||||
SnapshotFireCount++;
|
SnapshotFireCount++;
|
||||||
|
|
||||||
return base.OnSnapshot();
|
return base.OnSnapshot();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override int OnGetApproximateBytesUsed ()
|
protected internal override int OnGetApproximateBytesUsed ()
|
||||||
{
|
{
|
||||||
ApproxBytesCount++;
|
ApproxBytesCount++;
|
||||||
|
|
||||||
|
|
|
@ -182,9 +182,9 @@ namespace SkiaSharp.Tests
|
||||||
fHasPosition = hasPosition;
|
fHasPosition = hasPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHasLength () => fHasLength;
|
protected internal override bool OnHasLength () => fHasLength;
|
||||||
|
|
||||||
protected override bool OnHasPosition () => fHasPosition;
|
protected internal override bool OnHasPosition () => fHasPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
[SkippableTheory]
|
[SkippableTheory]
|
||||||
|
@ -222,9 +222,9 @@ namespace SkiaSharp.Tests
|
||||||
{
|
{
|
||||||
private bool fAtEnd;
|
private bool fAtEnd;
|
||||||
|
|
||||||
protected override bool OnIsAtEnd () => fAtEnd;
|
protected internal override bool OnIsAtEnd () => fAtEnd;
|
||||||
|
|
||||||
protected override IntPtr OnRead (IntPtr buffer, IntPtr size)
|
protected internal override IntPtr OnRead (IntPtr buffer, IntPtr size)
|
||||||
{
|
{
|
||||||
Assert.False (fAtEnd);
|
Assert.False (fAtEnd);
|
||||||
fAtEnd = true;
|
fAtEnd = true;
|
||||||
|
|
|
@ -140,10 +140,10 @@ namespace SkiaSharp.Tests
|
||||||
|
|
||||||
public List<string> Lines { get; } = new List<string>();
|
public List<string> Lines { get; } = new List<string>();
|
||||||
|
|
||||||
protected override void OnDumpNumericValue(string dumpName, string valueName, string units, ulong value) =>
|
protected internal override void OnDumpNumericValue(string dumpName, string valueName, string units, ulong value) =>
|
||||||
Lines.Add($"{dumpName}.{valueName} = {value} {units}");
|
Lines.Add($"{dumpName}.{valueName} = {value} {units}");
|
||||||
|
|
||||||
protected override void OnDumpStringValue(string dumpName, string valueName, string value) =>
|
protected internal override void OnDumpStringValue(string dumpName, string valueName, string value) =>
|
||||||
Lines.Add($"{dumpName}.{valueName} = '{value}'");
|
Lines.Add($"{dumpName}.{valueName} = '{value}'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,6 +191,67 @@ namespace SkiaSharpGenerator
|
||||||
return config ?? throw new InvalidOperationException("Unable to parse json config file.");
|
return config ?? throw new InvalidOperationException("Unable to parse json config file.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected (List<string> args, string returnType) GetManagedFunctionArguments(CppFunctionType function, FunctionMapping? map)
|
||||||
|
{
|
||||||
|
var paramsList = new List<string>();
|
||||||
|
for (var i = 0; i < function.Parameters.Count; i++)
|
||||||
|
{
|
||||||
|
var p = function.Parameters[i];
|
||||||
|
var n = string.IsNullOrEmpty(p.Name) ? $"param{i}" : p.Name;
|
||||||
|
var t = GetType(p.Type);
|
||||||
|
var cppT = GetCppType(p.Type);
|
||||||
|
if (t == "Boolean" || cppT == "bool")
|
||||||
|
t = "[MarshalAs (UnmanagedType.I1)] bool";
|
||||||
|
if (map != null && map.Parameters.TryGetValue(i.ToString(), out var newT))
|
||||||
|
t = newT;
|
||||||
|
paramsList.Add($"{t} {n}");
|
||||||
|
}
|
||||||
|
|
||||||
|
var returnType = GetType(function.ReturnType);
|
||||||
|
if (map != null && map.Parameters.TryGetValue("-1", out var newR))
|
||||||
|
{
|
||||||
|
returnType = newR;
|
||||||
|
}
|
||||||
|
else if (returnType == "Boolean" || GetCppType(function.ReturnType) == "bool")
|
||||||
|
{
|
||||||
|
returnType = "bool";
|
||||||
|
}
|
||||||
|
return (paramsList, returnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected string? GetFunctionPointerType(CppType type, FunctionMapping? map = null)
|
||||||
|
{
|
||||||
|
if (map is null)
|
||||||
|
{
|
||||||
|
functionMappings.TryGetValue(type.GetDisplayName(), out map);
|
||||||
|
}
|
||||||
|
|
||||||
|
type = (type as CppQualifiedType)?.ElementType as CppTypedef ?? type;
|
||||||
|
type = (type as CppTypedef)?.ElementType as CppTypedef ?? type;
|
||||||
|
type = (type as CppTypedef)?.ElementType as CppPointerType ?? type;
|
||||||
|
type = (type as CppPointerType)?.ElementType as CppFunctionType ?? type;
|
||||||
|
if (type is CppFunctionType { CallingConvention: CppCallingConvention.C } function)
|
||||||
|
{
|
||||||
|
var parameters = string.Join(", ", function.Parameters
|
||||||
|
.Select((p, i) => (p.Type, i))
|
||||||
|
.Concat(new[] { (function.ReturnType, -1) })
|
||||||
|
.Select(tuple =>
|
||||||
|
{
|
||||||
|
var (cppType, i) = tuple;
|
||||||
|
var t = GetType(cppType);
|
||||||
|
var cppT = GetCppType(cppType);
|
||||||
|
if (t == "Boolean" || cppT == "bool")
|
||||||
|
t = "bool";
|
||||||
|
if (map != null && map.Parameters.TryGetValue(i.ToString(), out var newT))
|
||||||
|
t = newT;
|
||||||
|
return t;
|
||||||
|
}));
|
||||||
|
return $"delegate* unmanaged[Cdecl] <{parameters}>";
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
protected string GetType(CppType type)
|
protected string GetType(CppType type)
|
||||||
{
|
{
|
||||||
var typeName = GetCppType(type);
|
var typeName = GetCppType(type);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace SkiaSharpGenerator
|
namespace SkiaSharpGenerator
|
||||||
|
@ -10,5 +11,11 @@ namespace SkiaSharpGenerator
|
||||||
|
|
||||||
[JsonPropertyName("parameters")]
|
[JsonPropertyName("parameters")]
|
||||||
public Dictionary<string, string> Parameters { get; set; } = new Dictionary<string, string>();
|
public Dictionary<string, string> Parameters { get; set; } = new Dictionary<string, string>();
|
||||||
|
|
||||||
|
[JsonPropertyName("generateProxy")]
|
||||||
|
public bool? GenerateProxy { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("proxySuffixes")]
|
||||||
|
public List<string>? ProxySuffixes { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ namespace SkiaSharpGenerator
|
||||||
|
|
||||||
writer.WriteLine("using System;");
|
writer.WriteLine("using System;");
|
||||||
writer.WriteLine("using System.Runtime.InteropServices;");
|
writer.WriteLine("using System.Runtime.InteropServices;");
|
||||||
|
writer.WriteLine("using System.Runtime.CompilerServices;");
|
||||||
writer.WriteLine();
|
writer.WriteLine();
|
||||||
WriteNamespaces(writer);
|
WriteNamespaces(writer);
|
||||||
writer.WriteLine();
|
writer.WriteLine();
|
||||||
|
@ -62,6 +63,8 @@ namespace SkiaSharpGenerator
|
||||||
WriteStructs(writer);
|
WriteStructs(writer);
|
||||||
writer.WriteLine();
|
writer.WriteLine();
|
||||||
WriteEnums(writer);
|
WriteEnums(writer);
|
||||||
|
writer.WriteLine();
|
||||||
|
WriteDelegateProxies(writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WriteDelegates(TextWriter writer)
|
private void WriteDelegates(TextWriter writer)
|
||||||
|
@ -69,6 +72,7 @@ namespace SkiaSharpGenerator
|
||||||
Log?.LogVerbose(" Writing delegates...");
|
Log?.LogVerbose(" Writing delegates...");
|
||||||
|
|
||||||
writer.WriteLine($"#region Delegates");
|
writer.WriteLine($"#region Delegates");
|
||||||
|
writer.WriteLine($"#if !USE_LIBRARY_IMPORT");
|
||||||
|
|
||||||
var delegates = compilation.Typedefs
|
var delegates = compilation.Typedefs
|
||||||
.Where(t => t.ElementType.TypeKind == CppTypeKind.Pointer)
|
.Where(t => t.ElementType.TypeKind == CppTypeKind.Pointer)
|
||||||
|
@ -90,6 +94,7 @@ namespace SkiaSharpGenerator
|
||||||
}
|
}
|
||||||
|
|
||||||
writer.WriteLine();
|
writer.WriteLine();
|
||||||
|
writer.WriteLine($"#endif // !USE_LIBRARY_IMPORT");
|
||||||
writer.WriteLine($"#endregion");
|
writer.WriteLine($"#endregion");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,28 +118,9 @@ namespace SkiaSharpGenerator
|
||||||
writer.WriteLine($"\t// {del}");
|
writer.WriteLine($"\t// {del}");
|
||||||
writer.WriteLine($"\t[UnmanagedFunctionPointer (CallingConvention.Cdecl)]");
|
writer.WriteLine($"\t[UnmanagedFunctionPointer (CallingConvention.Cdecl)]");
|
||||||
|
|
||||||
var paramsList = new List<string>();
|
var (paramsList, returnType) = GetManagedFunctionArguments(function, map);
|
||||||
for (var i = 0; i < function.Parameters.Count; i++)
|
if (returnType == "bool")
|
||||||
{
|
{
|
||||||
var p = function.Parameters[i];
|
|
||||||
var n = string.IsNullOrEmpty(p.Name) ? $"param{i}" : p.Name;
|
|
||||||
var t = GetType(p.Type);
|
|
||||||
var cppT = GetCppType(p.Type);
|
|
||||||
if (t == "Boolean" || cppT == "bool")
|
|
||||||
t = $"[MarshalAs (UnmanagedType.I1)] bool";
|
|
||||||
if (map != null && map.Parameters.TryGetValue(i.ToString(), out var newT))
|
|
||||||
t = newT;
|
|
||||||
paramsList.Add($"{t} {n}");
|
|
||||||
}
|
|
||||||
|
|
||||||
var returnType = GetType(function.ReturnType);
|
|
||||||
if (map != null && map.Parameters.TryGetValue("-1", out var newR))
|
|
||||||
{
|
|
||||||
returnType = newR;
|
|
||||||
}
|
|
||||||
else if (returnType == "Boolean" || GetCppType(function.ReturnType) == "bool")
|
|
||||||
{
|
|
||||||
returnType = "bool";
|
|
||||||
writer.WriteLine($"\t[return: MarshalAs (UnmanagedType.I1)]");
|
writer.WriteLine($"\t[return: MarshalAs (UnmanagedType.I1)]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,6 +184,7 @@ namespace SkiaSharpGenerator
|
||||||
foreach (var field in klass.Fields)
|
foreach (var field in klass.Fields)
|
||||||
{
|
{
|
||||||
var type = GetType(field.Type);
|
var type = GetType(field.Type);
|
||||||
|
var funcPointerType = GetFunctionPointerType(field.Type);
|
||||||
var cppT = GetCppType(field.Type);
|
var cppT = GetCppType(field.Type);
|
||||||
|
|
||||||
writer.WriteLine($"\t\t// {field}");
|
writer.WriteLine($"\t\t// {field}");
|
||||||
|
@ -212,7 +199,18 @@ namespace SkiaSharpGenerator
|
||||||
|
|
||||||
var vis = map?.IsInternal == true ? "public" : "private";
|
var vis = map?.IsInternal == true ? "public" : "private";
|
||||||
var ro = map?.IsReadOnly == true ? " readonly" : "";
|
var ro = map?.IsReadOnly == true ? " readonly" : "";
|
||||||
writer.WriteLine($"\t\t{vis}{ro} {type} {fieldName};");
|
if (funcPointerType is null)
|
||||||
|
{
|
||||||
|
writer.WriteLine($"\t\t{vis}{ro} {type} {fieldName};");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
writer.WriteLine($"#if USE_LIBRARY_IMPORT");
|
||||||
|
writer.WriteLine($"\t\t{vis}{ro} {funcPointerType} {fieldName};");
|
||||||
|
writer.WriteLine($"#else");
|
||||||
|
writer.WriteLine($"\t\t{vis}{ro} {type} {fieldName};");
|
||||||
|
writer.WriteLine($"#endif");
|
||||||
|
}
|
||||||
|
|
||||||
if (!isPrivate && (map == null || (map.GenerateProperties && !map.IsInternal)))
|
if (!isPrivate && (map == null || (map.GenerateProperties && !map.IsInternal)))
|
||||||
{
|
{
|
||||||
|
@ -251,7 +249,18 @@ namespace SkiaSharpGenerator
|
||||||
{
|
{
|
||||||
if (map?.IsReadOnly == true)
|
if (map?.IsReadOnly == true)
|
||||||
{
|
{
|
||||||
writer.WriteLine($"\t\tpublic readonly {type} {propertyName} => {fieldName};");
|
if (funcPointerType is null)
|
||||||
|
{
|
||||||
|
writer.WriteLine($"\t\tpublic readonly {type} {propertyName} => {fieldName};");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
writer.WriteLine($"#if USE_LIBRARY_IMPORT");
|
||||||
|
writer.WriteLine($"\t\tpublic readonly {funcPointerType} {propertyName} => {fieldName};");
|
||||||
|
writer.WriteLine($"#else");
|
||||||
|
writer.WriteLine($"\t\tpublic readonly {type} {propertyName} => {fieldName};");
|
||||||
|
writer.WriteLine($"#endif");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -276,7 +285,9 @@ namespace SkiaSharpGenerator
|
||||||
equalityFields.Add($"{f} == obj.{f}");
|
equalityFields.Add($"{f} == obj.{f}");
|
||||||
}
|
}
|
||||||
writer.WriteLine($"\t\tpublic readonly bool Equals ({name} obj) =>");
|
writer.WriteLine($"\t\tpublic readonly bool Equals ({name} obj) =>");
|
||||||
|
writer.WriteLine($"#pragma warning disable CS8909");
|
||||||
writer.WriteLine($"\t\t\t{string.Join(" && ", equalityFields)};");
|
writer.WriteLine($"\t\t\t{string.Join(" && ", equalityFields)};");
|
||||||
|
writer.WriteLine($"#pragma warning restore CS8909");
|
||||||
writer.WriteLine();
|
writer.WriteLine();
|
||||||
|
|
||||||
// Equals
|
// Equals
|
||||||
|
@ -464,13 +475,22 @@ namespace SkiaSharpGenerator
|
||||||
var skipFunction = false;
|
var skipFunction = false;
|
||||||
|
|
||||||
var paramsList = new List<string>();
|
var paramsList = new List<string>();
|
||||||
|
var paramsListWithFuncPointers = new List<string>();
|
||||||
var paramNamesList = new List<string>();
|
var paramNamesList = new List<string>();
|
||||||
for (var i = 0; i < function.Parameters.Count; i++)
|
for (var i = 0; i < function.Parameters.Count; i++)
|
||||||
{
|
{
|
||||||
var p = function.Parameters[i];
|
var p = function.Parameters[i];
|
||||||
var n = string.IsNullOrEmpty(p.Name) ? $"param{i}" : p.Name;
|
var n = string.IsNullOrEmpty(p.Name) ? $"param{i}" : p.Name;
|
||||||
n = SafeName(n);
|
n = SafeName(n);
|
||||||
var t = GetType(p.Type);
|
var t1 = GetType(p.Type);
|
||||||
|
var t2 = GetFunctionPointerType(p.Type);
|
||||||
|
|
||||||
|
// Mono WASM didn't support function pointers in DllImport definitions until .NET 8.
|
||||||
|
// While it should, it still didn't work for me even on .NET 9 previews, so keeping `void*` instead of function pointers.
|
||||||
|
// It makes higher chance of accident mistakes, but old managed delegates build should catch the errors compile time too.
|
||||||
|
if (t2 is not null) t2 = "void*";
|
||||||
|
t2 ??= t1;
|
||||||
|
|
||||||
var cppT = GetCppType(p.Type);
|
var cppT = GetCppType(p.Type);
|
||||||
if (excludedTypes.Contains(cppT) == true)
|
if (excludedTypes.Contains(cppT) == true)
|
||||||
{
|
{
|
||||||
|
@ -478,11 +498,12 @@ namespace SkiaSharpGenerator
|
||||||
skipFunction = true;
|
skipFunction = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (t == "Boolean" || cppT == "bool")
|
if (t1 == "Boolean" || cppT == "bool")
|
||||||
t = $"[MarshalAs (UnmanagedType.I1)] bool";
|
t1 = t2 = "[MarshalAs (UnmanagedType.I1)] bool";
|
||||||
if (funcMap != null && funcMap.Parameters.TryGetValue(i.ToString(), out var newT))
|
if (funcMap != null && funcMap.Parameters.TryGetValue(i.ToString(), out var newT))
|
||||||
t = newT;
|
t1 = t2 = newT;
|
||||||
paramsList.Add($"{t} {n}");
|
paramsList.Add($"{t1} {n}");
|
||||||
|
paramsListWithFuncPointers.Add($"{t2} {n}");
|
||||||
paramNamesList.Add(n);
|
paramNamesList.Add(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,10 +525,19 @@ namespace SkiaSharpGenerator
|
||||||
writer.WriteLine();
|
writer.WriteLine();
|
||||||
writer.WriteLine($"\t\t// {function}");
|
writer.WriteLine($"\t\t// {function}");
|
||||||
writer.WriteLine($"\t\t#if !USE_DELEGATES");
|
writer.WriteLine($"\t\t#if !USE_DELEGATES");
|
||||||
|
writer.WriteLine($"\t\t#if USE_LIBRARY_IMPORT");
|
||||||
|
writer.WriteLine($"\t\t[LibraryImport ({config.DllName})]");
|
||||||
|
if (!string.IsNullOrEmpty(retAttr))
|
||||||
|
writer.WriteLine($"\t\t{retAttr}");
|
||||||
|
writer.WriteLine($"\t\tinternal static partial {returnType} {name} ({string.Join(", ", paramsListWithFuncPointers)});");
|
||||||
|
|
||||||
|
writer.WriteLine($"\t\t#else // !USE_LIBRARY_IMPORT");
|
||||||
writer.WriteLine($"\t\t[DllImport ({config.DllName}, CallingConvention = CallingConvention.Cdecl)]");
|
writer.WriteLine($"\t\t[DllImport ({config.DllName}, CallingConvention = CallingConvention.Cdecl)]");
|
||||||
if (!string.IsNullOrEmpty(retAttr))
|
if (!string.IsNullOrEmpty(retAttr))
|
||||||
writer.WriteLine($"\t\t{retAttr}");
|
writer.WriteLine($"\t\t{retAttr}");
|
||||||
writer.WriteLine($"\t\tinternal static extern {returnType} {name} ({string.Join(", ", paramsList)});");
|
writer.WriteLine($"\t\tinternal static extern {returnType} {name} ({string.Join(", ", paramsList)});");
|
||||||
|
writer.WriteLine($"\t\t#endif");
|
||||||
|
|
||||||
writer.WriteLine($"\t\t#else");
|
writer.WriteLine($"\t\t#else");
|
||||||
writer.WriteLine($"\t\tprivate partial class Delegates {{");
|
writer.WriteLine($"\t\tprivate partial class Delegates {{");
|
||||||
writer.WriteLine($"\t\t\t[UnmanagedFunctionPointer (CallingConvention.Cdecl)]");
|
writer.WriteLine($"\t\t\t[UnmanagedFunctionPointer (CallingConvention.Cdecl)]");
|
||||||
|
@ -525,5 +555,86 @@ namespace SkiaSharpGenerator
|
||||||
writer.WriteLine();
|
writer.WriteLine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void WriteDelegateProxies(TextWriter writer)
|
||||||
|
{
|
||||||
|
Log?.LogVerbose(" Writing delegate proxies...");
|
||||||
|
|
||||||
|
writer.WriteLine($"#region DelegateProxies");
|
||||||
|
|
||||||
|
var delegates = compilation.Typedefs
|
||||||
|
.Where(t => t.ElementType.TypeKind == CppTypeKind.Pointer)
|
||||||
|
.Where(t => IncludeNamespace(t.GetDisplayName()))
|
||||||
|
.OrderBy(t => t.GetDisplayName())
|
||||||
|
.GroupBy(t => GetNamespace(t.GetDisplayName()));
|
||||||
|
|
||||||
|
foreach (var group in delegates)
|
||||||
|
{
|
||||||
|
writer.WriteLine();
|
||||||
|
writer.WriteLine($"namespace {group.Key} {{");
|
||||||
|
writer.WriteLine($"internal static unsafe partial class DelegateProxies {{ ");
|
||||||
|
|
||||||
|
foreach (var del in group)
|
||||||
|
{
|
||||||
|
WriteDelegateProxy(writer, del);
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.WriteLine($"}}");
|
||||||
|
writer.WriteLine($"}}");
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.WriteLine();
|
||||||
|
writer.WriteLine($"#endregion");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WriteDelegateProxy(TextWriter writer, CppTypedef del)
|
||||||
|
{
|
||||||
|
if (!(((CppPointerType)del.ElementType).ElementType is CppFunctionType function))
|
||||||
|
{
|
||||||
|
Log?.LogWarning($"Unknown delegate type {del}");
|
||||||
|
|
||||||
|
writer.WriteLine($"// TODO: {del}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var nativeName = del.GetDisplayName();
|
||||||
|
|
||||||
|
Log?.LogVerbose($" {nativeName}");
|
||||||
|
|
||||||
|
functionMappings.TryGetValue(nativeName, out var map);
|
||||||
|
var name = map?.CsType ?? CleanName(nativeName);
|
||||||
|
|
||||||
|
if (map?.GenerateProxy == false)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var functionPointerType = GetFunctionPointerType(del, map);
|
||||||
|
|
||||||
|
var (paramsList, returnType) = GetManagedFunctionArguments(function, map);
|
||||||
|
|
||||||
|
var proxies = map?.ProxySuffixes ?? new List<string> { "" };
|
||||||
|
|
||||||
|
foreach (var proxyPrefix in proxies)
|
||||||
|
{
|
||||||
|
var proxyName = name.EndsWith("ProxyDelegate") ? name.Replace("ProxyDelegate", "Proxy") : name;
|
||||||
|
var implName = name.EndsWith("ProxyDelegate") ? name.Replace("ProxyDelegate", "ProxyImplementation") : name + "Implementation";
|
||||||
|
|
||||||
|
proxyName += proxyPrefix;
|
||||||
|
implName += proxyPrefix;
|
||||||
|
|
||||||
|
writer.WriteLine($"\t/// Proxy for {nativeName} native function.");
|
||||||
|
writer.WriteLine($"#if USE_LIBRARY_IMPORT");
|
||||||
|
writer.WriteLine($"\tpublic static readonly {functionPointerType} {proxyName} = &{implName};");
|
||||||
|
writer.WriteLine($"\t[UnmanagedCallersOnly(CallConvs = new [] {{typeof(CallConvCdecl)}})]");
|
||||||
|
writer.WriteLine($"#else");
|
||||||
|
writer.WriteLine($"\tpublic static readonly {name} {proxyName} = {implName};");
|
||||||
|
writer.WriteLine($"\t[MonoPInvokeCallback (typeof ({name}))]");
|
||||||
|
writer.WriteLine($"#endif");
|
||||||
|
if (returnType == "bool") writer.WriteLine($"\t[return: MarshalAs (UnmanagedType.I1)]");
|
||||||
|
writer.WriteLine($"\tprivate static partial {returnType} {implName}({string.Join(",", paramsList)});");
|
||||||
|
writer.WriteLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче