From ce78438036915fc817cc6f4dd4294b3bc4a3c270 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Thu, 16 Mar 2006 15:14:28 +0000 Subject: [PATCH] Reduced arguments for speed --- src/jalview/appletgui/SequenceRenderer.java | 33 ++++++++++++--------------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/jalview/appletgui/SequenceRenderer.java b/src/jalview/appletgui/SequenceRenderer.java index 0fa8b2e..3f87b02 100755 --- a/src/jalview/appletgui/SequenceRenderer.java +++ b/src/jalview/appletgui/SequenceRenderer.java @@ -84,33 +84,31 @@ public class SequenceRenderer public Color findSequenceColour(SequenceI seq, int i) { allGroups = av.alignment.findAllGroups(seq); - drawBoxes(seq, i,i, 0, 0, 1,1); + drawBoxes(seq, i,i, 0); return resBoxColour; } public void drawSequence(Graphics g, SequenceI seq, SequenceGroup[] sg, - int start, int end, int x1, int y1, int width, - int height) + int start, int end, int y1) { allGroups = sg; graphics = g; - drawBoxes(seq, start, end, x1, y1, (int) width, height); + drawBoxes(seq, start, end, y1); fm = g.getFontMetrics(); - drawText(seq, start, end, x1, y1, (int) width, height); + drawText(seq, start, end, y1); } - public void drawBoxes(SequenceI seq, int start, int end, int x1, int y1, - int width, int height) + public void drawBoxes(SequenceI seq, int start, int end, int y1) { int i = start; int length = seq.getLength(); int curStart = -1; - int curWidth = width; + int curWidth = av.charWidth; Color tempColour = null; while (i <= end) @@ -136,32 +134,31 @@ public class SequenceRenderer { if (tempColour != null) { - graphics.fillRect(x1 + width * (curStart - start), y1, curWidth, - height); + graphics.fillRect(av.charWidth * (curStart - start), y1, curWidth, + av.charHeight); } graphics.setColor(resBoxColour); curStart = i; - curWidth = width; + curWidth = av.charWidth; tempColour = resBoxColour; } else { - curWidth += width; + curWidth += av.charWidth; } i++; } - graphics.fillRect(x1 + width * (curStart - start), y1, curWidth, height); + graphics.fillRect(av.charWidth * (curStart - start), y1, curWidth, av.charHeight); } - public void drawText(SequenceI seq, int start, int end, int x1, int y1, - int width, int height) + public void drawText(SequenceI seq, int start, int end, int y1) { - y1 += height - height / 5; // height/5 replaces pady + y1 += av.charHeight - av.charHeight / 5; // height/5 replaces pady int charOffset = 0; @@ -215,9 +212,9 @@ public class SequenceRenderer } } - charOffset = (width - fm.charWidth(s)) / 2; + charOffset = (av.charWidth - fm.charWidth(s)) / 2; graphics.drawString(String.valueOf(s), - charOffset + x1 + width * (i - start), + charOffset + av.charWidth * (i - start), y1 ); } -- 1.7.10.2