X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FIdCanvas.java;h=1a8e79fb6175eab09b01de632fea18b0931e1aef;hb=023163e0fe8837c1ddb75eb30abc058f7747b5c2;hp=793c005ed861d9bbf37f26bab3cb01b8f8628475;hpb=78f5bbe9330cbf3d686d1a5c411956e091c88541;p=jalview.git diff --git a/src/jalview/gui/IdCanvas.java b/src/jalview/gui/IdCanvas.java index 793c005..1a8e79f 100755 --- a/src/jalview/gui/IdCanvas.java +++ b/src/jalview/gui/IdCanvas.java @@ -20,10 +20,6 @@ */ package jalview.gui; -import jalview.datamodel.SequenceI; -import jalview.viewmodel.ViewportListenerI; -import jalview.viewmodel.ViewportRanges; - import java.awt.BorderLayout; import java.awt.Color; import java.awt.Font; @@ -37,6 +33,10 @@ import java.util.List; import javax.swing.JPanel; +import jalview.datamodel.SequenceI; +import jalview.viewmodel.ViewportListenerI; +import jalview.viewmodel.ViewportRanges; + /** * DOCUMENT ME! * @@ -55,7 +55,7 @@ public class IdCanvas extends JPanel implements ViewportListenerI BufferedImage image; - Graphics2D gg; +// Graphics2D gg; int imgHeight = 0; @@ -137,7 +137,7 @@ public class IdCanvas extends JPanel implements ViewportListenerI g.drawString(s.getDisplayId(av.getShowJVSuffix()), xPos, (((i - starty + 1) * charHeight) + ypos) - (charHeight / 5)); - if (hiddenRows) + if (hiddenRows && av.getShowHiddenMarkers()) { drawMarker(g, av, i, starty, ypos); } @@ -152,10 +152,11 @@ public class IdCanvas extends JPanel implements ViewportListenerI */ public void fastPaint(int vertical) { + /* * for now, not attempting fast paint of wrapped ids... */ - if (gg == null || av.getWrapAlignment()) + if (image == null || av.getWrapAlignment()) { repaint(); @@ -164,6 +165,7 @@ public class IdCanvas extends JPanel implements ViewportListenerI ViewportRanges ranges = av.getRanges(); + Graphics2D gg = image.createGraphics(); gg.copyArea(0, 0, getWidth(), imgHeight, 0, -vertical * av.getCharHeight()); @@ -200,6 +202,8 @@ public class IdCanvas extends JPanel implements ViewportListenerI gg.translate(0, -transY); + gg.dispose(); + fastPaint = true; // Call repaint on alignment panel so that repaints from other alignment @@ -217,8 +221,6 @@ public class IdCanvas extends JPanel implements ViewportListenerI @Override public void paintComponent(Graphics g) { - super.paintComponent(g); - g.setColor(Color.white); g.fillRect(0, 0, getWidth(), getHeight()); @@ -246,13 +248,15 @@ public class IdCanvas extends JPanel implements ViewportListenerI BufferedImage.TYPE_INT_RGB); } - gg = (Graphics2D) image.getGraphics(); + Graphics2D gg = image.createGraphics(); // Fill in the background gg.setColor(Color.white); gg.fillRect(0, 0, getWidth(), imgHeight); drawIds(gg, av, av.getRanges().getStartSeq(), av.getRanges().getEndSeq(), searchResults); + + gg.dispose(); g.drawImage(image, 0, 0, this); } @@ -320,6 +324,7 @@ public class IdCanvas extends JPanel implements ViewportListenerI if (hasHiddenRows || alignViewport.isDisplayReferenceSeq()) { g.setFont(getHiddenFont(sequence, alignViewport)); + fm = g.getFontMetrics(); } // Selected sequence colours @@ -359,7 +364,7 @@ public class IdCanvas extends JPanel implements ViewportListenerI g.drawString(string, xPos, (((i - startSeq) * charHeight) + charHeight) - (charHeight / 5)); - if (hasHiddenRows) + if (hasHiddenRows && av.getShowHiddenMarkers()) { drawMarker(g, alignViewport, i, startSeq, 0); }