Browse Source

Fix fill area - y is not in sixels its in pixels

tznind 10 months ago
parent
commit
4571978a9b
2 changed files with 4 additions and 15 deletions
  1. 2 13
      Terminal.Gui/Drawing/SixelEncoder.cs
  2. 2 2
      UnitTests/Drawing/SixelEncoderTests.cs

+ 2 - 13
Terminal.Gui/Drawing/SixelEncoder.cs

@@ -204,20 +204,9 @@ public class SixelEncoder
 
     private string GetFillArea (Color [,] pixels)
     {
-        int widthInChars = GetWidthInChars (pixels);
-        int heightInChars = GetHeightInChars (pixels);
+        int widthInChars = pixels.GetLength (0);
+        int heightInChars = pixels.GetLength (1);
 
         return $"{widthInChars};{heightInChars}";
     }
-
-    private int GetHeightInChars (Color [,] pixels)
-    {
-        int height = pixels.GetLength (1);
-        return (height + 5) / 6;
-    }
-
-    private int GetWidthInChars (Color [,] pixels)
-    {
-        return pixels.GetLength (0);
-    }
 }

+ 2 - 2
UnitTests/Drawing/SixelEncoderTests.cs

@@ -10,7 +10,7 @@ public class SixelEncoderTests
         string expected = "\u001bP" // Start sixel sequence
                           + "0;0;0" // Defaults for aspect ratio and grid size
                           + "q" // Signals beginning of sixel image data
-                          + "\"1;1;12;2" // no scaling factors (1x1) and filling 12px width with 2 'sixel' height = 12 px high
+                          + "\"1;1;12;12" // no scaling factors (1x1) and filling 12x12 pixel area
                           /*
                            * Definition of the color palette
                            * #<index>;<type>;<R>;<G>;<B>" - 2 means RGB. The values range 0 to 100
@@ -82,7 +82,7 @@ public class SixelEncoderTests
         string expected = "\u001bP" // Start sixel sequence
                           + "0;0;0" // Defaults for aspect ratio and grid size
                           + "q" // Signals beginning of sixel image data
-                          + "\"1;1;12;2" // no scaling factors (1x1) and filling 12px width with 2 'sixel' height = 12 px high
+                          + "\"1;1;12;12" // no scaling factors (1x1) and filling 12x12 pixel area
                           /*
                            * Definition of the color palette
                            */