if (tsize.width <= 0 || tsize.height <= 0) return;
if (tsize.width <= 0 || tsize.height <= 0) { return; }
    public void repaintRegion(Rectangle region) {        Dimension tsize = getTileSize();        if (tsize.width <= 0 || tsize.height <= 0) return;        int maxExtraHeight =                (int)(map.getTileHeightMax() * zoom - tsize.height);        // Calculate the visible corners of the region        int startX = region.x * tsize.width;        int startY = region.y * tsize.height - maxExtraHeight;        int endX = (region.x + region.width) * tsize.width;        int endY = (region.y + region.height) * tsize.height;        Rectangle dirty =            new Rectangle(startX, startY, endX - startX, endY - startY);        repaint(dirty);    }