protected void fillSimpleReflect(int[] pixels, int off, int adjust,
                                     int x, int y, int w, int h) {
        final float initConst = (dgdX * x) + gc;

        final int[] grad = gradient;

        for (int i = 0; i < h; i++) { //for every row
            //initialize current value to be start.
            float g = initConst + dgdY * (y + i);

            // now limited g to -2<->2
            g = g - 2 * ((int) (g / 2.0f));

            float step = dgdX;
            // Pull it into the positive half
            if (g < 0) {
                g = -g; //take absolute value
                step = -step;  // Change direction..
            }

            // Now do the same for dgdX. This is safe because
            // any step that is a multiple of 2.0 has no
            // affect, hence we can remove it which the first
            // part does.  The second part simply adds 2.0
            // (which has no affect due to the cylcle) to move
            // all negative step values into the positive
            // side.
            step = step - 2 * ((int) step / 2.0f);
            if (step < 0)
                step += 2.0;
            final int reflectMax = 2 * fastGradientArraySize;

            // Scale for gradient array.
            g *= fastGradientArraySize;
            g += 0.5;
            step *= fastGradientArraySize;
            final int rowLimit = off + w;  // end of row iteration
            while (off < rowLimit) {
                int idx = (int) g;
                if (idx >= reflectMax) {
                    g -= reflectMax;
                    idx -= reflectMax;
                }

                if (idx <= fastGradientArraySize)
                    pixels[off++] = grad[idx];
                else
                    pixels[off++] = grad[reflectMax - idx];
                g += step;
            }

            off += adjust; //change in off from row to row
        }
    }