From 6abefac67f193512eb944881446b206f891be06e Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Tue, 25 Jul 2006 12:57:48 +0000 Subject: [PATCH] Dont make new image unless resize --- src/jalview/gui/IdCanvas.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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); -- 1.7.10.2