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

@ -826,11 +826,26 @@ void GUIFormSpecMenu::parseImage(parserData* data, const std::string &element)
if (parts.size() >= 4)
parseMiddleRect(parts[3], &middle);
GUIAnimatedImage *e = new GUIAnimatedImage(Environment, data->current_parent,
// 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);
e->setTexture(texture);
e->setMiddleRect(middle);
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));