aboutsummaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorx2048 <codeforsmile@gmail.com>2022-07-31 21:57:13 +0200
committerGitHub <noreply@github.com>2022-07-31 21:57:13 +0200
commit839600ed703ccffbdb71bd2f04fb379d0920da95 (patch)
tree51581b352b66a992666dc11979a4922e52d4aa16 /src/gui
parenta2bf3a2aa89ea8c86ec51114389d1403cb83dca9 (diff)
downloadminetest-839600ed703ccffbdb71bd2f04fb379d0920da95.tar.gz
minetest-839600ed703ccffbdb71bd2f04fb379d0920da95.tar.bz2
minetest-839600ed703ccffbdb71bd2f04fb379d0920da95.zip
Use legacy image implementation (no NNAA filter) when not using 9-slice image (#12608)
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/guiFormSpecMenu.cpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp
index 342ef0e18..5d4ca6747 100644
--- a/src/gui/guiFormSpecMenu.cpp
+++ b/src/gui/guiFormSpecMenu.cpp
@@ -825,12 +825,27 @@ void GUIFormSpecMenu::parseImage(parserData* data, const std::string &element)
core::rect<s32> middle;
if (parts.size() >= 4)
parseMiddleRect(parts[3], &middle);
-
- GUIAnimatedImage *e = new GUIAnimatedImage(Environment, data->current_parent,
- spec.fid, rect);
-
- e->setTexture(texture);
- e->setMiddleRect(middle);
+
+ // Temporary fix for issue #12581 in 5.6.0.
+ // Use legacy image when not rendering 9-slice image because GUIAnimatedImage
+ // uses NNAA filter which causes visual artifacts when image uses alpha blending.
+
+ gui::IGUIElement *e;
+ if (middle.getArea() > 0) {
+ GUIAnimatedImage *image = new GUIAnimatedImage(Environment, data->current_parent,
+ spec.fid, rect);
+
+ image->setTexture(texture);
+ image->setMiddleRect(middle);
+ e = image;
+ }
+ else {
+ gui::IGUIImage *image = Environment->addImage(rect, data->current_parent, spec.fid, nullptr, true);
+ image->setImage(texture);
+ image->setScaleImage(true);
+ image->grab(); // compensate for drop in addImage
+ e = image;
+ }
auto style = getDefaultStyleForElement("image", spec.fname);
e->setNotClipped(style.getBool(StyleSpec::NOCLIP, m_formspec_version < 3));