Skip to content

Commit

Permalink
Remove useless member variable
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Oct 2, 2018
1 parent 6dd1bd3 commit 76190d5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 21 deletions.
Expand Up @@ -1027,7 +1027,6 @@ the appropriate pixel dimensions of the output device*
Constructs SVG fill symbol layer with picture from given absolute path to a SVG file
%End
QgsSVGFillSymbolLayer( const QByteArray &svgData, double width = 20, double rotation = 0.0 );
~QgsSVGFillSymbolLayer();

static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) /Factory/;
static QgsSymbolLayer *createFromSld( QDomElement &element ) /Factory/;
Expand Down
24 changes: 7 additions & 17 deletions src/core/symbology/qgsfillsymbollayer.cpp
Expand Up @@ -1724,7 +1724,6 @@ QgsSVGFillSymbolLayer::QgsSVGFillSymbolLayer( const QString &svgFilePath, double
mSvgStrokeColor = QColor( 35, 35, 35 );
mSvgStrokeWidth = 0.2;
setDefaultSvgParams();
mSvgPattern = nullptr;
}

QgsSVGFillSymbolLayer::QgsSVGFillSymbolLayer( const QByteArray &svgData, double width, double angle )
Expand All @@ -1742,12 +1741,6 @@ QgsSVGFillSymbolLayer::QgsSVGFillSymbolLayer( const QByteArray &svgData, double
mSvgStrokeWidth = 0.2;
setSubSymbol( new QgsLineSymbol() );
setDefaultSvgParams();
mSvgPattern = nullptr;
}

QgsSVGFillSymbolLayer::~QgsSVGFillSymbolLayer()
{
delete mSvgPattern;
}

void QgsSVGFillSymbolLayer::setOutputUnit( QgsUnitTypes::RenderUnit unit )
Expand Down Expand Up @@ -1926,14 +1919,11 @@ void QgsSVGFillSymbolLayer::applyPattern( QBrush &brush, const QString &svgFileP
return;
}

delete mSvgPattern;
mSvgPattern = nullptr;
double size = context.renderContext().convertToPainterUnits( patternWidth, patternWidthUnit, patternWidthMapUnitScale );

if ( static_cast< int >( size ) < 1.0 || 10000.0 < size )
{
mSvgPattern = new QImage();
brush.setTextureImage( *mSvgPattern );
brush.setTextureImage( QImage() );
}
else
{
Expand All @@ -1950,23 +1940,23 @@ void QgsSVGFillSymbolLayer::applyPattern( QBrush &brush, const QString &svgFileP
{
hwRatio = static_cast< double >( patternPict.height() ) / static_cast< double >( patternPict.width() );
}
mSvgPattern = new QImage( static_cast< int >( size ), static_cast< int >( size * hwRatio ), QImage::Format_ARGB32_Premultiplied );
mSvgPattern->fill( 0 ); // transparent background
patternImage = QImage( static_cast< int >( size ), static_cast< int >( size * hwRatio ), QImage::Format_ARGB32_Premultiplied );
patternImage.fill( 0 ); // transparent background

QPainter p( mSvgPattern );
QPainter p( &patternImage );
p.drawPicture( QPointF( size / 2, size * hwRatio / 2 ), patternPict );
}

QTransform brushTransform;
if ( !qgsDoubleNear( context.opacity(), 1.0 ) )
{
QImage transparentImage = fitsInCache ? patternImage.copy() : mSvgPattern->copy();
QImage transparentImage = patternImage.copy();
QgsSymbolLayerUtils::multiplyImageOpacity( &transparentImage, context.opacity() );
brush.setTextureImage( transparentImage );
}
else
{
brush.setTextureImage( fitsInCache ? patternImage : *mSvgPattern );
brush.setTextureImage( patternImage );
}
brush.setTransform( brushTransform );
}
Expand Down Expand Up @@ -3631,7 +3621,7 @@ QgsSymbolLayer *QgsRasterFillSymbolLayer::create( const QgsStringMap &properties

symbolLayer->restoreOldDataDefinedProperties( properties );

return symbolLaye.release()r;
return symbolLayer.release();
}

void QgsRasterFillSymbolLayer::resolvePaths( QgsStringMap &properties, const QgsPathResolver &pathResolver, bool saving )
Expand Down
3 changes: 0 additions & 3 deletions src/core/symbology/qgsfillsymbollayer.h
Expand Up @@ -915,7 +915,6 @@ class CORE_EXPORT QgsSVGFillSymbolLayer: public QgsImageFillSymbolLayer
//! Constructs SVG fill symbol layer with picture from given absolute path to a SVG file
QgsSVGFillSymbolLayer( const QString &svgFilePath, double width = 20, double rotation = 0.0 );
QgsSVGFillSymbolLayer( const QByteArray &svgData, double width = 20, double rotation = 0.0 );
~QgsSVGFillSymbolLayer() override;

static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
Expand Down Expand Up @@ -1004,8 +1003,6 @@ class CORE_EXPORT QgsSVGFillSymbolLayer: public QgsImageFillSymbolLayer
QString mSvgFilePath;
//! SVG view box (to keep the aspect ratio
QRectF mSvgViewBox;
//! SVG pattern image
QImage *mSvgPattern = nullptr;

//param(fill), param(stroke), param(stroke-width) are going
//to be replaced in memory
Expand Down

0 comments on commit 76190d5

Please sign in to comment.