mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-19 00:42:14 -07:00
update pixmap cache
This commit is contained in:
parent
e123ed5913
commit
00fc59f572
2 changed files with 28 additions and 0 deletions
|
|
@ -357,6 +357,21 @@ QPixmap LockPixmapGenerator::generatePixmap(int height)
|
||||||
|
|
||||||
QMap<int, QPixmap> LockPixmapGenerator::pmCache;
|
QMap<int, QPixmap> LockPixmapGenerator::pmCache;
|
||||||
|
|
||||||
|
QPixmap ExpandIconPixmapGenerator::generatePixmap(int height, bool expanded)
|
||||||
|
{
|
||||||
|
QString key = QString::number(expanded) + ":" + QString::number(height);
|
||||||
|
if (pmCache.contains(key))
|
||||||
|
return pmCache.value(key);
|
||||||
|
|
||||||
|
QString name = expanded ? "dropdown_expanded" : "dropdown_collapsed";
|
||||||
|
QPixmap pixmap = tryLoadImage("theme:icons/" + name, QSize(height, height));
|
||||||
|
|
||||||
|
pmCache.insert(key, pixmap);
|
||||||
|
return pixmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap<QString, QPixmap> ExpandIconPixmapGenerator::pmCache;
|
||||||
|
|
||||||
QPixmap loadColorAdjustedPixmap(const QString &name)
|
QPixmap loadColorAdjustedPixmap(const QString &name)
|
||||||
{
|
{
|
||||||
if (qApp->palette().windowText().color().lightness() > 200) {
|
if (qApp->palette().windowText().color().lightness() > 200) {
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,19 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ExpandIconPixmapGenerator
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
static QMap<QString, QPixmap> pmCache;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static QPixmap generatePixmap(int height, bool expanded);
|
||||||
|
static void clear()
|
||||||
|
{
|
||||||
|
pmCache.clear();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
QPixmap loadColorAdjustedPixmap(const QString &name);
|
QPixmap loadColorAdjustedPixmap(const QString &name);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue