Index: trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java	(revision 11889)
+++ trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java	(revision 11891)
@@ -1444,12 +1444,11 @@
         TileXY t1, t2;
         if (coordinateConverter.requiresReprojection()) {
-            Projection projCurrent = Main.getProjection();
             Projection projServer = Projections.getProjectionByCode(tileSource.getServerCRS());
-            bounds = new ProjectionBounds(
+            ProjectionBounds projBounds = new ProjectionBounds(
                     new EastNorth(coordinateConverter.shiftDisplayToServer(bounds.getMin())),
                     new EastNorth(coordinateConverter.shiftDisplayToServer(bounds.getMax())));
-            bounds = projServer.getEastNorthBoundsBox(bounds, projCurrent);
-            t1 = tileSource.projectedToTileXY(bounds.getMin().toProjected(), zoom);
-            t2 = tileSource.projectedToTileXY(bounds.getMax().toProjected(), zoom);
+            ProjectionBounds bbox = projServer.getEastNorthBoundsBox(projBounds, Main.getProjection());
+            t1 = tileSource.projectedToTileXY(bbox.getMin().toProjected(), zoom);
+            t2 = tileSource.projectedToTileXY(bbox.getMax().toProjected(), zoom);
         } else {
             IProjected topLeftUnshifted = coordinateConverter.shiftDisplayToServer(bounds.getMin());
Index: trunk/src/org/openstreetmap/josm/tools/ImageWarp.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ImageWarp.java	(revision 11889)
+++ trunk/src/org/openstreetmap/josm/tools/ImageWarp.java	(revision 11891)
@@ -119,24 +119,21 @@
     }
 
+    private static int clamp(int i, int max) {
+        if (i < 0) {
+            return 0;
+        } else if (i >= max) {
+            return max - 1;
+        } else {
+            return i;
+        }
+    }
+
     private static Color getColor(int x, int y, BufferedImage img) {
         // border strategy: continue with the color of the outermost pixel,
         // but change alpha component to fully translucent
-        boolean transparent = false;
-        if (x < 0) {
-            x = 0;
-            transparent = true;
-        } else if (x >= img.getWidth()) {
-            x = img.getWidth() - 1;
-            transparent = true;
-        }
-        if (y < 0) {
-            y = 0;
-            transparent = true;
-        } else if (y >= img.getHeight()) {
-            y = img.getHeight() - 1;
-            transparent = true;
-        }
-        Color clr = new Color(img.getRGB(x, y));
-        if (!transparent)
+        int a = clamp(x, img.getWidth());
+        int b = clamp(y, img.getHeight());
+        Color clr = new Color(img.getRGB(a, b));
+        if (a == x && b == y)
             return clr;
         // keep color components, but set transparency to 0
