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 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 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); } }); } } }
void DrawHover(DirectXCanvas canvas) { HoverMesh.Update(canvas.RenderDevice); canvas.Draw(HoverMesh); }