Преглед на файлове

Use round to nearest whole number when calculating sixel resolution from window size/chars

tznind преди 11 месеца
родител
ревизия
4073ef305c
променени са 1 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. 2 2
      Terminal.Gui/Drawing/SixelSupportDetector.cs

+ 2 - 2
Terminal.Gui/Drawing/SixelSupportDetector.cs

@@ -71,8 +71,8 @@ public class SixelSupportDetector
                             charWidth != 0 && charHeight != 0) // Avoid divide by zero
                         {
                             // Calculate the character cell size in pixels
-                            var cellWidth = pixelWidth / charWidth;
-                            var cellHeight = pixelHeight / charHeight;
+                            var cellWidth = (int)Math.Round ((double)pixelWidth / charWidth);
+                            var cellHeight = (int)Math.Round ((double)pixelHeight / charHeight);
 
                             // Set the resolution based on the character cell size
                             result.Resolution = new Size (cellWidth, cellHeight);