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);
}

View File

@ -43,10 +43,6 @@ namespace Nz
case BoxLayoutOrientation::Vertical:
axis = 1; //< y
break;
default:
assert(false);
break;
}
//TODO: Keep solver state when widgets don't change
@ -106,7 +102,7 @@ namespace Nz
return;
Nz::Vector2f newSize = layoutSize;
newSize[axis] = m_state->sizeVar[varIndex].value();
newSize[axis] = SafeCast<float>(m_state->sizeVar[varIndex].value());
child->Resize(newSize);
remainingSize -= newSize[axis];