Use legacy image implementation (no NNAA filter) when not using 9-slice image (#12608)

This commit is contained in:
x2048 2022-07-31 21:57:13 +02:00 committed by GitHub
parent a2bf3a2aa8
commit 839600ed70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -825,12 +825,27 @@ void GUIFormSpecMenu::parseImage(parserData* data, const std::string &element)
core::rect<s32> middle; core::rect<s32> middle;
if (parts.size() >= 4) if (parts.size() >= 4)
parseMiddleRect(parts[3], &middle); parseMiddleRect(parts[3], &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.
GUIAnimatedImage *e = new GUIAnimatedImage(Environment, data->current_parent, gui::IGUIElement *e;
spec.fid, rect); if (middle.getArea() > 0) {
GUIAnimatedImage *image = new GUIAnimatedImage(Environment, data->current_parent,
spec.fid, rect);
e->setTexture(texture); image->setTexture(texture);
e->setMiddleRect(middle); 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); auto style = getDefaultStyleForElement("image", spec.fname);
e->setNotClipped(style.getBool(StyleSpec::NOCLIP, m_formspec_version < 3)); e->setNotClipped(style.getBool(StyleSpec::NOCLIP, m_formspec_version < 3));