Skip to content
Permalink
Browse files
Add shortcut path when a line symbol is being rendered with
a dash pattern which is all 0 lengths

This is rendered as no line, so we can skip out early

Refs #41994
  • Loading branch information
nyalldawson committed Nov 1, 2021
1 parent 9ff4ae1 commit 663db5972f08be873cd786e43bc7118e58c0a471
Showing with 18 additions and 0 deletions.
  1. +18 −0 src/core/symbology/qgslinesymbollayer.cpp
@@ -345,6 +345,24 @@ void QgsSimpleLineSymbolLayer::renderPolyline( const QPolygonF &points, QgsSymbo
applyDataDefinedSymbology( context, mPen, mSelPen, offset );

const QPen pen = context.selected() ? mSelPen : mPen;

if ( !pen.dashPattern().isEmpty() )
{
// check for a null (all 0) dash component, and shortcut out early if so -- these lines are rendered as "no pen"
const QVector<double> pattern = pen.dashPattern();
bool foundNonNull = false;
for ( int i = 0; i < pattern.size(); ++i )
{
if ( i % 2 == 0 && !qgsDoubleNear( pattern[i], 0 ) )
{
foundNonNull = true;
break;
}
}
if ( !foundNonNull )
return;
}

p->setBrush( Qt::NoBrush );

// Disable 'Antialiasing' if the geometry was generalized in the current RenderContext (We known that it must have least #2 points).

0 comments on commit 663db59

Please sign in to comment.