diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index d696149a9d..97c0d49242 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -23,6 +23,7 @@ #include #include #include +#include static const std::string m_class_name = "GameViewer"; inline std::string sstr(const QString& _in) { return _in.toUtf8().toStdString(); } @@ -754,6 +755,15 @@ void game_list_frame::ResizeIcons(const QString& sizeStr, const QSize& size, con Refresh(); } +QIcon game_list_frame::colorizedIcon(const QIcon& icon, const QColor& oldColor, const QColor& newColor) +{ + QPixmap pixmap = icon.pixmap(icon.availableSizes().at(0)); + QBitmap mask = pixmap.createMaskFromColor(oldColor, Qt::MaskOutColor); + pixmap.fill(newColor); + pixmap.setMask(mask); + return QIcon(pixmap); +} + void game_list_frame::SetListMode(const bool& isList) { m_oldLayoutIsList = m_isListLayout; diff --git a/rpcs3/rpcs3qt/game_list_frame.h b/rpcs3/rpcs3qt/game_list_frame.h index 14928839f4..e8455e3153 100644 --- a/rpcs3/rpcs3qt/game_list_frame.h +++ b/rpcs3/rpcs3qt/game_list_frame.h @@ -189,6 +189,8 @@ public: /** Resize Gamelist Icons to size */ void ResizeIcons(const QString& sizeStr, const QSize& size, const int& index); + static QIcon colorizedIcon(const QIcon& icon, const QColor& oldColor, const QColor& newColor); + public Q_SLOTS: void SetListMode(const bool& isList); void SetToolBarVisible(const bool& showToolBar);