From 007eb4e0c158767efa9f91f44a0154cdbb17962d Mon Sep 17 00:00:00 2001 From: kiramt Date: Mon, 6 Nov 2017 09:25:18 +0000 Subject: [PATCH] JAL-2778 tidy --- src/jalview/gui/AnnotationPanel.java | 5 ++++- src/jalview/gui/IdCanvas.java | 11 +++++++---- src/jalview/gui/ScalePanel.java | 6 +++++- src/jalview/gui/SeqCanvas.java | 22 +++++++++++++++------- 4 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index 0d86b07..cf51781 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -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; diff --git a/src/jalview/gui/IdCanvas.java b/src/jalview/gui/IdCanvas.java index 1ee281a..6c309a2 100755 --- a/src/jalview/gui/IdCanvas.java +++ b/src/jalview/gui/IdCanvas.java @@ -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(); diff --git a/src/jalview/gui/ScalePanel.java b/src/jalview/gui/ScalePanel.java index e9cb04f..b135fc1 100755 --- a/src/jalview/gui/ScalePanel.java +++ b/src/jalview/gui/ScalePanel.java @@ -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(); } } diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index a717a17..ce835a3 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -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)) -- 1.7.10.2