JAL-2609 clear sequence/annotation region before rendering
[jalview.git] / src / jalview / gui / SeqCanvas.java
index 7eb356b..9ebf377 100755 (executable)
@@ -628,8 +628,8 @@ public class SeqCanvas extends JComponent implements ViewportListenerI
 
     /*
      * move right before drawing by the width of the scale left (if any)
-     * plus column offset from left margin (usually zero, but may not be
-     * when fast painting draws just a few columns)
+     * plus column offset from left margin (usually zero, but may be non-zero
+     * when fast painting is drawing just a few columns)
      */
     int xOffset = labelWidthWest
             + ((startColumn - ranges.getStartRes()) % viewportWidth)
@@ -650,6 +650,14 @@ public class SeqCanvas extends JComponent implements ViewportListenerI
               viewportWidth * charWidth, (int) clip.getBounds().getHeight());
     }
 
+    /*
+     * white fill the region to be drawn (so incremental fast paint doesn't
+     * scribble over an existing image)
+     */
+    gg.setColor(Color.white);
+    gg.fillRect(0, ypos, (endx - startColumn + 1) * charWidth,
+            wrappedRepeatHeightPx);
+
     drawPanel(g, startColumn, endx, 0, av.getAlignment().getHeight() - 1,
             ypos);