aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPierre-Yves Rollo <dev@pyrollo.com>2020-06-24 11:35:06 +0200
committerGitHub <noreply@github.com>2020-06-24 11:35:06 +0200
commitee6c499ff8b9abf0d22ebc817a26f33322ffdd5b (patch)
tree8a4d2776277afbc70888c877a144779685a0d3d8 /src
parent646af2ef5f52cc3a04ea806d13dd2a048395da88 (diff)
downloadminetest-ee6c499ff8b9abf0d22ebc817a26f33322ffdd5b.tar.gz
minetest-ee6c499ff8b9abf0d22ebc817a26f33322ffdd5b.tar.bz2
minetest-ee6c499ff8b9abf0d22ebc817a26f33322ffdd5b.zip
Fix wrong use of guiScalingImageButton in formspecs buttons (#10094)
Diffstat (limited to 'src')
-rw-r--r--src/gui/guiButton.cpp5
-rw-r--r--src/gui/guiButtonImage.cpp5
2 files changed, 4 insertions, 6 deletions
diff --git a/src/gui/guiButton.cpp b/src/gui/guiButton.cpp
index ff35958fd..6732a9233 100644
--- a/src/gui/guiButton.cpp
+++ b/src/gui/guiButton.cpp
@@ -789,13 +789,12 @@ void GUIButton::setFromStyle(const StyleSpec& style)
setDrawBorder(style.getBool(StyleSpec::BORDER, true));
setUseAlphaChannel(style.getBool(StyleSpec::ALPHA, true));
- const core::position2di buttonCenter(AbsoluteRect.getCenter());
- core::position2d<s32> geom(buttonCenter);
if (style.isNotDefault(StyleSpec::BGIMG)) {
video::ITexture *texture = style.getTexture(StyleSpec::BGIMG,
getTextureSource());
setImage(guiScalingImageButton(
- Environment->getVideoDriver(), texture, geom.X, geom.Y));
+ Environment->getVideoDriver(), texture,
+ AbsoluteRect.getWidth(), AbsoluteRect.getHeight()));
setScaleImage(true);
} else {
setImage(nullptr);
diff --git a/src/gui/guiButtonImage.cpp b/src/gui/guiButtonImage.cpp
index 2658ad967..b507ffece 100644
--- a/src/gui/guiButtonImage.cpp
+++ b/src/gui/guiButtonImage.cpp
@@ -62,13 +62,12 @@ void GUIButtonImage::setFromStyle(const StyleSpec& style)
video::IVideoDriver *driver = Environment->getVideoDriver();
- const core::position2di buttonCenter(AbsoluteRect.getCenter());
- core::position2d<s32> geom(buttonCenter);
if (style.isNotDefault(StyleSpec::FGIMG)) {
video::ITexture *texture = style.getTexture(StyleSpec::FGIMG,
getTextureSource());
- setForegroundImage(guiScalingImageButton(driver, texture, geom.X, geom.Y));
+ setForegroundImage(guiScalingImageButton(driver, texture,
+ AbsoluteRect.getWidth(), AbsoluteRect.getHeight()));
setScaleImage(true);
} else {
setForegroundImage(nullptr);