From c6c1f35de10562f7a5e8f7ed57e6bdbcc17ed0f3 Mon Sep 17 00:00:00 2001 From: Galaco Date: Tue, 12 Feb 2019 15:15:27 +0000 Subject: [PATCH] Fix floating point mipmap size calc error --- utils/mipmaps.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/utils/mipmaps.go b/utils/mipmaps.go index 4ee38be..2381efe 100644 --- a/utils/mipmaps.go +++ b/utils/mipmaps.go @@ -5,25 +5,25 @@ import ( "math" ) -// computeMipmapSizes: Compute all mipmap sizes +// ComputeMipmapSizes computes all mipmap sizes func ComputeMipmapSizes(num int, width int, height int) [][2]int { mipmaps := make([][2]int, num) for i := num - 1; i >= 0; i-- { mipmaps[i] = [2]int{width, height} - width = int(math.Ceil(float64(width / 2))) - height = int(math.Ceil(float64(height / 2))) + width = int(math.Ceil(float64(width) / 2)) + height = int(math.Ceil(float64(height) / 2)) } return mipmaps } -// computeSizeOfMipmapData: Returns the size in bytes +// ComputeSizeOfMipmapData returns the size in bytes func ComputeSizeOfMipmapData(width int, height int, storedFormat format.Colour) int { // Supported compressed formats must be at least 4x4. // The format pads smaller sizes out to 4 - if isCompressedFormat(storedFormat) == true { + if isCompressedFormat(storedFormat) { if width < 4 { width = 4 }