From: Jim Procter Date: Fri, 24 May 2013 12:27:06 +0000 (+0100) Subject: JAL-1291 conditional output of rendering debugging info X-Git-Tag: Jalview_2_9~249^2~4 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=5ce14d0655d90366eea64987ee82555a02cf7998;p=jalview.git JAL-1291 conditional output of rendering debugging info --- diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index 6df2088..7d8a596 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -831,6 +831,8 @@ public class AnnotationLabels extends JPanel implements MouseListener, { drawComponent(g, false, width); } + + private final boolean debugRedraw = false; /** * Draw the full set of annotation Labels for the alignment at the given cursor * @@ -893,7 +895,9 @@ public class AnnotationLabels extends JPanel implements MouseListener, { if (!before) { - System.out.println("before vis: "+i); + if (debugRedraw) { + System.out.println("before vis: "+i); + } before=true; } // don't draw what isn't visible @@ -904,7 +908,9 @@ public class AnnotationLabels extends JPanel implements MouseListener, if (!after) { - System.out.println("Scroll offset: "+sOffset+" after vis: "+i); + if (debugRedraw) { + System.out.println("Scroll offset: "+sOffset+" after vis: "+i); + } after=true; } // don't draw what isn't visible diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index ed7f359..eb21dbc 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -800,7 +800,10 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, imageFresh = false; g.drawImage(image, 0, 0, this); } - + /** + * set true to enable redraw timing debug output on stderr + */ + private final boolean debugRedraw = false; /** * non-Thread safe repaint * @@ -809,7 +812,6 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, */ public void fastPaint(int horizontal) { - if ((horizontal == 0) || gg == null || av.getAlignment().getAlignmentAnnotation() == null || av.getAlignment().getAlignmentAnnotation().length < 1 @@ -818,8 +820,9 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, repaint(); return; } + long stime=System.currentTimeMillis(); gg.copyArea(0, 0, imgWidth, getHeight(), -horizontal * av.charWidth, 0); - + long mtime=System.currentTimeMillis(); int sr = av.startRes; int er = av.endRes + 1; int transX = 0; @@ -839,9 +842,13 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, drawComponent(gg, sr, er); gg.translate(-transX, 0); - + long dtime=System.currentTimeMillis(); fastPaint = true; repaint(); + long rtime=System.currentTimeMillis(); + if (debugRedraw) { + System.err.println("Scroll:\t"+horizontal+"\tCopyArea:\t"+(mtime-stime)+"\tDraw component:\t"+(dtime-mtime)+"\tRepaint call:\t"+(rtime-dtime)); + } } diff --git a/src/jalview/renderer/AnnotationRenderer.java b/src/jalview/renderer/AnnotationRenderer.java index fcdd77d..dd275bd 100644 --- a/src/jalview/renderer/AnnotationRenderer.java +++ b/src/jalview/renderer/AnnotationRenderer.java @@ -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; }