diff --git a/src/nvimage/FloatImage.cpp b/src/nvimage/FloatImage.cpp index f2bf44f..9ef4099 100644 --- a/src/nvimage/FloatImage.cpp +++ b/src/nvimage/FloatImage.cpp @@ -21,10 +21,13 @@ namespace { static int mirror(int x, int w) { + if (w == 1) return 0; + x = abs(x); while (x >= w) { - x = 2 * w - x - 2; + x = abs(w + w - x - 2); } + return x; } }