Pan-fill algorithm