Skip to content
Permalink
Browse files
Remove useless member variable
  • Loading branch information
nyalldawson committed Oct 2, 2018
1 parent 6dd1bd3 commit 76190d594a174ef2eed87ca78c7c15326b2e5e8c
@@ -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/;
@@ -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 )
@@ -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 )
@@ -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
{
@@ -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 );
}
@@ -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 )
@@ -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;
@@ -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

0 comments on commit 76190d5

Please sign in to comment.