Commit 02205e86 authored by Craig Watson's avatar Craig Watson

Removed blending of adjacent polygons in marker strokes

Due to antialiasing, adjacent polygons are separated by a very fine
space. The previous solution attempted to hide this by adding a border
to the polygons. The border of adjacent polygons would overlap, which
was visible (despite the attempted color correction) and, more
importantly, caused massive lags especially on Linux.

Therefore it has been removed but feel free to revert this commit some
day and try to fix this more cleanly.
parent 145a7238
......@@ -136,38 +136,9 @@ UBGraphicsStroke* UBGraphicsPolygonItem::stroke() const
void UBGraphicsPolygonItem::setColor(const QColor& pColor)
{
QGraphicsPolygonItem::setBrush(QBrush(pColor));
setPen(Qt::NoPen);
if (pColor.alphaF() >= 1.0)
{
mHasAlpha = false;
setPen(Qt::NoPen);
}
else
{
mHasAlpha = true;
QColor penColor = pColor;
// trick QT antialiasing
// TODO UB 4.x see if we can do better ... it does not behave well with 16 bit color depth
qreal trickAlpha = pColor.alphaF();
if (trickAlpha >= 0.2 && trickAlpha < 0.6)
{
trickAlpha /= 12;
}
else if (trickAlpha < 0.8)
{
trickAlpha /= 5;
}
else if (trickAlpha < 1.0)
{
trickAlpha /= 2;
}
penColor.setAlphaF(trickAlpha);
QGraphicsPolygonItem::setPen(QPen(penColor));
}
mHasAlpha = (pColor.alphaF() < 1.0);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment