diff --git a/include/Nazara/Utility/Image.hpp b/include/Nazara/Utility/Image.hpp index aafbb72c1..272c1c7b6 100644 --- a/include/Nazara/Utility/Image.hpp +++ b/include/Nazara/Utility/Image.hpp @@ -122,7 +122,7 @@ class NAZARA_API NzImage : public NzResource, public NzResourceLoaderdepth/(1 << level); + return std::max(m_sharedImage->depth/(1 << level), 1U); } nzPixelFormat NzImage::GetFormat() const @@ -281,7 +281,7 @@ nzPixelFormat NzImage::GetFormat() const unsigned int NzImage::GetHeight(nzUInt8 level) const { - return m_sharedImage->height/(1 << level); + return std::max(m_sharedImage->height/(1 << level), 1U); } nzUInt8 NzImage::GetLevelCount() const @@ -422,9 +422,9 @@ unsigned int NzImage::GetSize() const unsigned int NzImage::GetSize(nzUInt8 level) const { - return (std::max(m_sharedImage->width/(1 << level), 1)) * - (std::max(m_sharedImage->height/(1 << level), 1)) * - ((m_sharedImage->type == nzImageType_Cubemap) ? 6 : std::min(m_sharedImage->depth/(1 << level), 1)) * + return (std::max(m_sharedImage->width/(1 << level), 1U)) * + (std::max(m_sharedImage->height/(1 << level), 1U)) * + ((m_sharedImage->type == nzImageType_Cubemap) ? 6 : std::min(m_sharedImage->depth/(1 << level), 1U)) * NzPixelFormat::GetBPP(m_sharedImage->format); } @@ -435,7 +435,7 @@ nzImageType NzImage::GetType() const unsigned int NzImage::GetWidth(nzUInt8 level) const { - return m_sharedImage->width/(1 << level); + return std::max(m_sharedImage->width/(1 << level), 1U); } bool NzImage::IsCompressed() const