From 3720967802107930121aa911131a1c31324ea977 Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 30 May 2012 19:21:20 +0200 Subject: [PATCH] Fixed compilation error from last commit Fixed NzImage::GetWidth/Height/Depth returning 0 when level > image's max level --- include/Nazara/Utility/Image.hpp | 2 +- src/Nazara/Utility/Image.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) 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