int tsize_height_delta = tileSize.height / 2;
int tsize_height_delta = tileSize.height / 2 == 0 ? 1 : tileSize.height / 2;
    protected void paintLayer(Graphics g, TileLayer layer, double zoom) {        ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING,                                         RenderingHints.VALUE_ANTIALIAS_ON);        // Determine tile size and offset        Dimension tileSize = getTileSize(zoom);        int tsize_width_delta = tileSize.width / 2;        int tsize_height_delta = tileSize.height / 2;        // Determine area to draw from clipping rectangle        Rectangle clipRect = g.getClipBounds();        clipRect.height += myMap.getTileHeightMax() * zoom - tileSize.height;        int logical_row_max =            (clipRect.y + clipRect.height) / (tsize_height_delta) + 1;        int originx = (myMap.getHeight() - 1) * (tileSize.width / 2);        // Draw this map layer        for (int logical_row = Math.max(clipRect.y / tsize_height_delta - 1, 0); logical_row < logical_row_max; logical_row++) {            int x = Math.max(logical_row - (myMap.getHeight() - 1), 0);            int y = Math.min(logical_row, myMap.getHeight() - 1);            int gx = Math.abs(originx - logical_row * tsize_width_delta);            int gy = (logical_row * tsize_height_delta) /*- clipRect.y*/;            Polygon gridPoly = createGridPolygon(gx, gy, 1);            while (x <= Math.min(logical_row, myMap.getWidth() - 1) &&                    y >= Math.max(logical_row-(myMap.getWidth() - 1), 0)) {                Tile t = layer.getTileAt(x, y);                if (t != null && t != myMap.getNullTile()) {                    if (SelectionLayer.class.isInstance(layer)) {                        g.fillPolygon(gridPoly);                        //paintEdge(g, layer, gx, gy);                    } else {                        t.draw(g, gx, gy, zoom);                    }                }                x++;                y--;                gx += tileSize.width;                gridPoly.translate(tileSize.width, 0);            }        }    }	