JAL-2778 tidy
authorkiramt <k.mourao@dundee.ac.uk>
Mon, 6 Nov 2017 09:25:18 +0000 (09:25 +0000)
committerkiramt <k.mourao@dundee.ac.uk>
Mon, 6 Nov 2017 09:25:18 +0000 (09:25 +0000)
src/jalview/gui/AnnotationPanel.java
src/jalview/gui/IdCanvas.java
src/jalview/gui/ScalePanel.java
src/jalview/gui/SeqCanvas.java

index 0d86b07..cf51781 100755 (executable)
@@ -1015,7 +1015,10 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
 
     fastPaint = true;
 
-    av.getAlignPanel().alignFrame.repaint();
+    // Call repaint on alignment panel so that repaints from other alignment
+    // panel components can be aggregated. Otherwise performance of the overview
+    // window and others may be adversely affected.
+    av.getAlignPanel().repaint();
   }
 
   private volatile boolean lastImageGood = false;
index 1ee281a..6c309a2 100755 (executable)
@@ -83,7 +83,7 @@ public class IdCanvas extends JPanel implements ViewportListenerI
     this.av = av;
     PaintRefresher.Register(this, av.getSequenceSetId());
     av.getRanges().addPropertyChangeListener(this);
-  }
+    }
 
   /**
    * DOCUMENT ME!
@@ -205,7 +205,10 @@ public class IdCanvas extends JPanel implements ViewportListenerI
 
     fastPaint = true;
 
-    av.getAlignPanel().alignFrame.repaint();
+    // Call repaint on alignment panel so that repaints from other alignment
+    // panel components can be aggregated. Otherwise performance of the overview
+    // window and others may be adversely affected.
+    av.getAlignPanel().repaint();
   }
 
   /**
@@ -242,8 +245,8 @@ public class IdCanvas extends JPanel implements ViewportListenerI
     
     if (oldHeight != imgHeight || image.getWidth(this) != getWidth())
     {
-      image = new BufferedImage(getWidth(), imgHeight,
-              BufferedImage.TYPE_INT_RGB);
+       image = new BufferedImage(getWidth(), imgHeight,
+                BufferedImage.TYPE_INT_RGB);
     }
     
     gg = (Graphics2D) image.getGraphics();
index e9cb04f..b135fc1 100755 (executable)
@@ -555,7 +555,11 @@ public class ScalePanel extends JPanel
             || evt.getPropertyName().equals(ViewportRanges.STARTRESANDSEQ))
     {
       // scroll event, repaint panel
-      av.getAlignPanel().alignFrame.repaint();
+       
+       // Call repaint on alignment panel so that repaints from other alignment
+    // panel components can be aggregated. Otherwise performance of the overview
+    // window and others may be adversely affected.
+      av.getAlignPanel().repaint();
     }
   }
 
index a717a17..ce835a3 100755 (executable)
@@ -40,6 +40,7 @@ import java.awt.Graphics;
 import java.awt.Graphics2D;
 import java.awt.RenderingHints;
 import java.awt.Shape;
+import java.awt.Transparency;
 import java.awt.image.BufferedImage;
 import java.beans.PropertyChangeEvent;
 import java.util.List;
@@ -295,7 +296,7 @@ public class SeqCanvas extends JComponent implements ViewportListenerI
       int endSeq = ranges.getEndSeq();
       int transX = 0;
       int transY = 0;
-
+      
       gg.copyArea(horizontal * charWidth, vertical * charHeight,
               img.getWidth(), img.getHeight(), -horizontal * charWidth,
               -vertical * charHeight);
@@ -337,7 +338,11 @@ public class SeqCanvas extends JComponent implements ViewportListenerI
       drawPanel(gg, startRes, endRes, startSeq, endSeq, 0);
       gg.translate(-transX, -transY);
 
-      av.getAlignPanel().alignFrame.repaint();
+      // Call repaint on alignment panel so that repaints from other alignment
+      // panel components can be aggregated. Otherwise performance of the
+      // overview
+      // window and others may be adversely affected.
+      av.getAlignPanel().repaint();
     } finally
     {
       fastpainting = false;
@@ -497,8 +502,11 @@ public class SeqCanvas extends JComponent implements ViewportListenerI
   private BufferedImage buildLocalImage(BufferedImage selectImage)
   {
     // clone the cached image
-    BufferedImage lcimg = new BufferedImage(img.getWidth(), img.getHeight(),
-            img.getType());
+         BufferedImage lcimg = new BufferedImage(img.getWidth(), img.getHeight(),
+                   img.getType());
+
+    // BufferedImage lcimg = new BufferedImage(img.getWidth(), img.getHeight(),
+    // img.getType());
     Graphics2D g2d = lcimg.createGraphics();
     g2d.drawImage(img, 0, 0, null);
 
@@ -537,8 +545,8 @@ public class SeqCanvas extends JComponent implements ViewportListenerI
 
     try
     {
-      lcimg = new BufferedImage(width, height,
-              BufferedImage.TYPE_INT_ARGB); // ARGB so alpha compositing works
+       lcimg = new BufferedImage(width, height,
+                BufferedImage.TYPE_INT_ARGB); // ARGB so alpha compositing works
     } catch (OutOfMemoryError er)
     {
       System.gc();
@@ -1702,7 +1710,7 @@ public class SeqCanvas extends JComponent implements ViewportListenerI
           }
           else
           {
-            fastPaint(scrollX, 0);
+          fastPaint(scrollX, 0);
           }
       }
       else if (eventName.equals(ViewportRanges.STARTSEQ))