Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix wrong use of guiScalingImageButton in formspecs buttons (#10094)
  • Loading branch information
pyrollo committed Jun 24, 2020
1 parent 646af2e commit ee6c499
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/gui/guiButton.cpp
Expand Up @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions src/gui/guiButtonImage.cpp
Expand Up @@ -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);
Expand Down

0 comments on commit ee6c499

Please sign in to comment.