Skip to content

Commit

Permalink
Avoid unnecessary icon creation
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 13, 2018
1 parent 454cbda commit 3927559
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core/symbology/qgsstylemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ QVariant QgsStyleModel::data( const QModelIndex &index, int role ) const
return icon;

std::unique_ptr< QgsSymbol > symbol( mStyle->symbol( name ) );
icon.addPixmap( QgsSymbolLayerUtils::symbolPreviewPixmap( symbol.get(), QSize( 24, 24 ), 1 ) );
if ( mAdditionalSizes.isEmpty() )
icon.addPixmap( QgsSymbolLayerUtils::symbolPreviewPixmap( symbol.get(), QSize( 24, 24 ), 1 ) );

for ( const QVariant &size : mAdditionalSizes )
{
Expand All @@ -105,7 +106,8 @@ QVariant QgsStyleModel::data( const QModelIndex &index, int role ) const
return icon;

std::unique_ptr< QgsColorRamp > ramp( mStyle->colorRamp( name ) );
icon.addPixmap( QgsSymbolLayerUtils::colorRampPreviewPixmap( ramp.get(), QSize( 24, 24 ), 1 ) );
if ( mAdditionalSizes.isEmpty() )
icon.addPixmap( QgsSymbolLayerUtils::colorRampPreviewPixmap( ramp.get(), QSize( 24, 24 ), 1 ) );
for ( const QVariant &size : mAdditionalSizes )
{
QSize s = size.toSize();
Expand Down

0 comments on commit 3927559

Please sign in to comment.