git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-4001 Check --nousagestats before doing analytics in headless mode
[jalview.git]
/
src
/
jalview
/
gui
/
IdCanvas.java
diff --git
a/src/jalview/gui/IdCanvas.java
b/src/jalview/gui/IdCanvas.java
index
a925227
..
c94dee0
100755
(executable)
--- a/
src/jalview/gui/IdCanvas.java
+++ b/
src/jalview/gui/IdCanvas.java
@@
-55,7
+55,7
@@
public class IdCanvas extends JPanel implements ViewportListenerI
BufferedImage image;
BufferedImage image;
- Graphics2D gg;
+ // Graphics2D gg;
int imgHeight = 0;
int imgHeight = 0;
@@
-79,7
+79,7
@@
public class IdCanvas extends JPanel implements ViewportListenerI
this.av = av;
PaintRefresher.Register(this, av.getSequenceSetId());
av.getRanges().addPropertyChangeListener(this);
this.av = av;
PaintRefresher.Register(this, av.getSequenceSetId());
av.getRanges().addPropertyChangeListener(this);
- }
+ }
/**
* DOCUMENT ME!
/**
* DOCUMENT ME!
@@
-152,10
+152,11
@@
public class IdCanvas extends JPanel implements ViewportListenerI
*/
public void fastPaint(int vertical)
{
*/
public void fastPaint(int vertical)
{
+
/*
* for now, not attempting fast paint of wrapped ids...
*/
/*
* for now, not attempting fast paint of wrapped ids...
*/
- if (gg == null || av.getWrapAlignment())
+ if (image == null || av.getWrapAlignment())
{
repaint();
{
repaint();
@@
-164,6
+165,7
@@
public class IdCanvas extends JPanel implements ViewportListenerI
ViewportRanges ranges = av.getRanges();
ViewportRanges ranges = av.getRanges();
+ Graphics2D gg = image.createGraphics();
gg.copyArea(0, 0, getWidth(), imgHeight, 0,
-vertical * av.getCharHeight());
gg.copyArea(0, 0, getWidth(), imgHeight, 0,
-vertical * av.getCharHeight());
@@
-200,6
+202,8
@@
public class IdCanvas extends JPanel implements ViewportListenerI
gg.translate(0, -transY);
gg.translate(0, -transY);
+ gg.dispose();
+
fastPaint = true;
// Call repaint on alignment panel so that repaints from other alignment
fastPaint = true;
// Call repaint on alignment panel so that repaints from other alignment
@@
-217,43
+221,44
@@
public class IdCanvas extends JPanel implements ViewportListenerI
@Override
public void paintComponent(Graphics g)
{
@Override
public void paintComponent(Graphics g)
{
- super.paintComponent(g);
-
g.setColor(Color.white);
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(Color.white);
g.fillRect(0, 0, getWidth(), getHeight());
-
+
if (fastPaint)
{
fastPaint = false;
g.drawImage(image, 0, 0, this);
if (fastPaint)
{
fastPaint = false;
g.drawImage(image, 0, 0, this);
-
+
return;
}
return;
}
-
+
int oldHeight = imgHeight;
int oldHeight = imgHeight;
-
+
imgHeight = getHeight();
imgHeight -= (imgHeight % av.getCharHeight());
imgHeight = getHeight();
imgHeight -= (imgHeight % av.getCharHeight());
-
+
if (imgHeight < 1)
{
return;
}
if (imgHeight < 1)
{
return;
}
-
+
if (oldHeight != imgHeight || image.getWidth(this) != getWidth())
{
if (oldHeight != imgHeight || image.getWidth(this) != getWidth())
{
- image = new BufferedImage(getWidth(), imgHeight,
- BufferedImage.TYPE_INT_RGB);
+ image = new BufferedImage(getWidth(), imgHeight,
+ BufferedImage.TYPE_INT_RGB);
}
}
-
- gg = (Graphics2D) image.getGraphics();
-
+
+ Graphics2D gg = image.createGraphics();
+
// Fill in the background
gg.setColor(Color.white);
gg.fillRect(0, 0, getWidth(), imgHeight);
// Fill in the background
gg.setColor(Color.white);
gg.fillRect(0, 0, getWidth(), imgHeight);
-
- drawIds(gg, av, av.getRanges().getStartSeq(), av.getRanges().getEndSeq(), searchResults);
-
+
+ drawIds(gg, av, av.getRanges().getStartSeq(),
+ av.getRanges().getEndSeq(), searchResults);
+
+ gg.dispose();
+
g.drawImage(image, 0, 0, this);
}
g.drawImage(image, 0, 0, this);
}
@@
-269,14
+274,13
@@
public class IdCanvas extends JPanel implements ViewportListenerI
* @param endSeq
* @param selection
*/
* @param endSeq
* @param selection
*/
- void drawIds(Graphics2D g, AlignViewport alignViewport, final int startSeq,
- final int endSeq, List<SequenceI> selection)
+ void drawIds(Graphics2D g, AlignViewport alignViewport,
+ final int startSeq, final int endSeq, List<SequenceI> selection)
{
Font font = alignViewport.getFont();
if (alignViewport.isSeqNameItalics())
{
{
Font font = alignViewport.getFont();
if (alignViewport.isSeqNameItalics())
{
- setIdfont(new Font(font.getName(), Font.ITALIC,
- font.getSize()));
+ setIdfont(new Font(font.getName(), Font.ITALIC, font.getSize()));
}
else
{
}
else
{
@@
-320,6
+324,7
@@
public class IdCanvas extends JPanel implements ViewportListenerI
if (hasHiddenRows || alignViewport.isDisplayReferenceSeq())
{
g.setFont(getHiddenFont(sequence, alignViewport));
if (hasHiddenRows || alignViewport.isDisplayReferenceSeq())
{
g.setFont(getHiddenFont(sequence, alignViewport));
+ fm = g.getFontMetrics();
}
// Selected sequence colours
}
// Selected sequence colours
@@
-343,8
+348,7
@@
public class IdCanvas extends JPanel implements ViewportListenerI
g.setColor(currentColor);
int charHeight = alignViewport.getCharHeight();
g.setColor(currentColor);
int charHeight = alignViewport.getCharHeight();
- g.fillRect(0, (i - startSeq) * charHeight,
- getWidth(), charHeight);
+ g.fillRect(0, (i - startSeq) * charHeight, getWidth(), charHeight);
g.setColor(currentTextColor);
g.setColor(currentTextColor);
@@
-356,8
+360,9
@@
public class IdCanvas extends JPanel implements ViewportListenerI
xPos = panelWidth - fm.stringWidth(string) - 4;
}
xPos = panelWidth - fm.stringWidth(string) - 4;
}
- g.drawString(string, xPos, (((i - startSeq) * charHeight) + charHeight)
- - (charHeight / 5));
+ g.drawString(string, xPos,
+ (((i - startSeq) * charHeight) + charHeight)
+ - (charHeight / 5));
if (hasHiddenRows && av.getShowHiddenMarkers())
{
if (hasHiddenRows && av.getShowHiddenMarkers())
{
@@
-443,7
+448,8
@@
public class IdCanvas extends JPanel implements ViewportListenerI
* @param starty
* @param yoffset
*/
* @param starty
* @param yoffset
*/
- void drawMarker(Graphics2D g, AlignViewport alignViewport, int seqIndex, int starty, int yoffset)
+ void drawMarker(Graphics2D g, AlignViewport alignViewport, int seqIndex,
+ int starty, int yoffset)
{
SequenceI[] hseqs = alignViewport.getAlignment()
.getHiddenSequences().hiddenSequences;
{
SequenceI[] hseqs = alignViewport.getAlignment()
.getHiddenSequences().hiddenSequences;
@@
-486,8
+492,7
@@
public class IdCanvas extends JPanel implements ViewportListenerI
/*
* vertices of the triangle, below or above hidden seqs
*/
/*
* vertices of the triangle, below or above hidden seqs
*/
- int[] xPoints = new int[]
- { getWidth() - charHeight,
+ int[] xPoints = new int[] { getWidth() - charHeight,
getWidth() - charHeight, getWidth() };
int yShift = seqIndex - starty;
getWidth() - charHeight, getWidth() };
int yShift = seqIndex - starty;