diff --git a/src/Web/Avalonia.Web.Sample/Program.cs b/src/Web/Avalonia.Web.Sample/Program.cs index 3ad6db15dc..18a593c9e8 100644 --- a/src/Web/Avalonia.Web.Sample/Program.cs +++ b/src/Web/Avalonia.Web.Sample/Program.cs @@ -14,12 +14,12 @@ internal class Program Console.WriteLine("Hello, Browser!"); Console.WriteLine(); - foreach(var arg in args) { Console.WriteLine(arg); } + AvaloniaRuntime.Init(); } } diff --git a/src/Web/Avalonia.Web.Sample/interop.js b/src/Web/Avalonia.Web.Sample/interop.js index b75212e7a7..c7ae3a56c7 100644 --- a/src/Web/Avalonia.Web.Sample/interop.js +++ b/src/Web/Avalonia.Web.Sample/interop.js @@ -4,7 +4,7 @@ var LibraryExample = { internal_func: function () { } }, - example_initialize: function () { + InterceptGLObject: function () { globalThis.AvaloniaGL = GL } } diff --git a/src/Web/Avalonia.Web/AvaloniaRuntime.cs b/src/Web/Avalonia.Web/AvaloniaRuntime.cs index d5bcd7dd98..0d21ae096d 100644 --- a/src/Web/Avalonia.Web/AvaloniaRuntime.cs +++ b/src/Web/Avalonia.Web/AvaloniaRuntime.cs @@ -1,7 +1,6 @@ using System; using System.Runtime.InteropServices; using System.Runtime.InteropServices.JavaScript; -using static System.Runtime.InteropServices.JavaScript.JSType; namespace Avalonia.Web; @@ -10,32 +9,24 @@ public partial class AvaloniaRuntime public record GLInfo(int ContextId, uint FboId, int Stencils, int Samples, int Depth); [DllImport("libSkiaSharp", CallingConvention = CallingConvention.Cdecl)] - static extern JSObject example_initialize(); + static extern JSObject InterceptGLObject(); [JSExport] internal static void StartAvaloniaView(JSObject canvas) { - example_initialize(); + InterceptGLObject(); // setup, get gl context... var info = InitGL(canvas, "testCanvas"); - /* var glInfo = new GLInfo( + var glInfo = new GLInfo( info.GetPropertyAsInt32("context"), (uint)info.GetPropertyAsInt32("fboId"), info.GetPropertyAsInt32("stencil"), info.GetPropertyAsInt32("sample"), info.GetPropertyAsInt32("depth")); - Console.WriteLine($"{glInfo.ContextId}, {glInfo.FboId}");*/ - } - - public static void Init () - { - if (false) - { - SkiaSharp.GRGlInterface.Create(); - } + Console.WriteLine($"{glInfo.ContextId}, {glInfo.FboId}"); } [JSImport("Canvas.Foo", "avalonia.ts")] @@ -47,8 +38,5 @@ public partial class AvaloniaRuntime [JSImport("StorageProvider.isFileApiSupported", "storage.ts")] public static partial bool IsFileApiSupported(); - //[DllImport("__Internal")] - //public - }