/** * Enlarges the pool of cached Coords to the given width and height, and doesn't change * a dimension if it would be reduced in size. * Cached Coord values will be reused by Coord.get instead of re-allocated each time. * The default pool allows Coords with x and y each between -3 and 255, inclusive, to * be cached, and is considered to have width and height of 256 to begin with. Giving a * width greater than 256 will allow Coords with x greater than 255 to be cached; * likewise for height. If width or height is smaller than the current cache width or * height, that dimension will not change, but the other still may if it is valid. You * cannot shrink the pool size. * @param width the new width for the pool of cached Coords; will be ignored if smaller than the current width * @param height the new height for the pool of cached Coords; will be ignored if smaller than the current height */ public static void expandPoolTo(final int width, final int height) { expandPool(Math.max(0, width + 3 - POOL.length), Math.max(0, height + 3 - POOL[0].length)); }