Skip to content

Commit 8fb47de

Browse files
committed
Pixmap cache, cache color
1 parent c088b90 commit 8fb47de

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/resources/fonticon.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ namespace {
1616
class FontIconEngine : public QIconEngine
1717
{
1818
public:
19-
FontIconEngine(FontIcon::FontFamily family, QChar glyph, FontIcon::Size size)
19+
FontIconEngine(FontIcon::FontFamily family, QChar glyph, FontIcon::Size size, const QColor &color = OCC::Resources::tint())
2020
: _family(family)
2121
, _glyph(glyph)
2222
, _size(size)
23+
, _color(color)
2324
{
2425
}
2526

@@ -29,7 +30,7 @@ class FontIconEngine : public QIconEngine
2930
painter->setRenderHint(QPainter::Antialiasing);
3031

3132
auto pen = painter->pen();
32-
pen.setColor(OCC::Resources::tint());
33+
pen.setColor(_color);
3334
painter->setPen(pen);
3435

3536
auto font = painter->font();
@@ -83,16 +84,17 @@ class FontIconEngine : public QIconEngine
8384
return pixmap;
8485
}
8586

86-
QIconEngine *clone() const override { return new FontIconEngine(this->_family, this->_glyph, this->_size); }
87+
QIconEngine *clone() const override { return new FontIconEngine(this->_family, this->_glyph, this->_size, this->_color); }
8788

8889
QString pixmapKey(const QSize &size, QIcon::Mode mode, QIcon::State state)
8990
{
90-
return QStringLiteral("FontIcon:%1").arg(QString::number(qHashMulti(0, _family, _glyph, _size, size, mode, state), 16));
91+
return QStringLiteral("FontIcon:%1").arg(QString::number(qHashMulti(0, _family, _glyph, _size, _color.rgb(), size, mode, state), 16));
9192
}
9293

9394
const FontIcon::FontFamily _family;
9495
const QChar _glyph;
9596
const FontIcon::Size _size;
97+
const QColor _color;
9698
};
9799
}
98100

0 commit comments

Comments
 (0)