refactor, sixel performance
[fanfix.git] / src / jexer / tterminal / Sixel.java
index 1921f44e5c83716ba0c75e2634e30617e3582c20..63e3c0fadcfa670d308c0f327f89f8e21313b810 100644 (file)
@@ -172,6 +172,11 @@ public class Sixel {
         BufferedImage newImage = new BufferedImage(newWidth, newHeight,
             BufferedImage.TYPE_INT_ARGB);
 
+        if (DEBUG) {
+            System.err.println("resizeImage(); old " + image.getWidth() + "x" +
+                image.getHeight() + " new " + newWidth + "x" + newHeight);
+        }
+
         Graphics2D gr = newImage.createGraphics();
         gr.drawImage(image, 0, 0, image.getWidth(), image.getHeight(), null);
         gr.dispose();
@@ -407,14 +412,15 @@ public class Sixel {
                 toGround();
             }
 
-            if (height + 6 < image.getHeight()) {
+            height += 6;
+            x = 0;
+
+            if (height + 6 > image.getHeight()) {
                 // Resize the image, give us another HEIGHT_INCREASE
                 // pixels of vertical length.
                 resizeImage(image.getWidth(),
                     image.getHeight() + HEIGHT_INCREASE);
             }
-            height += 6;
-            x = 0;
             return;
         }