Skip to content
Snippets Groups Projects
Commit c774fdba authored by Fatih Uzunoğlu's avatar Fatih Uzunoğlu Committed by Fatih Uzunoğlu
Browse files

qt: extrapolate rounded rectangle path in QSGRoundedRectangularImageNode

This should correct some artifacts seen with small
nodes which caused by having too few vertices
to represent a rounded rectangle.
parent 89b6c0a5
No related branches found
No related tags found
1 merge request!5025qt: extrapolate rounded rectangle path in QSGRoundedRectangularImageNode
Pipeline #446600 passed with stage
in 22 minutes and 10 seconds
......@@ -183,7 +183,12 @@ QSGGeometry* QSGRoundedRectangularImageNode::rebuildGeometry(const Shape& shape,
else
{
QPainterPath painterPath;
painterPath.addRoundedRect(0, 0, key.first.first, key.first.second, key.second, key.second);
constexpr const short extrapolationFactor = 2;
painterPath.addRoundedRect(0, 0,
key.first.first * extrapolationFactor,
key.first.second * extrapolationFactor,
key.second * extrapolationFactor,
key.second * extrapolationFactor);
painterPath = painterPath.simplified();
upPath = std::make_unique<QVector<QPointF>>(painterPath.elementCount());
......@@ -201,7 +206,7 @@ QSGGeometry* QSGRoundedRectangularImageNode::rebuildGeometry(const Shape& shape,
// Symmetry based triangulation based on ordered painter path.
(*path)[i] = (painterPath.elementAt((i % 2) ? (i)
: (elementCount - i - 1)));
: (elementCount - i - 1))) / extrapolationFactor;
}
paths.insert(key, new QVector<QPointF>(*path));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment