private final void wrap(int[] p, BoundSize gapSize, boolean isWrap) {
        boolean flowx = lc.isFlowX();
        p[0] = flowx ? 0 : p[0] + 1;
        p[1] = flowx ? p[1] + 1 : 0;

        if (gapSize != null) {
            if (wrapGapMap == null) {
                wrapGapMap =
                        new HashMap<Integer, BoundSize>(8);
            }
            int ix = p[flowx ? 1 : 0];
            if (isWrap == false) {
                ix--; // newline. Use index before increment.
            }
            wrapGapMap.put(new Integer(ix), gapSize);

            // add the row/column so that the gap in the last row/col will not be removed.
            if (flowx) {
                rowIndexes.add(new Integer(p[1]));
            } else {
                colIndexes.add(new Integer(p[0]));
            }
        }
    }