git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
6907f4f
)
JAL-3502 improved fast paint of wrapped scales
bug/JAL-3502wrappedScale
author
gmungoc
<g.m.carstairs@dundee.ac.uk>
Thu, 16 Jan 2020 14:00:33 +0000
(14:00 +0000)
committer
gmungoc
<g.m.carstairs@dundee.ac.uk>
Thu, 16 Jan 2020 14:00:33 +0000
(14:00 +0000)
src/jalview/gui/SeqCanvas.java
patch
|
blob
|
history
diff --git
a/src/jalview/gui/SeqCanvas.java
b/src/jalview/gui/SeqCanvas.java
index
2832796
..
9689d5c
100755
(executable)
--- a/
src/jalview/gui/SeqCanvas.java
+++ b/
src/jalview/gui/SeqCanvas.java
@@
-194,24
+194,34
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
void drawVerticalScale(Graphics g, final int startx, final int endx,
final int ypos, final boolean left)
{
void drawVerticalScale(Graphics g, final int startx, final int endx,
final int ypos, final boolean left)
{
- int charHeight = av.getCharHeight();
- int charWidth = av.getCharWidth();
+ final int charHeight = av.getCharHeight();
+ final int charWidth = av.getCharWidth();
- int yPos = ypos + charHeight;
+ final int yPos = ypos + charHeight;
int startX = startx;
int endX = endx;
int startX = startx;
int endX = endx;
+ AlignmentI alignment = av.getAlignment();
if (av.hasHiddenColumns())
{
if (av.hasHiddenColumns())
{
- HiddenColumns hiddenColumns = av.getAlignment().getHiddenColumns();
+ HiddenColumns hiddenColumns = alignment.getHiddenColumns();
startX = hiddenColumns.visibleToAbsoluteColumn(startx);
endX = hiddenColumns.visibleToAbsoluteColumn(endx);
}
FontMetrics fm = getFontMetrics(av.getFont());
startX = hiddenColumns.visibleToAbsoluteColumn(startx);
endX = hiddenColumns.visibleToAbsoluteColumn(endx);
}
FontMetrics fm = getFontMetrics(av.getFont());
- for (int i = 0; i < av.getAlignment().getHeight(); i++)
+ /*
+ * white fill the space for the scale for correct 'fast paint'
+ * (repainting only changed regions of the image)
+ * (fillRect origin is top left of rectangle)
+ */
+ g.setColor(Color.white);
+ g.fillRect(0, ypos, left ? labelWidthWest : labelWidthEast,
+ (alignment.getHeight() * charHeight));
+
+ for (int i = 0; i < alignment.getHeight(); i++)
{
{
- SequenceI seq = av.getAlignment().getSequenceAt(i);
+ SequenceI seq = alignment.getSequenceAt(i);
/*
* find sequence position of first non-gapped position -
/*
* find sequence position of first non-gapped position -
@@
-236,15
+246,6
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
}
}
}
}
- /*
- * white fill the space for the scale
- */
- g.setColor(Color.white);
- int y = (yPos + (i * charHeight)) - (charHeight / 5);
- // fillRect origin is top left of rectangle
- g.fillRect(0, y - charHeight, left ? labelWidthWest : labelWidthEast,
- charHeight + 1);
-
if (value != -1)
{
/*
if (value != -1)
{
/*
@@
-257,6
+258,7
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
int labelLength = fm.stringWidth(valueAsString);
int xOffset = labelSpace - labelLength;
g.setColor(Color.black);
int labelLength = fm.stringWidth(valueAsString);
int xOffset = labelSpace - labelLength;
g.setColor(Color.black);
+ int y = (yPos + (i * charHeight)) - (charHeight / 5);
g.drawString(valueAsString, xOffset, y);
}
}
g.drawString(valueAsString, xOffset, y);
}
}