Merge branch 'Jalview-JS/JAL-3253-applet' of https://source.jalview.org/git/jalview...
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 10 Oct 2019 14:15:34 +0000 (15:15 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 10 Oct 2019 14:15:34 +0000 (15:15 +0100)
src/jalview/renderer/seqfeatures/FeatureColourFinder.java

index ee40d83..531a187 100644 (file)
@@ -85,6 +85,7 @@ public class FeatureColourFinder
   public Color findFeatureColour(Color defaultColour, SequenceI seq,
           int column)
   {
+    new Color(defaultColour.getRGB());
     if (noFeaturesDisplayed())
     {
       return defaultColour;
@@ -99,10 +100,16 @@ public class FeatureColourFinder
     if (featureRenderer.getTransparency() != 1f)
     {
       g = goff;
-      if (defaultColour != null)
+      Color c = (defaultColour == null ? Color.white : defaultColour);
+      if (Platform.isJS())
       {
-        offscreenImage.setRGB(0, 0, defaultColour.getRGB());
+        // Clear the HTML5 canvas color.
+        // otherwise we get a smearing.
+        // For whatever reason, this is necessary BH 2019.10.01.
+        g.setColor(c);
+        g.fillRect(0, 0, 1, 1);
       }
+      offscreenImage.setRGB(0, 0, c.getRGB());
     }
 
     Color c = featureRenderer.findFeatureColour(seq, column + 1, g);