int height = getHeight();
g.setColor(Color.BLACK);
int x, lastx = 0, y, lasty = 0;
SparseIntVector extentCopy;
int maxDimension;
synchronized (lock) {
if (extent == null) {
return;
}
extentCopy = extent.duplicate();
maxDimension = dimension != 0 ? dimension : extentCopy.size();
}
if (maxDimension <= 32) {
lastx = 0;
for (int i = 0; i < maxDimension; i++) {
x = ((i + 1) * width) / maxDimension;
for (int j = 0; j < extentCopy.get(i); j++) {
g.fillRect(lastx, height - (j + 1) * LEVELHEIGHT, x - lastx - 1, LEVELHEIGHT - 1);
}
lastx = x;
}
} else {
for (int i = 0; i < maxDimension; i++) {
x = (int)(((i + 0.5) * width) / maxDimension);
y = height - extentCopy.get(i) * LEVELHEIGHT;
if (i > 0) {
g.drawLine(lastx, lasty, x, y);
}
lastx = x;
lasty = y;