示例#1
0
        private void InitBackgroundMesh()
        {
            if (BackgroundMesh != null)
            {
                BackgroundMesh.Dispose();
            }

            DynamicMesh backgroundBuilder = surface.CreateMesh();

            backgroundBuilder.Projection = Mesh.ProjectionType.Pixel;

            double offset = 0.0;

            for (int threadIndex = 0; threadIndex < rows.Count; ++threadIndex)
            {
                ThreadRow row = rows[threadIndex];
                row.Offset = offset;

                if (threadIndex % 2 == 1)
                {
                    backgroundBuilder.AddRect(new Rect(0.0, offset, scroll.Width, row.Height), BroAlternativeBackground.Color);
                }

                offset += row.Height;
            }

            BackgroundMesh = backgroundBuilder.Freeze(surface.RenderDevice);
        }
示例#2
0
        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);
            }
        }
示例#3
0
            public override void Build(IGroup group, DXCanvas canvas)
            {
                TextBlocks = new List <TextEntry>();

                DynamicMesh meshBuilder = canvas.CreateMesh(DXCanvas.MeshType.Tris);
                DynamicMesh lineBuilder = canvas.CreateMesh(DXCanvas.MeshType.Lines);

                MaxHeight = group.Height;

                Build(DataContext, DataContext, 0.0, meshBuilder, lineBuilder);

                Mesh  = meshBuilder.Freeze(canvas.RenderDevice);
                Lines = lineBuilder.Freeze(canvas.RenderDevice);

                double duration = (group.Finish - group.Start).TotalSeconds;

                Matrix localTransform = new Matrix();

                localTransform.Scale((DataContext.Finish - DataContext.Start).TotalSeconds / duration, 1.0);
                localTransform.Translate((DataContext.Start - group.Start).TotalSeconds / duration, 0.0);

                if (Mesh != null)
                {
                    Mesh.LocalTransform = localTransform;
                }

                if (Lines != null)
                {
                    Lines.LocalTransform = localTransform;
                }

                TextBlocks.Sort((a, b) => - a.Width.CompareTo(b.Width));
            }
示例#4
0
        private void InitBackgroundMesh()
        {
            if (BackgroundMesh != null)
            {
                BackgroundMesh.Dispose();
            }

            DynamicMesh backgroundBuilder = surface.CreateMesh();

            backgroundBuilder.Projection = Mesh.ProjectionType.Pixel;

            double offset        = 0.0;
            bool   isAlternative = false;

            for (int threadIndex = 0; threadIndex < Rows.Count; ++threadIndex)
            {
                ThreadRow row = Rows[threadIndex];
                if (!row.IsVisible)
                {
                    continue;
                }

                backgroundBuilder.AddRect(new Rect(0.0, offset, Scroll.Width, row.Height), isAlternative ? OptickAlternativeBackground.Color : OptickBackground.Color);
                isAlternative = !isAlternative;

                offset += row.Height;
            }

            BackgroundMesh = backgroundBuilder.Freeze(surface.RenderDevice);
        }
示例#5
0
            public override void Build(IGroup group, DXCanvas canvas)
            {
                DynamicMesh meshBuilder = canvas.CreateMesh(DXCanvas.MeshType.Tris);
                DynamicMesh lineBuilder = canvas.CreateMesh(DXCanvas.MeshType.Lines);

                double duration = (group.Finish - group.Start).TotalSeconds;

                ILine line = DataContext;

                double       maxValue = line.Points.Max(p => p.Value);
                List <Point> points   = line.Points.ConvertAll(p => new Point((p.Key - group.Start).TotalSeconds / duration, 1.0 - p.Value / maxValue));

                for (int i = 0; i < points.Count - 1; ++i)
                {
                    lineBuilder.AddLine(points[i], points[i + 1], line.StrokeColor);
                }

                Mesh  = meshBuilder.Freeze(canvas.RenderDevice);
                Lines = lineBuilder.Freeze(canvas.RenderDevice);
            }
示例#6
0
        public void InitForegroundLines(List <ITick> lines)
        {
            if (ForegroundMesh != null)
            {
                ForegroundMesh.Dispose();
            }

            DynamicMesh builder = surface.CreateMesh();

            builder.Geometry = Mesh.GeometryType.Lines;

            // Adding Frame separators
            if (lines != null)
            {
                foreach (ITick line in lines)
                {
                    double x = Scroll.TimeToUnit(line);
                    builder.AddLine(new Point(x, 0.0), new Point(x, 1.0), OptickAlternativeBackground.Color);
                }
            }

            ForegroundMesh = builder.Freeze(surface.RenderDevice);
        }
示例#7
0
        void InitThreadList(FrameGroup group)
        {
            rows.Clear();
            id2row.Clear();

            ThreadList.RowDefinitions.Clear();
            ThreadList.Children.Clear();

            if (group == null)
            {
                return;
            }

            rows.Add(new HeaderThreadRow(group)
            {
                GradientTop    = Colors.LightGray,
                GradientBottom = Colors.Gray,
                SplitLines     = Colors.White,
                TextColor      = Colors.Black
            });

            for (int i = 0; i < Math.Min(group.Board.Threads.Count, group.Threads.Count); ++i)
            {
                ThreadDescription thread = group.Board.Threads[i];
                ThreadData        data   = group.Threads[i];

                bool threadHasData = false;
                if ((data.Callstacks != null && data.Callstacks.Count > 3) ||
                    /*(data.Sync != null && data.Sync.Intervals.Count > 0) || */
                    (data.Events != null && data.Events.Count > 0))

                {
                    threadHasData = true;
                }

                if (threadHasData)
                {
                    EventsThreadRow row = new EventsThreadRow(group, thread, data);
                    rows.Add(row);
                    id2row.Add(i, row);

                    row.EventNodeHover    += Row_EventNodeHover;
                    row.EventNodeSelected += Row_EventNodeSelected;
                }
            }

            scroll.TimeSlice = group.Board.TimeSlice;
            scroll.Height    = 0.0;
            scroll.Width     = surface.ActualWidth * RenderSettings.dpiScaleX;
            rows.ForEach(row => scroll.Height += row.Height);

            rows.ForEach(row => row.BuildMesh(surface, scroll));

            ThreadList.Margin = new Thickness(0, 0, 3, 0);

            if (BackgroundMesh != null)
            {
                BackgroundMesh.Dispose();
            }

            DynamicMesh backgroundBuilder = surface.CreateMesh();

            double offset = 0.0;

            for (int threadIndex = 0; threadIndex < rows.Count; ++threadIndex)
            {
                ThreadRow row = rows[threadIndex];
                row.Offset = offset;

                ThreadList.RowDefinitions.Add(new RowDefinition());

                Thickness margin = new Thickness(0, 0, 0, 0);

                Label labelName = new Label()
                {
                    Content = row.Name, Margin = margin, Padding = new Thickness(), FontWeight = FontWeights.Bold, Height = row.Height / RenderSettings.dpiScaleY, VerticalContentAlignment = VerticalAlignment.Center
                };

                Grid.SetRow(labelName, threadIndex);

                if (threadIndex % 2 == 1)
                {
                    labelName.Background = AlternativeBackground;
                    backgroundBuilder.AddRect(new Rect(0.0, offset / scroll.Height, 1.0, row.Height / scroll.Height), AlternativeBackground.Color);
                }

                ThreadList.Children.Add(labelName);
                offset += row.Height;
            }

            BackgroundMesh = backgroundBuilder.Freeze(surface.RenderDevice);
        }