\r
AlignViewport av;\r
\r
- public boolean paintFlag = false;\r
-\r
boolean showScores = false;\r
boolean displaySearch = false;\r
int [] searchResults = null;\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
\r
gg.translate(transX, transY);\r
\r
- drawPanel(gg, sr, er, ss, es, sr, ss, 0);\r
\r
+ drawPanel(gg, sr, er, ss, es, sr, ss, 0);\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
public void drawPanel(Graphics g1,int x1,int x2, int y1, int y2,int startx, int starty,int offset) {\r
\r
-\r
Graphics2D g = (Graphics2D)g1;\r
g.setFont(av.getFont());\r
RendererI sr = av.getRenderer();\r
/////////////////////////////\r
for (int i = y1 ; i < y2 ;i++)\r
{\r
- nextSeq = av.getAlignment().getSequenceAt(i);\r
+ nextSeq = av.alignment.getSequenceAt(i);\r
\r
sr.drawSequence(g, nextSeq, av.alignment.findAllGroups( nextSeq ),x1,x2,\r
(x1 - startx) * av.charWidth,\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 ;\r
\r
if (!inGroup)\r
{\r
!group.sequences.contains(av.alignment.getSequenceAt(i - 1)))\r
top = sy;\r
\r
+\r
oldY = sy;\r
inGroup = true;\r
if (group == av.getSelectionGroup())\r
{\r
if (inGroup)\r
{\r
-\r
g.drawLine(sx, oldY, sx, sy );\r
g.drawLine(sx+ex, oldY, sx+ex, sy );\r
+\r
if (top != -1)\r
+ {\r
g.drawLine(sx, top, sx + ex, top);\r
+ top =-1;\r
+ }\r
if (bottom != -1)\r
+ {\r
g.drawLine(sx, bottom, sx + ex, bottom);\r
+ bottom = -1;\r
+ }\r
+\r
\r
inGroup = false;\r
}\r
{\r
\r
if(top!=-1)\r
- g.drawLine(sx,top, sx+ex, top);\r
+ {\r
+ g.drawLine(sx, top, sx + ex, top);\r
+ top =-1;\r
+ }\r
if(bottom!=-1)\r
- g.drawLine(sx,bottom, sx+ex, bottom);\r
+ {\r
+ g.drawLine(sx, bottom-1, sx + ex, bottom-1);\r
+ bottom = -1;\r
\r
+ }\r
sy = offset + AlignmentUtil.getPixelHeight(starty, i, av.charHeight);\r
g.drawLine(sx, oldY, sx, sy );\r
g.drawLine(sx+ex, oldY, sx+ex, sy );\r
\r
searchResults = results;\r
\r
- paintFlag = true;\r
repaint();\r
}\r
\r