From 02205e861b8d68ab16dbc92c26b21b4deab14ae5 Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Sat, 8 Oct 2016 22:35:35 -0400 Subject: [PATCH] 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. --- src/domain/UBGraphicsPolygonItem.cpp | 33 ++-------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/src/domain/UBGraphicsPolygonItem.cpp b/src/domain/UBGraphicsPolygonItem.cpp index d5f8d4f6..39fb5151 100644 --- a/src/domain/UBGraphicsPolygonItem.cpp +++ b/src/domain/UBGraphicsPolygonItem.cpp @@ -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); }