FontMetrics fm;\r
int imgWidth=0;\r
\r
+ boolean fastPaint = false;\r
\r
\r
\r
g.setColor(Color.white);\r
g.fillRect(0,0,getWidth(), getHeight());\r
\r
+ if(fastPaint)\r
+ {\r
+ g.drawImage(image, 0, 0, this);\r
+ fastPaint = false;\r
+ return;\r
+ }\r
+\r
imgWidth = (av.endRes-av.startRes+1) *av.charWidth;\r
\r
image = new BufferedImage(imgWidth,\r
\r
gg.translate( -transX, 0 );\r
\r
- getGraphics().drawImage(image, 0, 0, this);\r
+ fastPaint = true;\r
+ repaint();\r
}\r
\r
\r
BufferedImage image;\r
Graphics2D gg;\r
int imgHeight=0;\r
+ boolean fastPaint = false;\r
\r
public IdCanvas(AlignViewport av)\r
{\r
\r
public void fastPaint(int vertical)\r
{\r
- if(image==null)\r
- {\r
- repaint();\r
- return;\r
- }\r
+ if(gg==null)\r
+ { repaint(); return;}\r
\r
gg.copyArea( 0,0, getWidth(), imgHeight, 0, -vertical*av.charHeight );\r
\r
gg.translate( 0, -transY );\r
\r
\r
- getGraphics().drawImage(image, 0, 0, this);\r
+ fastPaint = true;\r
+ repaint();\r
}\r
\r
public void paintComponent(Graphics g)\r
{\r
+ g.setColor(Color.white);\r
+ g.fillRect(0, 0, getWidth(), getHeight());\r
+\r
+ if (fastPaint)\r
+ {\r
+ g.drawImage(image, 0, 0, this);\r
+ fastPaint = false;\r
+ return;\r
+ }\r
+\r
imgHeight = getHeight();\r
imgHeight -= imgHeight % av.charHeight;\r
image = new BufferedImage(getWidth(), imgHeight, BufferedImage.TYPE_INT_RGB);\r
av.getFont().getSize());\r
gg.setFont(italic);\r
\r
-\r
- g.setColor(Color.white);\r
- g.fillRect(0,0,getWidth(),getHeight());\r
-\r
drawIds( av.getStartSeq(), av.endSeq);\r
\r
g.drawImage(image, 0, 0, this);\r
\r
AlignViewport av;\r
\r
- public boolean paintFlag = false;\r
+ // public boolean paintFlag = false;\r
\r
boolean showScores = false;\r
boolean displaySearch = false;\r
int chunkHeight;\r
int chunkWidth;\r
\r
+ boolean fastPaint = false;\r
+\r
\r
public SeqCanvas(AlignViewport av)\r
{\r
if (horizontal == 0 && vertical == 0)\r
return;\r
\r
- if (img == null || paintFlag)\r
- {\r
- repaint();\r
- return;\r
- }\r
-\r
gg.copyArea(0, 0, imgWidth, imgHeight, -horizontal * av.charWidth,\r
-vertical * av.charHeight);\r
\r
drawPanel(gg, sr, er, ss, es, sr, ss, 0);\r
\r
gg.translate( -transX, -transY);\r
- getGraphics().drawImage(img, 0, 0, this);\r
+\r
+ fastPaint = true;\r
+ repaint();\r
\r
}\r
\r
\r
public void paintComponent(Graphics g)\r
{\r
+ g.setColor(Color.white);\r
+ g.fillRect(0, 0, getWidth(), getHeight());\r
+\r
+ if (fastPaint)\r
+ {\r
+ g.drawImage(img, 0, 0, this);\r
+ fastPaint = false;\r
+ return;\r
+ }\r
+\r
// this draws the whole of the alignment\r
imgWidth = getWidth();\r
imgHeight = getHeight();\r
gg = (Graphics2D)img.getGraphics();\r
gg.setFont(av.getFont());\r
gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);\r
- paintFlag = false;\r
\r
gg.setColor(Color.white);\r
gg.fillRect(0,0,imgWidth,imgHeight);\r
else\r
drawPanel(gg, av.startRes, av.endRes, av.startSeq, av.endSeq, av.startRes, av.startSeq, 0);\r
\r
- g.setColor(Color.white);\r
- g.fillRect(0,0,getWidth(),getHeight());\r
- g.drawImage(img,0,0,this);\r
+ g.drawImage(img, 0, 0, this);\r
\r
}\r
\r
\r
if (bottom == -1 &&\r
!group.sequences.contains(av.alignment.getSequenceAt(i + 1)))\r
- bottom = sy + av.charHeight - 1;\r
+ bottom = sy + av.charHeight -1;\r
\r
if (!inGroup)\r
{\r
\r
searchResults = results;\r
\r
- paintFlag = true;\r
repaint();\r
}\r
\r