Skip to content

Commit

Permalink
refactor(mosaic): remove more unnecessary conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
bouassaba committed Aug 13, 2024
1 parent 61ae0c6 commit a1b9475
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions mosaic/builder/mosaic_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,19 @@ func (mb *MosaicBuilder) Decompose(image *Image, zoomLevel int, region Region) Z

cols := 1
if tileWidthExceeded {
cols = int(image.Width()) / mb.TileSize().Width()
cols = image.Width() / mb.TileSize().Width()
}
rows := 1
if tileHeightExceeded {
rows = int(image.Height()) / mb.TileSize().Height()
rows = image.Height() / mb.TileSize().Height()
}
remainingWidth := 0
if tileWidthExceeded {
remainingWidth = int(image.Width()) - (mb.TileSize().Width() * cols)
remainingWidth = image.Width() - (mb.TileSize().Width() * cols)
}
remainingHeight := 0
if tileHeightExceeded {
remainingHeight = int(image.Height()) - (mb.TileSize().Height() * rows)
remainingHeight = image.Height() - (mb.TileSize().Height() * rows)
}
totalCols := cols
if remainingWidth != 0 {
Expand All @@ -171,10 +171,10 @@ func (mb *MosaicBuilder) Decompose(image *Image, zoomLevel int, region Region) Z

adaptedTileSize := *mb.TileSize()
if !tileWidthExceeded {
adaptedTileSize.SetWidth(int(image.Width()))
adaptedTileSize.SetWidth(image.Width())
}
if !tileHeightExceeded {
adaptedTileSize.SetHeight(int(image.Height()))
adaptedTileSize.SetHeight(image.Height())
}

colStart, colEnd, rowStart, rowEnd := 0, cols-1, 0, rows-1
Expand Down

0 comments on commit a1b9475

Please sign in to comment.