Fixed aspect ratio for icon button widget.
It happened when using non-hd textures. Textures with aspect ratio != 1, are scaled to MAX_TEXTURE_SIZE, for example from 512x256 to 256x256, so we can't base on scaled texture size. Btw. such behaviour seems to not have a sense (for example 2048x256 will be scaled down to 256x256), so it may need some work in stk_texture.cpp.
This commit is contained in:
parent
fd00ef4d92
commit
6829bb1e51
@ -125,7 +125,9 @@ void IconButtonWidget::add()
|
||||
|
||||
if (m_scale_mode == SCALE_MODE_KEEP_TEXTURE_ASPECT_RATIO)
|
||||
{
|
||||
useAspectRatio = (float)m_texture_w / (float)m_texture_h;
|
||||
assert(m_texture->getOriginalSize().Height > 0);
|
||||
useAspectRatio = (float)m_texture->getOriginalSize().Width /
|
||||
(float)m_texture->getOriginalSize().Height;
|
||||
}
|
||||
else if (m_scale_mode == SCALE_MODE_KEEP_CUSTOM_ASPECT_RATIO)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user