Make new resizing algorithm actually work properly.

This commit is contained in:
Aloshi 2014-01-10 18:05:37 -06:00
parent b35d365dc8
commit a83ce289e0

View file

@ -67,13 +67,15 @@ void ImageComponent::resize()
// if only one component is set, we resize in a way that maintains aspect ratio
if(!mTargetSize.x() && mTargetSize.y())
{
mSize[0] = (mTargetSize.y() / mSize.y()) * mSize.x();
mSize[0] = (mTargetSize.y() / textureSize.y()) * textureSize.x();
mSize[1] = mTargetSize.y();
}else if(mTargetSize.x() && !mTargetSize.y())
{
mSize[0] = mTargetSize.x();
mSize[1] = (mTargetSize.x() / mSize.x()) * mSize.y();
mSize[1] = (mTargetSize.x() / textureSize.x()) * textureSize.y();
}
LOG(LogInfo) << "resized to: " << mSize.x() << ", " << mSize.y();
}
}
}