private static void freeTile(Tile tile) {
   tile.invalidateContent();
   tile.bitmap = null;
   synchronized (sFreeTileLock) {
     tile.nextFreeTile = sFreeTileHead;
     sFreeTileHead = tile;
   }
 }
  public TiledTexture(Bitmap bitmap) {
    mWidth = bitmap.getWidth();
    mHeight = bitmap.getHeight();
    ArrayList<Tile> list = new ArrayList<Tile>();

    for (int x = 0, w = mWidth; x < w; x += CONTENT_SIZE) {
      for (int y = 0, h = mHeight; y < h; y += CONTENT_SIZE) {
        Tile tile = obtainTile();
        tile.offsetX = x;
        tile.offsetY = y;
        tile.bitmap = bitmap;
        tile.setSize(Math.min(CONTENT_SIZE, mWidth - x), Math.min(CONTENT_SIZE, mHeight - y));
        list.add(tile);
      }
    }
    mTiles = list.toArray(new Tile[list.size()]);
  }