mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
Merge pull request #32706 from m-kuhn/qgis_point_pattern_fill_fix
Fix freeze when loading point pattern fill with distance 0
This commit is contained in:
commit
706c33644d
@ -3183,7 +3183,11 @@ void QgsPointPatternFillSymbolLayer::applyPattern( const QgsSymbolRenderContext
|
||||
|
||||
QImage patternImage( width, height, QImage::Format_ARGB32 );
|
||||
patternImage.fill( 0 );
|
||||
|
||||
if ( patternImage.isNull() )
|
||||
{
|
||||
brush.setTextureImage( QImage() );
|
||||
return;
|
||||
}
|
||||
if ( mMarkerSymbol )
|
||||
{
|
||||
QPainter p( &patternImage );
|
||||
|
@ -527,8 +527,7 @@ void QgsSymbol::drawPreviewIcon( QPainter *painter, QSize size, QgsRenderContext
|
||||
context->setExpressionContext( expContext );
|
||||
}
|
||||
|
||||
const auto constMLayers = mLayers;
|
||||
for ( QgsSymbolLayer *layer : constMLayers )
|
||||
for ( QgsSymbolLayer *layer : qgis::as_const( mLayers ) )
|
||||
{
|
||||
if ( !layer->enabled() || ( customContext && !customContext->isSymbolLayerEnabled( layer ) ) )
|
||||
continue;
|
||||
|
@ -56,6 +56,7 @@ class TestQgsPointPatternFillSymbol : public QObject
|
||||
void pointPatternFillSymbol();
|
||||
void offsettedPointPatternFillSymbol();
|
||||
void dataDefinedSubSymbol();
|
||||
void zeroSpacedPointPatternFillSymbol();
|
||||
|
||||
private:
|
||||
bool mTestHasError = false ;
|
||||
@ -185,6 +186,25 @@ void TestQgsPointPatternFillSymbol::dataDefinedSubSymbol()
|
||||
QVERIFY( imageCheck( "datadefined_subsymbol" ) );
|
||||
}
|
||||
|
||||
void TestQgsPointPatternFillSymbol::zeroSpacedPointPatternFillSymbol()
|
||||
{
|
||||
mReport += QLatin1String( "<h2>Zero distance point pattern fill symbol renderer test</h2>\n" );
|
||||
|
||||
QgsStringMap properties;
|
||||
properties.insert( QStringLiteral( "color" ), QStringLiteral( "0,0,0,255" ) );
|
||||
properties.insert( QStringLiteral( "outline_color" ), QStringLiteral( "#000000" ) );
|
||||
properties.insert( QStringLiteral( "name" ), QStringLiteral( "circle" ) );
|
||||
properties.insert( QStringLiteral( "size" ), QStringLiteral( "5.0" ) );
|
||||
QgsMarkerSymbol *pointSymbol = QgsMarkerSymbol::createSimple( properties );
|
||||
|
||||
mPointPatternFill->setSubSymbol( pointSymbol );
|
||||
mPointPatternFill->setDistanceX( 0 );
|
||||
mPointPatternFill->setDistanceY( 15 );
|
||||
mPointPatternFill->setOffsetX( 4 );
|
||||
mPointPatternFill->setOffsetY( 4 );
|
||||
QVERIFY( imageCheck( "pointfill_zero_space" ) );
|
||||
}
|
||||
|
||||
//
|
||||
// Private helper functions not called directly by CTest
|
||||
//
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 626 KiB |
Loading…
x
Reference in New Issue
Block a user