Skip to content

Commit 3274e19

Browse files
committed
Remove more unused raster scale factor handling
1 parent 48797fa commit 3274e19

13 files changed

Lines changed: 50 additions & 57 deletions

‎doc/api_break.dox‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,6 +1632,12 @@ QgsSvgCache {#qgis_api_break_3_0_QgsSvgCache}
16321632

16331633
- This class is no longer a singleton and instance() has been removed. Instead use QgsApplication::svgCache() to access an application-wide cache.
16341634
- containsParamsV2() was removed. Use containsParamsV3() instead.
1635+
- The rasterScaleFactor parameter was removed from all methods
1636+
1637+
QgsSvgCacheEntry {#qgis_api_break_3_0_QgsSvgCacheEntry}
1638+
----------------
1639+
1640+
- The rasterScaleFactor member was removed.
16351641

16361642
QgsStyle (renamed from QgsStyleV2) {#qgis_api_break_3_0_QgsStyle}
16371643
----------------------------------

‎python/core/symbology-ng/qgssvgcache.sip‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class QgsSvgCacheEntry
1616
* @param outline color of outline
1717
* @param lookupKey the key string used in QgsSvgCache for quick lookup of this entry (relative or absolute path)
1818
*/
19-
QgsSvgCacheEntry( const QString& file, double size, double outlineWidth, double widthScaleFactor, double rasterScaleFactor, const QColor& fill, const QColor& outline, const QString& lookupKey = QString() );
19+
QgsSvgCacheEntry( const QString& file, double size, double outlineWidth, double widthScaleFactor, const QColor& fill, const QColor& outline, const QString& lookupKey = QString() );
2020
~QgsSvgCacheEntry();
2121

2222
//! Absolute path to SVG file
@@ -26,7 +26,6 @@ class QgsSvgCacheEntry
2626
double size; //size in pixels (cast to int for QImage)
2727
double outlineWidth;
2828
double widthScaleFactor;
29-
double rasterScaleFactor;
3029

3130
/** SVG viewbox size.
3231
* @note added in QGIS 2.14
@@ -80,7 +79,7 @@ class QgsSvgCache : QObject
8079
* @param fitsInCache
8180
*/
8281
QImage svgAsImage( const QString& file, double size, const QColor& fill, const QColor& outline, double outlineWidth,
83-
double widthScaleFactor, double rasterScaleFactor, bool& fitsInCache );
82+
double widthScaleFactor, bool& fitsInCache );
8483
/** Get SVG as QPicture&.
8584
* @param file Absolute or relative path to SVG file.
8685
* @param size size of cached image
@@ -92,7 +91,7 @@ class QgsSvgCache : QObject
9291
* @param forceVectorOutput
9392
*/
9493
QPicture svgAsPicture( const QString& file, double size, const QColor& fill, const QColor& outline, double outlineWidth,
95-
double widthScaleFactor, double rasterScaleFactor, bool forceVectorOutput = false );
94+
double widthScaleFactor, bool forceVectorOutput = false );
9695

9796
/** Calculates the viewbox size of a (possibly cached) SVG file.
9897
* @param file Absolute or relative path to SVG file.
@@ -106,7 +105,7 @@ class QgsSvgCache : QObject
106105
* @note added in QGIS 2.14
107106
*/
108107
QSizeF svgViewboxSize( const QString& file, double size, const QColor& fill, const QColor& outline, double outlineWidth,
109-
double widthScaleFactor, double rasterScaleFactor );
108+
double widthScaleFactor );
110109

111110
/** Tests if an svg file contains parameters for fill, outline color, outline width. If yes, possible default values are returned. If there are several
112111
default values in the svg file, only the first one is considered*/
@@ -145,7 +144,7 @@ class QgsSvgCache : QObject
145144

146145
/** Get SVG content*/
147146
QByteArray svgContent( const QString& file, double size, const QColor& fill, const QColor& outline, double outlineWidth,
148-
double widthScaleFactor, double rasterScaleFactor );
147+
double widthScaleFactor );
149148

150149
signals:
151150
/** Emit a signal to be caught by qgisapp and display a msg on status bar */
@@ -164,14 +163,14 @@ class QgsSvgCache : QObject
164163
* @param rasterScaleFactor raster scale factor
165164
*/
166165
QgsSvgCacheEntry* insertSVG( const QString& file, double size, const QColor& fill, const QColor& outline, double outlineWidth,
167-
double widthScaleFactor, double rasterScaleFactor );
166+
double widthScaleFactor );
168167

