From d65351d324043f7c9d74f6dcf966ea40792017a5 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bruyère Date: Mon, 2 Aug 2021 14:36:36 +0200 Subject: merge step 2 --- Samples/DebugLogAnalyzer/src/DbgLogViewer.cs | 21 ++++++++------------- Samples/DebugLogAnalyzer/src/DebugInterface.cs | 6 +++--- .../DebugLogAnalyzer/src/DebugInterfaceWidget.cs | 4 ++-- 3 files changed, 13 insertions(+), 18 deletions(-) (limited to 'Samples/DebugLogAnalyzer/src') diff --git a/Samples/DebugLogAnalyzer/src/DbgLogViewer.cs b/Samples/DebugLogAnalyzer/src/DbgLogViewer.cs index 086e7152..7b91f9f0 100644 --- a/Samples/DebugLogAnalyzer/src/DbgLogViewer.cs +++ b/Samples/DebugLogAnalyzer/src/DbgLogViewer.cs @@ -1,18 +1,15 @@ -using System.Diagnostics; -using System.Runtime.InteropServices.ComTypes; -// Copyright (c) 2013-2020 Jean-Philippe Bruyère +// Copyright (c) 2013-2021 Jean-Philippe Bruyère // // This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) using System; using System.Collections.Generic; using System.ComponentModel; -using System.IO; using System.Linq; using System.Threading.Tasks; using Crow.Drawing; using Crow.DebugLogger; -using DebugLogAnalyzer; +using System.Diagnostics; namespace Crow { @@ -194,9 +191,7 @@ namespace Crow set { base.Font = value; using (Context gr = new Context (IFace.surf)) { - gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight); - gr.SetFontSize (Font.Size); - + setFontForContext (gr); fe = gr.FontExtents; } updateMargins (); @@ -262,7 +257,7 @@ namespace Crow } DbgEvtType currentFilter; - protected override void onDraw (Cairo.Context gr) + protected override void onDraw (Context gr) { base.onDraw (gr); @@ -346,7 +341,7 @@ namespace Crow } string ticksToMS(long ticks) => Math.Round ((double)ticks / Stopwatch.Frequency * 1000.0, 2).ToString(); - public override void Paint (Cairo.Context ctx) + public override void Paint (Context ctx) { base.Paint (ctx); @@ -386,7 +381,7 @@ namespace Crow ctx.MoveTo (ctxR.X - ctx.TextExtents (str).Width / 2, ctxR.Y + fe.Height); ctx.ShowText (str); - ctx.Operator = Cairo.Operator.Add; + ctx.Operator = Operator.Add; if (hoverLine >= 0) { double y = fe.Height * (hoverLine - ScrollY) + topMargin + cb.Top; @@ -413,7 +408,7 @@ namespace Crow } if (selStart < 0 || selEnd < 0) { - ctx.Operator = Cairo.Operator.Over; + ctx.Operator = Operator.Over; return; } double selStartX = (double)(selStart - ScrollX - minTicks) * xScale + leftMargin + cb.Left; @@ -432,7 +427,7 @@ namespace Crow ctx.SetSource (0.0,0.2,0.8,0.15); //ctx.SetSource (Colors.Jet); ctx.Fill(); - ctx.Operator = Cairo.Operator.Over; + ctx.Operator = Operator.Over; str = $"{ticksToMS(Math.Abs (selEnd - selStart))} (ms)"; diff --git a/Samples/DebugLogAnalyzer/src/DebugInterface.cs b/Samples/DebugLogAnalyzer/src/DebugInterface.cs index d37b0752..08927566 100644 --- a/Samples/DebugLogAnalyzer/src/DebugInterface.cs +++ b/Samples/DebugLogAnalyzer/src/DebugInterface.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2013-2019 Bruyère Jean-Philippe +// Copyright (c) 2013-2021 Bruyère Jean-Philippe // // This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) @@ -18,7 +18,7 @@ namespace Crow public DebugInterface (IntPtr hWin) : base (hWin) { SolidBackground = false; - surf = new ImageSurface (Format.Argb32, 100, 100); + surf = CreateSurface (100, 100); } public override void Run() @@ -125,7 +125,7 @@ namespace Crow lock (UpdateMutex) { clientRectangle = new Rectangle (0, 0, width, height); surf?.Dispose(); - surf = new ImageSurface (Format.Argb32, width, height); + surf = CreateSurface (width, height); foreach (Widget g in GraphicTree) g.RegisterForLayouting (LayoutingType.All); RegisterClip (clientRectangle); diff --git a/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs b/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs index 70c4f9b1..8da93de0 100644 --- a/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs +++ b/Samples/DebugLogAnalyzer/src/DebugInterfaceWidget.cs @@ -377,9 +377,9 @@ namespace Crow if (initialized) { delResize (Slot.Width, Slot.Height); - bmp = Crow.Cairo.Surface.Lookup (delGetSurfacePointer(), false); + bmp = IFace.CreateSurface (delGetSurfacePointer()); } else - bmp = IFace.surf.CreateSimilar (Content.ColorAlpha, Slot.Width, Slot.Height); + bmp = IFace.CreateSurface (Slot.Width, Slot.Height); IsDirty = false; } -- cgit v1.3.1-4-g156e