Changeset 1183 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2008-12-27T12:26:33+01:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/GeoImageLayer.java
r1169 r1183 16 16 import java.awt.Point; 17 17 import java.awt.Rectangle; 18 import java.awt.Toolkit; 18 19 import java.awt.event.ActionEvent; 19 20 import java.awt.event.ActionListener; … … 522 523 523 524 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 } 525 531 int w = img.getWidth(null); 526 532 int h = img.getHeight(null); … … 536 542 537 543 private static BufferedImage createResizedCopy(Image originalImage, 538 544 int scaledWidth, int scaledHeight) 539 545 { 540 546 BufferedImage scaledBI = new BufferedImage(scaledWidth, scaledHeight, BufferedImage.TYPE_INT_RGB); 541 547 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 } 544 554 g.dispose(); 545 555 return scaledBI;
Note:
See TracChangeset
for help on using the changeset viewer.