JAL-1291 conditional output of rendering debugging info
[jalview.git] / src / jalview / renderer / AnnotationRenderer.java
index fcdd77d..dd275bd 100644 (file)
@@ -42,10 +42,22 @@ import com.stevesoft.pat.Regex;
 
 public class AnnotationRenderer
 {
+  /**
+   * flag indicating if timing and redraw parameter info should be output
+   */
+  private final boolean debugRedraw;
 
   public AnnotationRenderer()
   {
-    // TODO Auto-generated constructor stub
+    this(false);
+  }
+  /**
+   * Create a new annotation Renderer
+   * @param debugRedraw flag indicating if timing and redraw parameter info should be output
+   */
+  public AnnotationRenderer(boolean debugRedraw)
+  {
+    this.debugRedraw=debugRedraw;
   }
 
   public void drawStemAnnot(Graphics g, Annotation[] row_annotations,
@@ -153,11 +165,12 @@ public class AnnotationRenderer
   /**
    * indicate if the renderer should only render the visible portion of the annotation given the current view settings
    */
-  private boolean useClip=false;
+  private boolean useClip=true;
   /**
    * master flag indicating if renderer should ever try to clip. not enabled for jalview 2.8.1 
    */
   private boolean canClip=false;
+  
   // public void updateFromAnnotationPanel(FontMetrics annotFM, AlignViewportI
   // av)
   public void updateFromAwtRenderPanel(AwtRenderPanelI annotPanel,
@@ -282,6 +295,7 @@ public class AnnotationRenderer
           AlignViewportI av, Graphics g, int activeRow, int startRes,
           int endRes)
   {
+    long stime=System.currentTimeMillis();
     boolean usedFaded = false;
     // NOTES:
     // AnnotationPanel needs to implement: ImageObserver, access to
@@ -678,20 +692,27 @@ public class AnnotationRenderer
         y += aa[i].height;
       }
     }
-    if (canClip)
+    if (debugRedraw)
     {
-      if (clipst)
+      if (canClip)
       {
-        System.err.println("Start clip at : " + yfrom + " (index " + f_i
-                + ")");
-      }
-      if (clipend)
-      {
-        System.err
-                .println("End clip at : " + yto + " (index " + f_to + ")");
+        if (clipst)
+        {
+          System.err.println("Start clip at : " + yfrom + " (index " + f_i
+                  + ")");
+        }
+        if (clipend)
+        {
+          System.err.println("End clip at : " + yto + " (index " + f_to
+                  + ")");
+        }
       }
+      ;
+      System.err.println("Annotation Rendering time:"
+              + (System.currentTimeMillis() - stime));
     }
     ;
+
     return !usedFaded;
   }