Navigation Menu

Skip to content

Commit

Permalink
Use a more reliable method of reenabling antialiasing
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jul 24, 2020
1 parent 4bfa75a commit 452bb6a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/symbology/qgslinesymbollayer.cpp
Expand Up @@ -338,11 +338,13 @@ void QgsSimpleLineSymbolLayer::renderPolyline( const QPolygonF &points, QgsSymbo
p->setBrush( Qt::NoBrush );

// Disable 'Antialiasing' if the geometry was generalized in the current RenderContext (We known that it must have least #2 points).
std::unique_ptr< QgsScopedQPainterState > painterState;
if ( points.size() <= 2 &&
( context.renderContext().vectorSimplifyMethod().simplifyHints() & QgsVectorSimplifyMethod::AntialiasingSimplification ) &&
QgsAbstractGeometrySimplifier::isGeneralizableByDeviceBoundingBox( points, context.renderContext().vectorSimplifyMethod().threshold() ) &&
( p->renderHints() & QPainter::Antialiasing ) )
{
painterState = qgis::make_unique< QgsScopedQPainterState >( p );
p->setRenderHint( QPainter::Antialiasing, false );
}

Expand Down Expand Up @@ -375,7 +377,6 @@ void QgsSimpleLineSymbolLayer::renderPolyline( const QPolygonF &points, QgsSymbo
scaledOffset = std::min( std::max( context.renderContext().convertToPainterUnits( offset, QgsUnitTypes::RenderMillimeters ), 3.0 ), 100.0 );
}

p->setPen( pen );
QList<QPolygonF> mline = ::offsetLine( points, scaledOffset, context.originalGeometryType() != QgsWkbTypes::UnknownGeometry ? context.originalGeometryType() : QgsWkbTypes::LineGeometry );
for ( const QPolygonF &part : mline )
{
Expand All @@ -385,14 +386,13 @@ void QgsSimpleLineSymbolLayer::renderPolyline( const QPolygonF &points, QgsSymbo
}
else
{
p->setPen( pen );
QPainterPath path;
path.addPolygon( part );
p->drawPath( path );
}
}
}

p->setRenderHint( QPainter::Antialiasing, context.renderContext().testFlag( QgsRenderContext::Antialiasing ) );
}

QgsStringMap QgsSimpleLineSymbolLayer::properties() const
Expand Down

0 comments on commit 452bb6a

Please sign in to comment.