169168
void replaceParamsAndCacheSvg( QgsSvgCacheEntry* entry );
170169
void cacheImage( QgsSvgCacheEntry* entry );
171170
void cachePicture( QgsSvgCacheEntry* entry, bool forceVectorOutput = false );
172171
/** Returns entry from cache or creates a new entry if it does not exist already*/
173172
QgsSvgCacheEntry* cacheEntry( const QString& file, double size, const QColor& fill, const QColor& outline, double outlineWidth,
174-
double widthScaleFactor, double rasterScaleFactor );
173+
double widthScaleFactor );
175174

176175
/** Removes the least used items until the maximum size is under the limit*/
177176
void trimToMaximumSize();

‎src/app/composer/qgscomposerpicturewidget.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ QIcon QgsComposerPictureWidget::svgToIcon( const QString& filePath ) const
434434
outlineWidth = 0.6;
435435

436436
bool fitsInCache; // should always fit in cache at these sizes (i.e. under 559 px ^ 2, or half cache size)
437-
const QImage& img = QgsApplication::svgCache()->svgAsImage( filePath, 30.0, fill, outline, outlineWidth, 3.5 /*appr. 88 dpi*/, 1.0, fitsInCache );
437+
const QImage& img = QgsApplication::svgCache()->svgAsImage( filePath, 30.0, fill, outline, outlineWidth, 3.5 /*appr. 88 dpi*/, fitsInCache );
438438

439439
return QIcon( QPixmap::fromImage( img ) );
440440
}

‎src/core/composer/qgscomposerarrow.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ void QgsComposerArrow::drawSVGMarker( QPainter* p, MarkerType type, const QStrin
256256

257257
QSvgRenderer r;
258258
const QByteArray &svgContent = QgsApplication::svgCache()->svgContent( svgFileName, mArrowHeadWidth, mArrowHeadFillColor, mArrowHeadOutlineColor, mArrowHeadOutlineWidth,
259-
1.0, 1.0 );
259+
1.0 );
260260
r.load( svgContent );
261261

262262
p->save();

‎src/core/composer/qgscomposerpicture.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ void QgsComposerPicture::loadLocalPicture( const QString &path )
373373
{
374374
//try to open svg
375375
const QByteArray &svgContent = QgsApplication::svgCache()->svgContent( pic.fileName(), rect().width(), mSvgFillColor, mSvgBorderColor, mSvgBorderWidth,
376-
1.0, 1.0 );
376+
1.0 );
377377
mSVG.load( svgContent );
378378
if ( mSVG.isValid() )
379379
{

‎src/core/qgspallabeling.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2232,7 +2232,7 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, QgsRenderContext &cont
22322232
// TODO: only for placement which needs character info
22332233
// account for any data defined font metrics adjustments
22342234
lf->calculateInfo( placement == QgsPalLayerSettings::Curved || placement == QgsPalLayerSettings::PerimeterCurved,
2235-
labelFontMetrics.data(), xform, 1.0, maxcharanglein, maxcharangleout );
2235+
labelFontMetrics.data(), xform, maxcharanglein, maxcharangleout );
22362236
// for labelFeature the LabelInfo is passed to feat when it is registered
22372237

22382238
// TODO: allow layer-wide feature dist in PAL...?

‎src/core/qgstextlabelfeature.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ QString QgsTextLabelFeature::text( int partId ) const
4343
}
4444

4545

46-
void QgsTextLabelFeature::calculateInfo( bool curvedLabeling, QFontMetricsF* fm, const QgsMapToPixel* xform, double fontScale, double maxinangle, double maxoutangle )
46+
void QgsTextLabelFeature::calculateInfo( bool curvedLabeling, QFontMetricsF* fm, const QgsMapToPixel* xform, double maxinangle, double maxoutangle )
4747
{
4848
if ( mInfo )
4949
return;
@@ -65,7 +65,7 @@ void QgsTextLabelFeature::calculateInfo( bool curvedLabeling, QFontMetricsF* fm,
6565

6666
// create label info!
6767
double mapScale = xform->mapUnitsPerPixel();
68-
double labelHeight = mapScale * fm->height() / fontScale;
68+
double labelHeight = mapScale * fm->height();
6969

7070
// mLetterSpacing/mWordSpacing = 0.0 is default for non-curved labels
7171
// (non-curved spacings handled by Qt in QgsPalLayerSettings/QgsPalLabeling)
@@ -102,7 +102,7 @@ void QgsTextLabelFeature::calculateInfo( bool curvedLabeling, QFontMetricsF* fm,
102102
charWidth = fm->width( QString( mClusters[i] ) ) + wordSpaceFix;
103103
}
104104

105-
double labelWidth = mapScale * charWidth / fontScale;
105+
double labelWidth = mapScale * charWidth;
106106
mInfo->char_info[i].width = labelWidth;
107107
}
108108
}

