Skip to content

Commit

Permalink
Merge pull request #45312 from nyalldawson/fix_41994
Browse files Browse the repository at this point in the history
Add shortcut path when a line symbol is being rendered with a dash pattern which is all 0 lengths
  • Loading branch information
elpaso committed Sep 30, 2021
2 parents fb8b794 + f4e2e90 commit 3dffaa3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/core/symbology/qgslinesymbollayer.cpp
Expand Up @@ -419,6 +419,24 @@ void QgsSimpleLineSymbolLayer::renderPolyline( const QPolygonF &pts, QgsSymbolRe
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 3dffaa3

Please sign in to comment.