Fixed compilation error from last commit

Fixed NzImage::GetWidth/Height/Depth returning 0 when level > image's
max level
This commit is contained in:
Lynix 2012-05-30 19:21:20 +02:00
parent b220e00c88
commit 3720967802
2 changed files with 7 additions and 7 deletions

View File

@ -122,7 +122,7 @@ class NAZARA_API NzImage : public NzResource, public NzResourceLoader<NzImage, N
{
}
SharedImage(unsigned short RefCount, nzImageType Type, nzPixelFormat Format, nzInt8 LevelCount = 1, nzUInt8** Pixels = nullptr, unsigned int Width = 1, unsigned int Height = 1, unsigned int Depth = 1) :
SharedImage(unsigned short RefCount, nzImageType Type, nzPixelFormat Format, nzUInt8 LevelCount = 1, nzUInt8** Pixels = nullptr, unsigned int Width = 1, unsigned int Height = 1, unsigned int Depth = 1) :
type(Type),
format(Format),
levelCount(LevelCount),

View File

@ -271,7 +271,7 @@ const nzUInt8* NzImage::GetConstPixels(nzUInt8 level) const
unsigned int NzImage::GetDepth(nzUInt8 level) const
{
return m_sharedImage->depth/(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