+ protected void mainLoop()
+ {
+ out: while (!redraw)
+ {
+ switch (state)
+ {
+ case STATE_INIT:
+ init();
+ state = STATE_NEXT;
+ continue;
+ case STATE_NEXT:
+ if (!rowIterator.hasNext())
+ {
+ state = STATE_DONE;
+ continue;
+ }
+ nextRow();
+ if (!loop())
+ {
+ continue;
+ }
+ return;
+ case STATE_DONE:
+ break out;
+ }
+ // Java will continue without a timeout
+ }
+ done();
+ }
+
+ private void init()
+ {
+ rowIterator = rows.iterator();
+ seqIndex = 0;
+ pixelRow = 0;
+ lastRowUpdate = 0;
+ lastUpdate = 0;
+ totalPixels = w * alignmentHeight;
+
+ if (showProgress)
+ {
+ changeSupport.firePropertyChange(UPDATE, -1, 0);
+ }
+
+ miniMe = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
+ WritableRaster raster = miniMe.getRaster();
+ DataBufferInt db = (DataBufferInt) raster.getDataBuffer();
+ Platform.timeCheck(null, Platform.TIME_MARK);
+ pixels = db.getBankData()[0];
+ bscol = cols.getOverviewBitSet();
+ }
+
+ private void nextRow()
+ {
+ row = rowIterator.next();
+ // System.out.println("OR row " + r);
+ // get details of this alignment row
+ SequenceI seq = rows.getSequence(row);
+
+ // rate limiting step when rendering overview for lots of groups
+ SequenceGroup[] allGroups = al.findAllGroups(seq);
+
+ // calculate where this row extends to in pixels
+ int endRow = Math.min(Math.round((++seqIndex) * pixelsPerSeq), h);
+ for (int pixelCol = 0, colNext = 0, pixelEnd = 0, icol = bscol
+ .nextSetBit(0); icol >= 0; icol = getNextCol(icol, pixelEnd))