Skip to content

Commit ee4c012

Browse files
committed
Added support for scaling non-sdf icons
1 parent 6f4f25a commit ee4c012

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/sprites.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,15 @@ QImage Sprites::sprite(const Sprite &sprite, const QColor &color, qreal scale)
123123
return sdf2img(simg, color);
124124
} else
125125
return sdf2img(img, color);
126-
} else
127-
return img;
126+
} else {
127+
if (scale != 1.0) {
128+
QSize size(img.size().width() * scale, img.size().height() * scale);
129+
QImage simg(img.scaled(size, Qt::IgnoreAspectRatio,
130+
Qt::SmoothTransformation));
131+
return simg;
132+
} else
133+
return img;
134+
}
128135
}
129136

130137
QImage Sprites::icon(const QString &name, const QColor &color, qreal size)

src/style.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ class Style : public QObject
9191

9292
class Layout {
9393
public:
94-
Layout() : _textSize(16), _textMaxWidth(10), _textMaxAngle(45),
95-
_font("Open Sans"), _visible(true) {}
94+
Layout() : _iconSize(1.0), _textSize(16), _textMaxWidth(10),
95+
_textMaxAngle(45), _font("Open Sans"), _visible(true) {}
9696
Layout(const QJsonObject &json);
9797

9898
qreal maxTextWidth(int zoom) const

0 commit comments

Comments
 (0)