From 950104a8d304ebc9e4499186bc4cac8e6721b6ff Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bruyère Date: Thu, 12 Aug 2021 16:22:34 +0200 Subject: it's now possible to run vkvgBackend in DebugLogView on cairo --- Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs') diff --git a/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs b/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs index 8da93de0..113e5e07 100644 --- a/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs +++ b/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs @@ -34,12 +34,12 @@ namespace Crow Action delResetDirtyState; Action delResetDebugger; Action delSaveDebugLog; - Func delGetSurfacePointer; + Func delGetSurfacePointer; Action delSetSource; FieldInfo fiDbg_IncludeEvents, fiDbg_DiscardEvents, fiDbg_ConsoleOutput; - bool initialized, recording; + bool initialized, recording, hasVkvgBackend; string crowDbgAssemblyLocation; DbgEvtType recordedEvents, discardedEvents; @@ -198,6 +198,11 @@ namespace Crow } crowLoadCtx = new AssemblyLoadContext("CrowDebuggerLoadContext"); + crowLoadCtx.Resolving += (context, assemblyName) => { + return crowLoadCtx.LoadFromAssemblyPath ( + System.IO.Path.Combine ( + System.IO.Path.GetDirectoryName(crowDbgAssemblyLocation), assemblyName.Name + ".dll")); + }; //using (crowLoadCtx.EnterContextualReflection()) { crowAssembly = crowLoadCtx.LoadFromAssemblyPath (crowDbgAssemblyLocation); @@ -210,7 +215,6 @@ namespace Crow } dbgIfaceType = thisAssembly.GetType("Crow.DebugInterface"); - dbgIFace = Activator.CreateInstance (dbgIfaceType, new object[] {IFace.WindowHandle}); delResize = (Action)Delegate.CreateDelegate(typeof(Action), @@ -252,6 +256,7 @@ namespace Crow null, debuggerType.GetMethod("Reset")); /*delSaveDebugLog = (Action)Delegate.CreateDelegate(typeof(Action), null, debuggerType.GetMethod("Save", new Type[] {dbgIfaceType, typeof(string)}));*/ + hasVkvgBackend = (bool)dbgIfaceType.GetField ("HaveVkvgBackend", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy).GetValue (null); dbgIfaceType.GetMethod("RegisterDebugInterfaceCallback").Invoke (dbgIFace, new object[] {this} ); dbgIfaceType.GetMethod("Run").Invoke (dbgIFace, null); @@ -265,7 +270,6 @@ namespace Crow protected override void onDraw(Context gr) { - Console.WriteLine("onDraw"); gr.SetSource(Colors.RoyalBlue); gr.Paint(); } @@ -376,8 +380,12 @@ namespace Crow bmp?.Dispose (); if (initialized) { - delResize (Slot.Width, Slot.Height); - bmp = IFace.CreateSurface (delGetSurfacePointer()); + delResize (Slot.Width, Slot.Height); + if (hasVkvgBackend) + bmp = IFace.CreateSurfaceForData (delGetSurfacePointer(), Slot.Width, Slot.Height); + else + bmp = IFace.CreateSurface (delGetSurfacePointer()); + } else bmp = IFace.CreateSurface (Slot.Width, Slot.Height); -- cgit v1.3.1-4-g156e