From: amwaterhouse Date: Wed, 6 Apr 2005 17:13:33 +0000 (+0000) Subject: fill in the gaps X-Git-Tag: Release_2_0~482 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e21877065e4f51b0d74af7e6627a62835a7121f2;p=jalview.git fill in the gaps --- diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index de421ed..ef11e2d 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -55,52 +55,42 @@ public class SeqCanvas extends JPanel public void fastPaint(int horizontal, int vertical) { - if(horizontal==0 && vertical==0) - { - return; - } - + if (horizontal == 0 && vertical == 0) + return; - if (img==null || paintFlag) - { + if (img == null || paintFlag) + { repaint(); return; - } - - gg.copyArea( 0,0, imgWidth, imgHeight, -horizontal*av.charWidth, -vertical*av.charHeight ); - - int sr=av.startRes, er=av.endRes+1, ss = av.startSeq, es = av.endSeq, transX=0, transY = 0; - if(horizontal>0) // scrollbar pulled right, image to the left - { - transX = (er-sr-horizontal)*av.charWidth; - sr = er - horizontal ; - } - else if(horizontal<0) - { - er = sr-horizontal; - } - - - + } - if(vertical>0) // scroll down - { - transY = imgHeight - vertical*av.charHeight; - ss = es - vertical; - } - else if(vertical<0) - { + gg.copyArea(0, 0, imgWidth, imgHeight, -horizontal * av.charWidth, + -vertical * av.charHeight); - es = ss-vertical; + int sr = av.startRes, er = av.endRes + 1, ss = av.startSeq, es = av.endSeq, + transX = 0, transY = 0; + if (horizontal > 0) // scrollbar pulled right, image to the left + { + transX = (er - sr - horizontal) * av.charWidth; + sr = er - horizontal; + } + else if (horizontal < 0) + er = sr - horizontal; - } + else if (vertical > 0) // scroll down + { + transY = imgHeight - vertical * av.charHeight; + ss = es - vertical; + } + else if (vertical < 0) + es = ss - vertical; gg.translate(transX, transY); - drawPanel(gg, sr,er,ss,es,sr,ss,0); + drawPanel(gg, sr, er, ss, es, sr, ss, 0); - gg.translate( -transX, -transY ); - getGraphics().drawImage(img,0,0,this); + gg.translate( -transX, -transY); + getGraphics().drawImage(img, 0, 0, this); } @@ -118,7 +108,6 @@ public void fastPaint(int horizontal, int vertical) public void paintComponent(Graphics g) { // this draws the whole of the alignment - imgWidth = getWidth(); imgHeight = getHeight(); @@ -129,9 +118,10 @@ public void fastPaint(int horizontal, int vertical) gg = (Graphics2D)img.getGraphics(); gg.setFont(av.getFont()); gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON); - gg.setClip(0,0,imgWidth, imgHeight); paintFlag = false; + gg.setColor(Color.white); + gg.fillRect(0,0,imgWidth,imgHeight); chunkWidth = getWidth()/av.charWidth; chunkHeight = (av.getAlignment().getHeight() + 2)*av.charHeight; @@ -139,15 +129,14 @@ public void fastPaint(int horizontal, int vertical) av.setChunkHeight(chunkHeight); av.setChunkWidth(chunkWidth); - g.setColor(Color.WHITE); - g.fillRect(0,0,getWidth(), getHeight()); if (av.getWrapAlignment()) drawWrappedPanel(gg, getWidth(), getHeight(), av.startRes); else drawPanel(gg, av.startRes, av.endRes, av.startSeq, av.endSeq, av.startRes, av.startSeq, 0); - + g.setColor(Color.white); + g.fillRect(0,0,getWidth(),getHeight()); g.drawImage(img,0,0,this); }