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 (parent:
2918e12
)
JAL-2665 fix resize
author
kiramt
<k.mourao@dundee.ac.uk>
Wed, 16 Aug 2017 11:20:16 +0000
(12:20 +0100)
committer
kiramt
<k.mourao@dundee.ac.uk>
Wed, 16 Aug 2017 11:20:16 +0000
(12:20 +0100)
src/jalview/gui/SeqCanvas.java
patch
|
blob
|
history
diff --git
a/src/jalview/gui/SeqCanvas.java
b/src/jalview/gui/SeqCanvas.java
index
3626383
..
6f63dd6
100755
(executable)
--- a/
src/jalview/gui/SeqCanvas.java
+++ b/
src/jalview/gui/SeqCanvas.java
@@
-296,8
+296,9
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
int transX = 0;
int transY = 0;
int transX = 0;
int transY = 0;
- gg.copyArea(horizontal * charWidth, vertical * charHeight, imgWidth,
- imgHeight, -horizontal * charWidth, -vertical * charHeight);
+ gg.copyArea(horizontal * charWidth, vertical * charHeight,
+ img.getWidth(), img.getHeight(), -horizontal * charWidth,
+ -vertical * charHeight);
if (horizontal > 0) // scrollbar pulled right, image to the left
{
if (horizontal > 0) // scrollbar pulled right, image to the left
{
@@
-318,7
+319,7
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
}
else
{
}
else
{
- transY = imgHeight - ((vertical + 1) * charHeight);
+ transY = img.getHeight() - ((vertical + 1) * charHeight);
}
}
else if (vertical < 0)
}
}
else if (vertical < 0)
@@
-360,15
+361,6
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
// selectImage will hold any selection we have
// lcimg is a local *copy* of img which we'll draw selectImage on top of
// selectImage will hold any selection we have
// lcimg is a local *copy* of img which we'll draw selectImage on top of
- if (img == null)
- {
- setupImage();
- }
- if (img == null)
- {
- return;
- }
-
BufferedImage selectImage = drawSelectionGroup();
if (fastPaint || (getVisibleRect().width != g.getClipBounds().width)
BufferedImage selectImage = drawSelectionGroup();
if (fastPaint || (getVisibleRect().width != g.getClipBounds().width)
@@
-380,6
+372,29
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
fastPaint = false;
return;
}
fastPaint = false;
return;
}
+
+ int width = getWidth();
+ int height = getHeight();
+
+ width -= (width % charWidth);
+ height -= (height % charHeight);
+
+ if ((width < 1) || (height < 1))
+ {
+ return;
+ }
+
+ if (img == null || width != img.getWidth() || height != img.getHeight())
+ {
+ img = setupImage();
+ gg = (Graphics2D) img.getGraphics();
+ gg.setFont(av.getFont());
+ }
+ if (img == null)
+ {
+ return;
+ }
+
if (av.antiAlias)
{
if (av.antiAlias)
{
@@
-388,7
+403,7
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
}
gg.setColor(Color.white);
}
gg.setColor(Color.white);
- gg.fillRect(0, 0, imgWidth, imgHeight);
+ gg.fillRect(0, 0, img.getWidth(), img.getHeight());
ViewportRanges ranges = av.getRanges();
if (av.getWrapAlignment())
ViewportRanges ranges = av.getRanges();
if (av.getWrapAlignment())
@@
-435,21
+450,20
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
repaint();
}
repaint();
}
- private void setupImage()
+ /*private void setupImage()
{
// this draws the whole of the alignment
imgWidth = getWidth();
imgHeight = getHeight();
{
// this draws the whole of the alignment
imgWidth = getWidth();
imgHeight = getHeight();
-
+
imgWidth -= (imgWidth % charWidth);
imgHeight -= (imgHeight % charHeight);
imgWidth -= (imgWidth % charWidth);
imgHeight -= (imgHeight % charHeight);
-
+
if ((imgWidth < 1) || (imgHeight < 1))
{
return;
}
if ((imgWidth < 1) || (imgHeight < 1))
{
return;
}
-
-
+
try
{
img = new BufferedImage(imgWidth, imgHeight,
try
{
img = new BufferedImage(imgWidth, imgHeight,
@@
-461,13
+475,13
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
System.gc();
System.err.println("SeqCanvas OutOfMemory Redraw Error.\n" + er);
new OOMWarning("Creating alignment image for display", er);
System.gc();
System.err.println("SeqCanvas OutOfMemory Redraw Error.\n" + er);
new OOMWarning("Creating alignment image for display", er);
-
+
return;
}
return;
}
+
+ }*/
- }
-
- private BufferedImage setupSelectionImage()
+ private BufferedImage setupImage()
{
BufferedImage lcimg = null;
{
BufferedImage lcimg = null;
@@
-1056,7
+1070,7
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
private BufferedImage drawSelectionGroup()
{
// get a new image of the correct size
private BufferedImage drawSelectionGroup()
{
// get a new image of the correct size
- BufferedImage selectionImage = setupSelectionImage();
+ BufferedImage selectionImage = setupImage();
if (selectionImage == null)
{
if (selectionImage == null)
{