Esempio n. 1
0
        public void PaintContent(Graphics aGraphics, HeapCellMetaData aMetaData, HeapCell aCell, uint aAddress, Point aPosition, Size aBoxSize, Size aPaddingSize)
        {
            // Get the cell colour that is associated with the cell symbol object type
            aMetaData.CellBoxColor = ColourForHeapCell(aCell);

            // Draw actual cell
            SymRect boxRect = new SymRect(aPosition, aBoxSize);

            boxRect.HalfOffset(aPaddingSize);
            using (SolidBrush brush = new SolidBrush(aMetaData.CellBoxColor))
            {
                aGraphics.FillRectangle(brush, boxRect.Rectangle);
            }

            // If first box, we show the number of inwards links to the cell
            HeapCell.TRegion region = aMetaData.Region;
            if (region == HeapCell.TRegion.EHeader && aMetaData.CellBoxIndex == 0)
            {
                boxRect.Inflate(KShrinkSize, KShrinkSize);

                // Draw the fill
                Color lightenColor = ColourUtils.LightenMore(aMetaData.CellBoxColor);
                using (SolidBrush brush = new SolidBrush(lightenColor))
                {
                    aGraphics.FillRectangle(brush, boxRect.Rectangle);
                }
                lightenColor = ColourUtils.Lighten(lightenColor);
                using (Pen borderPen = new Pen(lightenColor, KHeaderBoxWidth))
                {
                    aGraphics.DrawRectangle(borderPen, boxRect.Rectangle);
                }

                // Draw the count
                int count = aCell.RelationshipManager.ReferencedBy.Count;
                if (count == 0)
                {
                    PaintBoxedText(count.ToString(), aGraphics, Color.Red, boxRect);
                }
                else
                {
                    PaintBoxedTextWithLuminanceHandling(count.ToString(), aGraphics, Color.Black, boxRect);
                }
            }
        }
Esempio n. 2
0
        public void PaintContent(Graphics aGraphics, HeapCellMetaData aMetaData, HeapCell aCell, uint aAddress, Point aPosition, Size aBoxSize, Size aPaddingSize)
        {
            // Get the cell colour that is associated with the cell symbol object type
            aMetaData.CellBoxColor = ColourForHeapCell(aCell);
            SymRect boxRect = new SymRect(aPosition, aBoxSize);

            boxRect.HalfOffset(aPaddingSize);

            // Draw actual cell
            using (SolidBrush brush = new SolidBrush(aMetaData.CellBoxColor))
            {
                aGraphics.FillRectangle(brush, boxRect.Rectangle);
            }

            HeapCell.TRegion region = aMetaData.Region;
            if (region == HeapCell.TRegion.EHeader && aMetaData.CellBoxIndex == 0)
            {
                // If first box, we show the number of inwards links to the cell
                boxRect.Inflate(KShrinkSize, KShrinkSize);

                // Draw the fill
                Color lightenColor = ColourUtils.Lighten(aMetaData.CellBoxColor);
                using (SolidBrush brush = new SolidBrush(lightenColor))
                {
                    aGraphics.FillRectangle(brush, boxRect.Rectangle);
                }
                lightenColor = ColourUtils.Lighten(lightenColor);
                using (Pen borderPen = new Pen(lightenColor, KHeaderBoxWidth))
                {
                    aGraphics.DrawRectangle(borderPen, boxRect.Rectangle);
                }

                // Draw the count
                PaintBoxedTextWithLuminanceHandling(aCell.RelationshipManager.EmbeddedReferencesTo.Count.ToString(), aGraphics, Color.Black, boxRect);
            }
            else
            {
                // If we're in the payload section, then get the raw item corresponding to the address we are drawing
                RawItem rawItem = aMetaData.RawItem;
                if (rawItem != null && rawItem.Tag != null && rawItem.Tag is HeapLib.Relationships.RelationshipInfo)
                {
                    RelationshipInfo relInfo = (RelationshipInfo)rawItem.Tag;

                    // Make the box a bit smaller
                    boxRect.Inflate(KShrinkSize, KShrinkSize);

                    // Draw the fill
                    Color lightenColor = ColourUtils.Lighten(aMetaData.CellBoxColor);
                    using (SolidBrush brush = new SolidBrush(lightenColor))
                    {
                        aGraphics.FillRectangle(brush, boxRect.Rectangle);
                    }
                    lightenColor = ColourUtils.Lighten(lightenColor);
                    using (Pen borderPen = new Pen(lightenColor, KHeaderBoxWidth))
                    {
                        aGraphics.DrawRectangle(borderPen, boxRect.Rectangle);

                        // If it's a clean reference, then draw a diagonal line to decorate the box reference
                        if (relInfo.IsCleanLink)
                        {
                            Point linePosStart = boxRect.TopLeft;
                            linePosStart.X += KHeaderBoxLineCornerOffset;
                            Point linePosEnd = boxRect.TopLeft;
                            linePosEnd.Y += KHeaderBoxLineCornerOffset;
                            //
                            aGraphics.DrawLine(borderPen, linePosStart, linePosEnd);
                        }
                    }
                }
            }
        }