- int target = c.col;
- for(boolean stop = false;;) {
- for(int i=0; i<=numregions; i++) {
- if (i == numregions) { regions[numregions++] = target; break; }
- if (target == regions[i]) break;
- if (target < regions[i]) { int tmp = target; target = regions[i]; regions[i] = tmp; }
- }
- if (stop) break;
- stop = true;
- target = min(cols, c.col+c.colspan);
- }
+ regions[numregions++] = c.col;
+ regions[numregions++] = min(cols, c.col+c.colspan);
+ }
+ Vec.sortInts(regions, 0, numregions);
+ int j = 0;
+ int newnumregions = numregions;
+ for(int i=1; i<numregions; i++) {
+ if (regions[j] != regions[i]) j++;
+ else newnumregions--;
+ regions[j] = regions[i];