‎src/core/qgstextlabelfeature.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class QgsTextLabelFeature : public QgsLabelFeature
3939
QString text( int partId ) const;
4040

4141
//! calculate data for info(). setDefinedFont() must have been called already.
42-
void calculateInfo( bool curvedLabeling, QFontMetricsF* fm, const QgsMapToPixel* xform, double fontScale, double maxinangle, double maxoutangle );
42+
void calculateInfo( bool curvedLabeling, QFontMetricsF* fm, const QgsMapToPixel* xform, double maxinangle, double maxoutangle );
4343

4444
//! Get data-defined values
4545
const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant >& dataDefinedValues() const { return mDataDefinedValues; }

‎src/core/symbology-ng/qgsfillsymbollayer.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1951,11 +1951,11 @@ void QgsSVGFillSymbolLayer::applyPattern( QBrush& brush, const QString& svgFileP
19511951
bool fitsInCache = true;
19521952
double outlineWidth = QgsSymbolLayerUtils::convertToPainterUnits( context.renderContext(), svgOutlineWidth, svgOutlineWidthUnit, svgOutlineWidthMapUnitScale );
19531953
const QImage& patternImage = QgsApplication::svgCache()->svgAsImage( svgFilePath, size, svgFillColor, svgOutlineColor, outlineWidth,
1954-
context.renderContext().scaleFactor(), 1.0, fitsInCache );
1954+
context.renderContext().scaleFactor(), fitsInCache );
19551955
if ( !fitsInCache )
19561956
{
19571957
const QPicture& patternPict = QgsApplication::svgCache()->svgAsPicture( svgFilePath, size, svgFillColor, svgOutlineColor, outlineWidth,
1958-
context.renderContext().scaleFactor(), 1.0 );
1958+
context.renderContext().scaleFactor() );
19591959
double hwRatio = 1.0;
19601960
if ( patternPict.width() > 0 )
19611961
{

‎src/core/symbology-ng/qgsmarkersymbollayer.cpp‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1973,7 +1973,7 @@ void QgsSvgMarkerSymbolLayer::renderPoint( QPointF point, QgsSymbolRenderContext
19731973
{
19741974
usePict = false;
19751975
const QImage& img = QgsApplication::svgCache()->svgAsImage( path, size, fillColor, outlineColor, outlineWidth,
1976-
context.renderContext().scaleFactor(), 1.0, fitsInCache );
1976+
context.renderContext().scaleFactor(), fitsInCache );
19771977
if ( fitsInCache && img.width() > 1 )
19781978
{
19791979
//consider transparency
@@ -1996,7 +1996,7 @@ void QgsSvgMarkerSymbolLayer::renderPoint( QPointF point, QgsSymbolRenderContext
19961996
{
19971997
p->setOpacity( context.alpha() );
19981998
const QPicture& pct = QgsApplication::svgCache()->svgAsPicture( path, size, fillColor, outlineColor, outlineWidth,
1999-
context.renderContext().scaleFactor(), 1.0, context.renderContext().forceVectorOutput() );
1999+
context.renderContext().scaleFactor(), context.renderContext().forceVectorOutput() );
20002000

20012001
if ( pct.width() > 1 )
20022002
{
@@ -2348,8 +2348,7 @@ bool QgsSvgMarkerSymbolLayer::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa
23482348
}
23492349

23502350
const QByteArray &svgContent = QgsApplication::svgCache()->svgContent( path, size, fillColor, outlineColor, outlineWidth,
2351-
context.renderContext().scaleFactor(),
2352-
1.0 );
2351+
context.renderContext().scaleFactor() );
23532352

23542353
//if current entry image is 0: cache image for entry
23552354
// checks to see if image will fit into cache
@@ -2431,8 +2430,7 @@ QRectF QgsSvgMarkerSymbolLayer::bounds( QPointF point, QgsSymbolRenderContext& c
24312430
}
24322431

24332432
QSizeF svgViewbox = QgsApplication::svgCache()->svgViewboxSize( path, scaledSize, fillColor, outlineColor, outlineWidth,
2434-
context.renderContext().scaleFactor(),
2435-
1.0 );
2433+
context.renderContext().scaleFactor() );
24362434

24372435
double scaledHeight = svgViewbox.isValid() ? scaledSize * svgViewbox.height() / svgViewbox.width() : scaledSize;
24382436

0 commit comments

Comments
 (0)