Changeset 2107 in josm for trunk/src/org


Ignore:
Timestamp:
2009-09-12T18:53:18+02:00 (15 years ago)
Author:
stoecker
Message:

close #3313 - patch by xeen - fix display problems with OpenJDK (hopefully)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MapView.java

    r2025 r2107  
    99import java.awt.Graphics2D;
    1010import java.awt.Point;
     11import java.awt.Rectangle;
    1112import java.awt.event.ComponentAdapter;
    1213import java.awt.event.ComponentEvent;
    1314import java.awt.event.MouseEvent;
    1415import java.awt.event.MouseMotionListener;
     16import java.awt.geom.Area;
    1517import java.awt.geom.GeneralPath;
    1618import java.awt.image.BufferedImage;
     
    366368        // draw world borders
    367369        tempG.setColor(Color.WHITE);
    368         GeneralPath path = new GeneralPath();
    369370        Bounds b = getProjection().getWorldBoundsLatLon();
    370371        double lat = b.min.lat();
     
    372373
    373374        Point p = getPoint(b.min);
     375
     376        GeneralPath path = new GeneralPath();
     377
    374378        path.moveTo(p.x, p.y);
    375 
    376379        double max = b.max.lat();
    377380        for(; lat <= max; lat += 1.0)
     
    399402        }
    400403
     404        int w = offscreenBuffer.getWidth();
     405        int h = offscreenBuffer.getHeight();
     406
     407        // Work around OpenJDK having problems when drawing out of bounds
     408        final Area border = new Area(path);
     409        // Make the viewport 1px larger in every direction to prevent an
     410        // additional 1px border when zooming in
     411        final Area viewport = new Area(new Rectangle(-1, -1, w + 2, h + 2));
     412        border.intersect(viewport);
     413        tempG.draw(border);
     414
    401415        if (playHeadMarker != null) {
    402416            playHeadMarker.paint(tempG, this);
    403417        }
    404         tempG.draw(path);
    405418
    406419        g.drawImage(offscreenBuffer, 0, 0, null);
Note: See TracChangeset for help on using the changeset viewer.