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.
preferencesAboutTextFull
Craig Watson 8 years ago
parent 145a7238c0
commit 02205e861b
  1. 31
      src/domain/UBGraphicsPolygonItem.cpp

@ -136,38 +136,9 @@ UBGraphicsStroke* UBGraphicsPolygonItem::stroke() const
void UBGraphicsPolygonItem::setColor(const QColor& pColor)
{
QGraphicsPolygonItem::setBrush(QBrush(pColor));
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);
}

Loading…
Cancel
Save