From 3c9453277531bea753777d624e117e550820bd08 Mon Sep 17 00:00:00 2001 From: kiramt Date: Mon, 15 May 2017 15:50:07 +0100 Subject: [PATCH] JAL-2388 Add missed optimisation --- src/jalview/renderer/OverviewRenderer.java | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/jalview/renderer/OverviewRenderer.java b/src/jalview/renderer/OverviewRenderer.java index 69676c8..9291ca6 100644 --- a/src/jalview/renderer/OverviewRenderer.java +++ b/src/jalview/renderer/OverviewRenderer.java @@ -95,20 +95,27 @@ public class OverviewRenderer Math.round((colIndex + 1) * pixelsPerCol) - 1, miniMe.getWidth() - 1); - // determine the colour based on the sequence and column position - rgbcolor = getColumnColourFromSequence(seq, - hidden || cols.isHidden(alignmentCol), alignmentCol, finder); - - // fill in the appropriate number of pixels - for (int row = pixelRow; row <= endRow; ++row) + // don't do expensive colour determination if we're not going to use it + // NB this is important to avoid performance issues in the overview + // panel + if (pixelCol <= endCol) { - for (int col = pixelCol; col <= endCol; ++col) + // determine the colour based on the sequence and column position + rgbcolor = getColumnColourFromSequence(seq, + hidden || cols.isHidden(alignmentCol), alignmentCol, + finder); + + // fill in the appropriate number of pixels + for (int row = pixelRow; row <= endRow; ++row) { - miniMe.setRGB(col, row, rgbcolor); + for (int col = pixelCol; col <= endCol; ++col) + { + miniMe.setRGB(col, row, rgbcolor); + } } - } - pixelCol = endCol + 1; + pixelCol = endCol + 1; + } colIndex++; } pixelRow = endRow + 1; -- 1.7.10.2