From 4e50b59bf70b3ae6488a2270e84ddd928d0887c5 Mon Sep 17 00:00:00 2001 From: brendanx67 Date: Thu, 26 Dec 2024 05:25:46 -0800 Subject: [PATCH] Skyline: Fixed CleanupBorder10 for floating windows - improved commenting in CleanupBorder11 --- .../TestUtil/ScreenshotProcessingExtensions.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pwiz_tools/Skyline/TestUtil/ScreenshotProcessingExtensions.cs b/pwiz_tools/Skyline/TestUtil/ScreenshotProcessingExtensions.cs index c89fce2f19..c10429015f 100644 --- a/pwiz_tools/Skyline/TestUtil/ScreenshotProcessingExtensions.cs +++ b/pwiz_tools/Skyline/TestUtil/ScreenshotProcessingExtensions.cs @@ -91,7 +91,10 @@ private static Bitmap CleanupBorder10(this Bitmap bmp, Color color, Rectangle re { using var g = Graphics.FromImage(bmp); using var pen = new Pen(color); - g.DrawRectangle(pen, 0, 0, bmp.Width - 1, bmp.Height - 1); + if (rect.Height == 1) + g.DrawLine(pen, rect.Location, new Point(rect.Right, rect.Top)); + else + g.DrawRectangle(pen, rect.X, rect.Y, rect.Width - 1, rect.Height - 1); return bmp; } @@ -123,11 +126,11 @@ private static Bitmap CleanupBorder11(this Bitmap bmp, Color color, Rectangle re // Draw the image within the curved shape just drawn using var pathClipping = new GraphicsPath(); rect.Inflate(-1, -1); - AddRoundedRectangle(pathClipping, rect, cornerRadius + cornerRadius/2); // Corners are very tricky with transparency + // Corner transparency is very tricky. So, it is necessary to clip the corner + // areas slightly further in then their true edges. + AddRoundedRectangle(pathClipping, rect, cornerRadius + cornerRadius/2); g.SmoothingMode = SmoothingMode.None; g.SetClip(pathClipping); - // using var foregroundBrush = new SolidBrush(Color.Red); - // g.FillRectangle(foregroundBrush, 0, 0, bmp.Width, bmp.Height); g.DrawImage(bmp, new Point(0, 0)); return result;