mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-06 00:55:50 +00:00
Use float based scale factor for ImageButton texture
This commit is contained in:
parent
3ba39f977b
commit
a16c55c93f
@ -131,6 +131,7 @@
|
||||
Bug #6753: Info records without a DATA subrecords are loaded incorrectly
|
||||
Bug #6794: Light sources are attached to mesh bounds centers instead of mesh origins when AttachLight NiNode is missing
|
||||
Bug #6799: Game crashes if an NPC has no Class attached
|
||||
Bug #6849: ImageButton texture is not scaled properly
|
||||
Feature #890: OpenMW-CS: Column filtering
|
||||
Feature #1465: "Reset" argument for AI functions
|
||||
Feature #2491: Ability to make OpenMW "portable"
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "imagebutton.hpp"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <MyGUI_RenderManager.h>
|
||||
|
||||
#include <components/debug/debuglog.hpp>
|
||||
@ -88,13 +90,17 @@ namespace Gui
|
||||
|
||||
if (!mUseWholeTexture)
|
||||
{
|
||||
int scale = 1.f;
|
||||
float scale = 1.f;
|
||||
MyGUI::ITexture* texture = MyGUI::RenderManager::getInstance().getTexture(textureName);
|
||||
if (texture && getHeight() != 0)
|
||||
scale = texture->getHeight() / getHeight();
|
||||
scale = static_cast<float>(texture->getHeight()) / getHeight();
|
||||
|
||||
setImageTile(MyGUI::IntSize(mTextureRect.width * scale, mTextureRect.height * scale));
|
||||
MyGUI::IntCoord scaledSize(mTextureRect.left * scale, mTextureRect.top * scale, mTextureRect.width * scale, mTextureRect.height * scale);
|
||||
const int width = static_cast<int>(std::round(mTextureRect.width * scale));
|
||||
const int height = static_cast<int>(std::round(mTextureRect.height * scale));
|
||||
setImageTile(MyGUI::IntSize(width, height));
|
||||
MyGUI::IntCoord scaledSize(static_cast<int>(std::round(mTextureRect.left * scale)),
|
||||
static_cast<int>(std::round(mTextureRect.top * scale)),
|
||||
width, height);
|
||||
setImageCoord(scaledSize);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user