Changeset 1183 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2008-12-27T12:26:33+01:00 (16 years ago)
Author:
stoecker
Message:

apply patch from #526, close #84

File:
1 edited

Legend:

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

    r1169 r1183  
    1616import java.awt.Point;
    1717import java.awt.Rectangle;
     18import java.awt.Toolkit;
    1819import java.awt.event.ActionEvent;
    1920import java.awt.event.ActionListener;
     
    522523
    523524    private static Icon loadScaledImage(File f, int maxSize) {
    524         Image img = new ImageIcon(f.getPath()).getImage();
     525        Image img = Toolkit.getDefaultToolkit().createImage(f.getPath());
     526        while (img.getWidth(null) < 0 || img.getHeight(null) < 0) {
     527          try {
     528            Thread.sleep(10);
     529          } catch(InterruptedException ie) {}
     530        }
    525531        int w = img.getWidth(null);
    526532        int h = img.getHeight(null);
     
    536542
    537543    private static BufferedImage createResizedCopy(Image originalImage,
    538             int scaledWidth, int scaledHeight)
     544    int scaledWidth, int scaledHeight)
    539545    {
    540546        BufferedImage scaledBI = new BufferedImage(scaledWidth, scaledHeight, BufferedImage.TYPE_INT_RGB);
    541547        Graphics2D g = scaledBI.createGraphics();
    542 
    543         g.drawImage(originalImage, 0, 0, scaledWidth, scaledHeight, null);
     548        while (!g.drawImage(originalImage, 0, 0, scaledWidth, scaledHeight, null))
     549        {
     550          try {
     551            Thread.sleep(10);
     552          } catch(InterruptedException ie) {}
     553        }
    544554        g.dispose();
    545555        return scaledBI;
Note: See TracChangeset for help on using the changeset viewer.