Index: trunk/src/org/openstreetmap/josm/tools/ImageWarp.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ImageWarp.java	(revision 11914)
+++ trunk/src/org/openstreetmap/josm/tools/ImageWarp.java	(revision 11915)
@@ -10,4 +10,6 @@
 import java.util.Map;
 import java.util.Set;
+
+import org.openstreetmap.josm.Main;
 
 /**
@@ -44,5 +46,5 @@
         private final Map<Integer, Map<Integer, Point2D>> cache;
 
-        private static final boolean CONSISTENCY_TEST = false;
+        private final boolean consistencyTest;
         private final Set<Integer> deletedRows;
 
@@ -56,5 +58,6 @@
             this.stride = stride;
             this.cache = new HashMap<>();
-            if (CONSISTENCY_TEST) {
+            this.consistencyTest = Main.isDebugEnabled();
+            if (consistencyTest) {
                 deletedRows = new HashSet<>();
             } else {
@@ -91,14 +94,14 @@
 
         private Map<Integer, Point2D> getRow(int yIdx) {
-            cleanUp(yIdx - 2);
+            cleanUp(yIdx - 3);
             Map<Integer, Point2D> row = cache.get(yIdx);
             if (row == null) {
                 row = new HashMap<>();
                 cache.put(yIdx, row);
-                if (CONSISTENCY_TEST) {
+                if (consistencyTest) {
                     // should not create a row that has been deleted before
                     if (deletedRows.contains(yIdx)) throw new AssertionError();
-                    // only ever cache 2 rows at once
-                    if (cache.size() > 2) throw new AssertionError();
+                    // only ever cache 3 rows at once
+                    if (cache.size() > 3) throw new AssertionError();
                 }
             }
@@ -109,5 +112,5 @@
         private void cleanUp(int yIdx) {
             Map<Integer, Point2D> del = cache.remove(yIdx);
-            if (CONSISTENCY_TEST && del != null) {
+            if (consistencyTest && del != null) {
                 // should delete each row only once
                 if (deletedRows.contains(yIdx)) throw new AssertionError();
