Skip to content

Commit

Permalink
Add shortcut path when a line symbol is being rendered with
Browse files Browse the repository at this point in the history
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 Oct 5, 2021
1 parent 71c643a commit 332ba6e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/core/symbology/qgslinesymbollayer.cpp
Expand Up @@ -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).
Expand Down

0 comments on commit 332ba6e

Please sign in to comment.