Minor fixes

This commit is contained in:
SirLynix
2022-12-17 14:49:22 +01:00
parent d4422c4102
commit e6bf11c48e
2 changed files with 4 additions and 8 deletions

View File

@@ -1368,7 +1368,7 @@ namespace Nz
UInt8 Image::GetMaxLevel(unsigned int width, unsigned int height, unsigned int depth)
{
// Le niveau maximal est le niveau requis pour la plus grande taille
return std::max(IntegralLog2(std::max({width, height, depth})), 1U);
return SafeCast<UInt8>(std::max(IntegralLog2(std::max({width, height, depth})), 1U));
}
UInt8 Image::GetMaxLevel(ImageType type, unsigned int width, unsigned int height, unsigned int depth)
@@ -1425,9 +1425,9 @@ namespace Nz
if (m_sharedImage->refCount > 1)
{
SharedImage::PixelContainer levels(m_sharedImage->levels.size());
for (unsigned int i = 0; i < levels.size(); ++i)
for (std::size_t i = 0; i < levels.size(); ++i)
{
std::size_t size = GetMemoryUsage(i);
std::size_t size = GetMemoryUsage(SafeCast<UInt8>(i));
levels[i] = std::make_unique<UInt8[]>(size);
std::memcpy(levels[i].get(), m_sharedImage->levels[i].get(), size);
}