diff --git a/src/org/openstreetmap/josm/gui/layer/geoimage/viewers/projections/Equirectangular.java b/src/org/openstreetmap/josm/gui/layer/geoimage/viewers/projections/Equirectangular.java
index f76b252344..de69efdc14 100644
|
a
|
b
|
public class Equirectangular extends ComponentAdapter implements IImageViewer {
|
| 47 | 47 | g.drawImage(currentOffscreenImage, target.x, target.y, target.x + target.width, target.y + target.height, |
| 48 | 48 | visibleRect.x, visibleRect.y, visibleRect.x + visibleRect.width, visibleRect.y + visibleRect.height, |
| 49 | 49 | null); |
| | 50 | if (currentOffscreenImage.getWidth() != image.getWidth() || currentOffscreenImage.getHeight() != image.getHeight()) { |
| | 51 | this.updateBufferedImageSize(image.getWidth(), image.getHeight()); |
| | 52 | } |
| 50 | 53 | } |
| 51 | 54 | |
| 52 | 55 | @Override |
| … |
… |
public class Equirectangular extends ComponentAdapter implements IImageViewer {
|
| 62 | 65 | @Override |
| 63 | 66 | public void componentResized(ComponentEvent e) { |
| 64 | 67 | final Component imgDisplay = e.getComponent(); |
| 65 | | if (e.getComponent().getWidth() > 0 |
| 66 | | && e.getComponent().getHeight() > 0) { |
| 67 | | // FIXME: Do something so that the types of the images are the same between the offscreenImage and |
| 68 | | // the image entry |
| 69 | | final CameraPlane currentCameraPlane; |
| 70 | | synchronized (this) { |
| 71 | | currentCameraPlane = this.cameraPlane; |
| 72 | | } |
| 73 | | final BufferedImage temporaryOffscreenImage = new BufferedImage(imgDisplay.getWidth(), imgDisplay.getHeight(), |
| 74 | | BufferedImage.TYPE_4BYTE_ABGR); |
| 75 | | |
| 76 | | Vector3D currentRotation = null; |
| 77 | | if (currentCameraPlane != null) { |
| 78 | | currentRotation = currentCameraPlane.getRotation(); |
| 79 | | } |
| 80 | | final CameraPlane temporaryCameraPlane = new CameraPlane(imgDisplay.getWidth(), imgDisplay.getHeight()); |
| 81 | | if (currentRotation != null) { |
| 82 | | temporaryCameraPlane.setRotation(currentRotation); |
| 83 | | } |
| 84 | | synchronized (this) { |
| 85 | | this.cameraPlane = temporaryCameraPlane; |
| 86 | | this.offscreenImage = temporaryOffscreenImage; |
| 87 | | } |
| | 68 | if (imgDisplay.getWidth() > 0 && imgDisplay.getHeight() > 0) { |
| | 69 | this.updateBufferedImageSize(imgDisplay.getWidth(), imgDisplay.getHeight()); |
| 88 | 70 | if (imgDisplay instanceof ImageDisplay) { |
| 89 | 71 | ((ImageDisplay) imgDisplay).updateVisibleRectangle(); |
| 90 | 72 | } |
| … |
… |
public class Equirectangular extends ComponentAdapter implements IImageViewer {
|
| 92 | 74 | } |
| 93 | 75 | } |
| 94 | 76 | |
| | 77 | /** |
| | 78 | * Update the buffered image size |
| | 79 | * @param width The width to use |
| | 80 | * @param height The height to use |
| | 81 | */ |
| | 82 | private void updateBufferedImageSize(final int width, final int height) { |
| | 83 | final CameraPlane currentCameraPlane; |
| | 84 | synchronized (this) { |
| | 85 | currentCameraPlane = this.cameraPlane; |
| | 86 | } |
| | 87 | // FIXME: Do something so that the types of the images are the same between the offscreenImage and |
| | 88 | // the image entry |
| | 89 | final BufferedImage temporaryOffscreenImage = new BufferedImage(width, height, |
| | 90 | BufferedImage.TYPE_4BYTE_ABGR); |
| | 91 | |
| | 92 | Vector3D currentRotation = null; |
| | 93 | if (currentCameraPlane != null) { |
| | 94 | currentRotation = currentCameraPlane.getRotation(); |
| | 95 | } |
| | 96 | final CameraPlane temporaryCameraPlane = new CameraPlane(width, height); |
| | 97 | if (currentRotation != null) { |
| | 98 | temporaryCameraPlane.setRotation(currentRotation); |
| | 99 | } |
| | 100 | synchronized (this) { |
| | 101 | this.cameraPlane = temporaryCameraPlane; |
| | 102 | this.offscreenImage = temporaryOffscreenImage; |
| | 103 | } |
| | 104 | } |
| | 105 | |
| 95 | 106 | @Override |
| 96 | 107 | public void mouseDragged(final Point from, final Point to, ImageDisplay.VisRect currentVisibleRect) { |
| 97 | 108 | if (from != null && to != null) { |