From: amwaterhouse Date: Tue, 25 Jul 2006 12:57:48 +0000 (+0000) Subject: Dont make new image unless resize X-Git-Tag: Release_2_1~215 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=6abefac67f193512eb944881446b206f891be06e;p=jalview.git Dont make new image unless resize --- diff --git a/src/jalview/gui/IdCanvas.java b/src/jalview/gui/IdCanvas.java index 5959493..d35a0f4 100755 --- a/src/jalview/gui/IdCanvas.java +++ b/src/jalview/gui/IdCanvas.java @@ -173,6 +173,8 @@ public class IdCanvas extends JPanel return; } + int oldHeight = imgHeight; + imgHeight = getHeight(); imgHeight -= (imgHeight % av.charHeight); @@ -181,15 +183,17 @@ public class IdCanvas extends JPanel return; } - image = new BufferedImage(getWidth(), imgHeight, - BufferedImage.TYPE_INT_RGB); - gg = (Graphics2D) image.getGraphics(); + if(oldHeight!=imgHeight) + { + image = new BufferedImage(getWidth(), imgHeight, + BufferedImage.TYPE_INT_RGB); + gg = (Graphics2D) image.getGraphics(); + } //Fill in the background gg.setColor(Color.white); gg.fillRect(0, 0, getWidth(), imgHeight); - drawIds(av.getStartSeq(), av.endSeq); g.drawImage(image, 0, 0, this);