void DrawHover(DirectXCanvas canvas) { if (Input.IsDrag) { return; } if (ToolTipPanel != null && !String.IsNullOrWhiteSpace(ToolTipPanel.Text)) { Size size = surface.Text.Measure(ToolTipPanel.Text); Rect textArea = new Rect(Input.MousePosition.X - size.Width * 0.5 + ToolTipOffset.X, ToolTipPanel.Rect.Top - size.Height + ToolTipOffset.Y, size.Width, size.Height); surface.Text.Draw(textArea.TopLeft, ToolTipPanel.Text, Colors.White, TextAlignment.Left); textArea.Inflate(ToolTipMargin); HoverMesh.AddRect(textArea, HoverBackground); } if (ToolTipPanel != null && !ToolTipPanel.Rect.IsEmpty) { HoverLines.AddRect(ToolTipPanel.Rect, FrameHover.Color); } HoverLines.Update(canvas.RenderDevice); canvas.Draw(HoverLines); HoverMesh.Update(canvas.RenderDevice); canvas.Draw(HoverMesh); }
public override void ApplyFilter(DirectXCanvas canvas, ThreadScroll scroll, HashSet <EventDescription> descriptions) { Filter = EventFilter.Create(EventData, descriptions); if (Filter != null) { DynamicMesh builder = canvas.CreateMesh(); foreach (EventFrame frame in EventData.Events) { Interval interval = scroll.TimeToUnit(frame.Header); builder.AddRect(new Rect(interval.Left, 0.0, interval.Width, 1.0), FilterFrameColor); } foreach (Entry entry in Filter.Entries) { Interval interval = scroll.TimeToUnit(entry); builder.AddRect(new Rect(interval.Left, 0.0, interval.Width, 1.0), FilterEntryColor); } SharpDX.Utilities.Dispose(ref FilterMesh); FilterMesh = builder.Freeze(canvas.RenderDevice); //if (FilterMesh != null) // FilterMesh.UseAlpha = true; } else { SharpDX.Utilities.Dispose(ref FilterMesh); } }
public override void Render(DirectXCanvas canvas, ThreadScroll scroll, DirectXCanvas.Layer layer) { if (layer == DirectXCanvas.Layer.Background) { SharpDX.Matrix world = SharpDX.Matrix.Scaling((float)scroll.Zoom, 1.0f, 1.0f); world.TranslationVector = new SharpDX.Vector3(-(float)(scroll.ViewUnit.Left * scroll.Zoom), 0.0f, 0.0f); BackgroundMeshLines.World = world; BackgroundMeshTris.World = world; canvas.Draw(BackgroundMeshTris); canvas.Draw(BackgroundMeshLines); Data.Utils.ForEachInsideInterval(Group.MainThread.Events, scroll.ViewTime, frame => { Interval interval = scroll.TimeToPixel(frame.Header); String text = String.Format(System.Globalization.CultureInfo.InvariantCulture, "{0:0.0} ms", frame.Header.Duration); // 2 times to emulate "bold" for (int i = 0; i < 2; ++i) { canvas.Text.Draw(new Point(interval.Left, Offset), text, TextColor, TextAlignment.Center, interval.Width); } }); } }
public override void Render(DirectXCanvas canvas, ThreadScroll scroll, DirectXCanvas.Layer layer, Rect box) { Matrix world = GetWorldMatrix(scroll); if (layer == DirectXCanvas.Layer.Background) { ChartMeshes?.ForEach(mesh => { mesh.WorldTransform = world; canvas.Draw(mesh); }); } }
public override void BuildMesh(DirectXCanvas canvas, ThreadScroll scroll) { if (Timestamps.Count < 2) { return; } DirectX.ComplexDynamicMesh builder = new ComplexDynamicMesh(canvas, DIPSpltCount); List <Color[]> entryColors = new List <Color[]>(); foreach (Entry entry in Entries) { Color color = entry.Fill; Color gradColor = DirectX.Utils.MultiplyColor(color, GradientColorShade); //entryColors.Add(new Color[] { leftColor, rightColor, rightColor, leftColor }); entryColors.Add(new Color[] { color, color, gradColor, gradColor }); } double left = scroll.TimeToUnit(Timestamps[0]); for (int i = 0; i < Timestamps.Count - 1; ++i) { double right = scroll.TimeToUnit(Timestamps[i + 1]); double bottom = 0.0; for (int entryIndex = 0; entryIndex < Entries.Count; ++entryIndex) { double val = Entries[entryIndex].Values[i]; double height = val / MaxValue; if (height > 0.0) { builder.AddRect(new Rect(left, 1.0 - bottom - height, right - left, height), entryColors[entryIndex]); bottom += height; } } left = right; } ChartMeshes = builder.Freeze(canvas.RenderDevice); }
public override void Render(DirectXCanvas canvas, ThreadScroll scroll, DirectXCanvas.Layer layer, Rect box) { if (layer == DirectXCanvas.Layer.Foreground) { Matrix world = GetWorldMatrix(scroll, false); //Matrix world = new Matrix(scroll.Zoom, 0.0, 0.0, 1.0, -scroll.ViewUnit.Left * scroll.Zoom, 0.0); if (BackgroundMeshTris != null) { BackgroundMeshTris.WorldTransform = world; canvas.Draw(BackgroundMeshTris); } if (BackgroundMeshLines != null) { BackgroundMeshLines.WorldTransform = world; canvas.Draw(BackgroundMeshLines); } double yOffset = Offset + (Height - RenderParams.BaseHeight) * 0.5; FrameList focusThread = Group.FocusThread; if (focusThread != null) { Data.Utils.ForEachInsideInterval(focusThread.Events, scroll.ViewTime, (frame, index) => { Interval interval = scroll.TimeToPixel(frame); String text = String.Format(System.Globalization.CultureInfo.InvariantCulture, "Frame {0} ({1:0.0}ms)", (uint)index, frame.Duration); // 2 times to emulate "bold" for (int i = 0; i < 2; ++i) { canvas.Text.Draw(new Point(interval.Left, yOffset), text, TextColor, TextAlignment.Center, interval.Width); } }); } } }
public override void ApplyFilter(DirectXCanvas canvas, ThreadScroll scroll, HashSet <EventDescription> descriptions) { throw new NotImplementedException(); }
public override void ApplyFilter(DirectXCanvas canvas, ThreadScroll scroll, HashSet <EventDescription> descriptions) { }
void DrawHover(DirectXCanvas canvas) { HoverMesh.Update(canvas.RenderDevice); canvas.Draw(HoverMesh); }