Polygon gridPoly = createGridPolygon(gx, gy, 1);
Polygon gridPoly = createGridPolygon(gx, gy, 0);
    protected void paint(Graphics g, MapLayer layer, double zoom) {        // Determine tile size and offset        Dimension tsize = getTileSize(zoom);        if (tsize.width <= 0 || tsize.height <= 0) return;        int toffset = (((modeFlags & PF_GRIDMODE) != 0) ? 1 : 0);        // Determine area to draw from clipping rectangle        Rectangle clipRect = g.getClipBounds();        int startX = clipRect.x / tsize.width;        int startY = clipRect.y / tsize.height;        int endX = (clipRect.x + clipRect.width) / tsize.width + 1;        int endY = (clipRect.y + clipRect.height) / tsize.height + 3;        // (endY +2 for high tiles, could be done more properly)        // Draw this map layer        for (int y = startY, gy = startY * tsize.height + toffset;                y < endY; y++, gy += tsize.height) {            for (int x = startX, gx = startX * tsize.width + toffset;                    x < endX; x++, gx += tsize.width) {                Tile t = layer.getTileAt(x, y);                if (t != null && t != myMap.getNullTile()) {                    if (SelectionLayer.class.isInstance(layer)) {                        Polygon gridPoly = createGridPolygon(gx, gy, 1);                        g.fillPolygon(gridPoly);                        //paintEdge(g, layer, gx, gy);                    } else {                        t.draw(g, gx, gy, zoom);                    }                }            }        }    }