(Image) Optimized GetMaxLevel

Former-commit-id: cdddd29020a6f82e6095ad30447eb0b6e9f2d8cf
This commit is contained in:
Lynix 2015-03-16 13:54:19 +01:00
parent 3e214678c3
commit 6cc81cdc05
1 changed files with 2 additions and 7 deletions

View File

@ -1322,13 +1322,8 @@ void NzImage::Copy(nzUInt8* destination, const nzUInt8* source, nzUInt8 bpp, uns
nzUInt8 NzImage::GetMaxLevel(unsigned int width, unsigned int height, unsigned int depth)
{
static const float invLog2 = 1.f/std::log(2.f);
unsigned int widthLevel = static_cast<unsigned int>(invLog2 * std::log(static_cast<float>(width)));
unsigned int heightLevel = static_cast<unsigned int>(invLog2 * std::log(static_cast<float>(height)));
unsigned int depthLevel = static_cast<unsigned int>(invLog2 * std::log(static_cast<float>(depth)));
return std::max(std::max(std::max(widthLevel, heightLevel), depthLevel), 1U);
// Le niveau maximal est le niveau requis pour la plus grande taille
return std::max(NzIntegralLog2(std::max({width, height, depth})), 1U);
}
nzUInt8 NzImage::GetMaxLevel(nzImageType type, unsigned int width, unsigned int height, unsigned int depth)