@Override protected void onTileReadyToDraw( final Canvas c, final Drawable currentMapTile, final Rect tileRect) { // Get the offsets for where to draw the tiles relative to where the minimap is located final int xOffset = (tileRect.left - mTileArea.left) + (mMiniMapCanvasRect.left); final int yOffset = (tileRect.top - mTileArea.top) + (mMiniMapCanvasRect.top); // Set the drawable's location currentMapTile.setBounds( xOffset, yOffset, xOffset + tileRect.width(), yOffset + tileRect.height()); // Save the current clipping bounds final Rect oldClip = c.getClipBounds(); // Check to see if the drawing area intersects with the minimap area if (mIntersectionRect.setIntersect(oldClip, mMiniMapCanvasRect)) { // If so, then clip that area c.clipRect(mIntersectionRect); // Draw the tile, which will be appropriately clipped currentMapTile.draw(c); // Restore the original clipping bounds c.clipRect(oldClip); } }