refactor, sixel performance
[fanfix.git] / src / jexer / backend / MultiScreen.java
index 880ee1888300d12ae936ed2106c927b311cdc5a0..0c3a2894bbe29c9bc0af7067cd9b79f8d9b060bc 100644 (file)
@@ -28,7 +28,7 @@
  */
 package jexer.backend;
 
-import java.util.LinkedList;
+import java.util.ArrayList;
 import java.util.List;
 
 import jexer.bits.Cell;
@@ -46,7 +46,7 @@ public class MultiScreen implements Screen {
     /**
      * The list of screens to use.
      */
-    private List<Screen> screens = new LinkedList<Screen>();
+    private List<Screen> screens = new ArrayList<Screen>();
 
     // ------------------------------------------------------------------------
     // Constructors -----------------------------------------------------------
@@ -646,14 +646,7 @@ public class MultiScreen implements Screen {
     public int getTextWidth() {
         int textWidth = 16;
         for (Screen screen: screens) {
-            int newTextWidth = textWidth;
-            if (screen instanceof MultiScreen) {
-                newTextWidth = ((MultiScreen) screen).getTextWidth();
-            } else if (screen instanceof ECMA48Terminal) {
-                newTextWidth = ((ECMA48Terminal) screen).getTextWidth();
-            } else if (screen instanceof SwingTerminal) {
-                newTextWidth = ((SwingTerminal) screen).getTextWidth();
-            }
+            int newTextWidth = screen.getTextWidth();
             if (newTextWidth < textWidth) {
                 textWidth = newTextWidth;
             }
@@ -669,14 +662,7 @@ public class MultiScreen implements Screen {
     public int getTextHeight() {
         int textHeight = 20;
         for (Screen screen: screens) {
-            int newTextHeight = textHeight;
-            if (screen instanceof MultiScreen) {
-                newTextHeight = ((MultiScreen) screen).getTextHeight();
-            } else if (screen instanceof ECMA48Terminal) {
-                newTextHeight = ((ECMA48Terminal) screen).getTextHeight();
-            } else if (screen instanceof SwingTerminal) {
-                newTextHeight = ((SwingTerminal) screen).getTextHeight();
-            }
+            int newTextHeight = screen.getTextHeight();
             if (newTextHeight < textHeight) {
                 textHeight = newTextHeight;
             }