+/*
+Negative numbers still screw it up... Need to think about what we're
+trying to do here. The fact that it worked with 72 seems to have been pure luck.
+It seems the problem is negative numbers: We can't let that happen.
+When taking away the zero, it pops over 1 px at zero, then goes about 1/2 a
+grid at x<0.
+
+The bitmap looks like this:
+
++---+---+---+---+---
+| | | | |
+| | | | |
++---+---+---+---+---
+| | | | |
+| | | | |
+| | | | |
+
+@ x = 1, we want it to look like:
+
+-+---+---+---+---+---
+ | | | | |
+ | | | | |
+-+---+---+---+---+---
+ | | | | |
+ | | | | |
+ | | | | |
+
+Which means we need to grab the sample from x = 3. @ x = -1:
+
+---+---+---+---+---
+ | | | |
+ | | | |
+---+---+---+---+---
+ | | | |
+ | | | |
+ | | | |
+
+Which means we need to grab the sample from x = 1. Which means we have to take
+the inverse of the modulus of gridPixels.
+
+Doing a mod of a negative number is problematic: 1st, the compiler converts the
+negative number to an unsigned int, then it does the mod. Gets you wrong answers
+most of the time, unless you use a power of 2. :-P
+
+This has been solved below:
+UGB: pmo=(2.000000,687.000000) X=2, X%48=2, new x=45
+UGB: pmo=(1.000000,687.000000) X=1, X%48=1, new x=46
+UGB: pmo=(0.000000,687.000000) X=0, X%48=0, new x=47
+UGB: pmo=(-1.000000,687.000000) X=-1, X%48=15, new x=1
+UGB: pmo=(-2.000000,686.000000) X=-2, X%48=14, new x=2
+UGB: pmo=(-3.000000,686.000000) X=-3, X%48=13, new x=3
+
+Problem with changing grid size causes x/y origin to be shown incorrectly:
+UGB: pmo=(10.000000,812.000000) X=10, X%12=10, new x=2
+UGB: pmo=(10.000000,812.000000) X=10, X%4=2, new x=2
+UGB: pmo=(3.333333,818.666667) X=3, X%48=3, new x=45
+UGB: pmo=(39.000000,782.000000) X=39, X%48=39, new x=9 <-- MMB move is here
+UGB: pmo=(39.000000,781.000000) X=39, X%48=39, new x=9
+
+
+
+*/
+//printf("UGB: pmo=(%f,%f) X=%i, X%%%i=%i, ", pixmapOrigin.x, pixmapOrigin.y, x, BG_BRUSH_SPAN, x % BG_BRUSH_SPAN);
+// x = (x < 0 ? 0 : BG_BRUSH_SPAN - 1) - (x % BG_BRUSH_SPAN);
+// y = (y < 0 ? 0 : BG_BRUSH_SPAN - 1) - (y % BG_BRUSH_SPAN);
+// x = (BG_BRUSH_SPAN - 1) - (x % BG_BRUSH_SPAN);
+// y = (BG_BRUSH_SPAN - 1) - (y % BG_BRUSH_SPAN);
+// x = (x < 0 ? 0 : BG_BRUSH_SPAN - 1) - ((x < 0 ? -x : x) % BG_BRUSH_SPAN);
+ if (x < 0)
+ x = -x % BG_BRUSH_SPAN;
+ else
+ x = (BG_BRUSH_SPAN - (x % BG_BRUSH_SPAN)) % BG_BRUSH_SPAN;
+
+// y = (y < 0 ? 0 : BG_BRUSH_SPAN - 1) - ((y < 0 ? -y : y) % BG_BRUSH_SPAN);
+ if (y < 0)
+ y = -y % BG_BRUSH_SPAN;
+ else
+ y = (BG_BRUSH_SPAN - (y % BG_BRUSH_SPAN)) % BG_BRUSH_SPAN;
+//printf("new x=%i\n", x);