JAL-3397 impl.IntervalStore and nonc.IntervalStore unified api
[jalview.git] / src / jalview / renderer / seqfeatures / FeatureRenderer.java
index 9988076..c1bccb8 100644 (file)
@@ -42,6 +42,13 @@ public class FeatureRenderer extends FeatureRendererModel
   private static final AlphaComposite NO_TRANSPARENCY = AlphaComposite
           .getInstance(AlphaComposite.SRC_OVER, 1.0f);
 
+  /*
+   * persistent list used by JalviewJS; not threadsafe for Java
+   */
+  private List<SequenceFeature> overlaps = (Platform.isJS()
+          ? new ArrayList<>()
+          : null);
+
   /**
    * Constructor given a viewport
    * 
@@ -223,13 +230,6 @@ public class FeatureRenderer extends FeatureRendererModel
   @Override
   public Color findFeatureColour(SequenceI seq, int column, Graphics g)
   {
-    // BH 2019.08.01
-    // this is already checked in FeatureColorFinder
-    // if (!av.isShowSequenceFeatures())
-    // {
-    // return null;
-    // }
-
     // column is 'base 1' but getCharAt is an array index (ie from 0)
     if (Comparison.isGap(seq.getCharAt(column - 1)))
     {
@@ -266,8 +266,7 @@ public class FeatureRenderer extends FeatureRendererModel
    * applies), or null if no feature is drawn in the range given.
    * 
    * @param g
-   *          the graphics context to draw on (may be null only if t == 1 from
-   *          colourOnly==true)
+   *          the graphics context to draw on (null if no transparency applies)
    * @param seq
    * @param start
    *          start column
@@ -284,7 +283,6 @@ public class FeatureRenderer extends FeatureRendererModel
           final SequenceI seq, int start, int end, int y1,
           boolean colourOnly)
   {
-    // from SeqCanvas and OverviewRender
     /*
      * if columns are all gapped, or sequence has no features, nothing to do
      */
@@ -300,8 +298,7 @@ public class FeatureRenderer extends FeatureRendererModel
 
     updateFeatures();
 
-    if (transparency != 1f) // g cannot be null here if trans == 1f - BH // && g
-                            // != null)
+    if (transparency != 1f)
     {
       ((Graphics2D) g).setComposite(
               AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
@@ -439,10 +436,6 @@ public class FeatureRenderer extends FeatureRendererModel
     findAllFeatures();
   }
 
-  private List<SequenceFeature> overlaps = (Platform.isJS()
-          ? new ArrayList<>()
-          : null);
-
   /**
    * Returns the sequence feature colour rendered at the given column position,
    * or null if none found. The feature of highest render order (i.e. on top) is
@@ -454,12 +447,6 @@ public class FeatureRenderer extends FeatureRendererModel
    * colour for features enclosing a gapped column. Check for gap before calling
    * if different behaviour is wanted.
    * 
-   * BH 2019.07.30
-   * 
-   * Adds a result ArrayList to parameters in order to avoid an unnecessary
-   * construction of that for every pixel checked.
-   * 
-   * 
    * @param seq
    * @param column
    *          (1..)
@@ -484,6 +471,10 @@ public class FeatureRenderer extends FeatureRendererModel
         continue;
       }
 
+      /*
+       * field overlaps is used by JalviewJS to avoid object creation;
+       * not thread-safe for Java (Javascript is single-threaded)
+       */
       if (overlaps != null)
       {
         overlaps.clear();