Skip to content

Commit

Permalink
Fix bug if horizontal frames less than hframes for go routines.
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-wannacott committed Oct 14, 2023
1 parent b8df848 commit 53722dd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/gontage.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,13 @@ func calcSheetDimensions(hframes int, all_decoded_images []image.Image) (int, in
vframes := math.Ceil((float64(len(all_decoded_images)) / float64(hframes)))
var spritesheet_width int
var spritesheet_height int
for _, image := range all_decoded_images[:hframes] {
var horizontal_sprite_count int
if len(all_decoded_images) < hframes {
horizontal_sprite_count = len(all_decoded_images)
} else {
horizontal_sprite_count = hframes
}
for _, image := range all_decoded_images[:horizontal_sprite_count] {
spritesheet_width += image.Bounds().Dx()
}
for _, image := range all_decoded_images[:int(vframes)] {
Expand Down

0 comments on commit 53722dd

Please sign in to comment.