From 8e828522d5642db3c70c0909e0b44244f9ec2605 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Thu, 7 Apr 2016 17:58:45 +0100 Subject: [PATCH] =?utf8?q?JAL-1722=20fix:=20don=E2=80=99t=20draw=20visible=20?= =?utf8?q?regions=20outside=20viewport=20view?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/jalview/appletgui/SeqCanvas.java | 8 ++++++++ src/jalview/gui/SeqCanvas.java | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/jalview/appletgui/SeqCanvas.java b/src/jalview/appletgui/SeqCanvas.java index ce70597..024fdc7 100755 --- a/src/jalview/appletgui/SeqCanvas.java +++ b/src/jalview/appletgui/SeqCanvas.java @@ -276,6 +276,7 @@ public class SeqCanvas extends Panel * at 0). NOTE 1: The av limits are set in setFont in this class and in the * adjustment listener in SeqPanel when the scrollbars move. */ + @Override public void update(Graphics g) { paint(g); @@ -573,10 +574,17 @@ public class SeqCanvas extends Panel g1.translate(-screenY * avcharWidth, 0); screenY += blockEnd - blockStart + 1; blockStart = hideEnd + 1; + + if (screenY > (endRes - startRes)) + { + // already rendered last block + return; + } } } if (screenY <= (endRes - startRes)) { + // remaining visible region to render blockEnd = blockStart + (endRes - startRes) - screenY; g1.translate(screenY * avcharWidth, 0); draw(g1, blockStart, blockEnd, startSeq, endSeq, offset); diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index 5706fe7..0f24b4b 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -335,6 +335,7 @@ public class SeqCanvas extends JComponent */ // Set this to false to force a full panel paint + @Override public void paintComponent(Graphics g) { updateViewport(); @@ -682,10 +683,17 @@ public class SeqCanvas extends JComponent g1.translate(-screenY * charWidth, 0); screenY += blockEnd - blockStart + 1; blockStart = hideEnd + 1; + + if (screenY > (endRes - startRes)) + { + // already rendered last block + return; + } } if (screenY <= (endRes - startRes)) { + // remaining visible region to render blockEnd = blockStart + (endRes - startRes) - screenY; g1.translate(screenY * charWidth, 0); draw(g1, blockStart, blockEnd, startSeq, endSeq, offset); -- 1.7.10.2