| 32 | static constexpr int MIN_COVER_CACHE_SIZE = 256; |
| 33 | |
| 34 | static QPixmap createPlaceholderImage(const QPixmap& placeholder_pixmap, int width, int height, float scale, |
| 35 | qreal dpr, const std::string& title) |
| 36 | { |
| 37 | QPixmap pm(placeholder_pixmap.copy()); |
| 38 | pm.setDevicePixelRatio(dpr); |
| 39 | if (pm.isNull()) |
| 40 | return QPixmap(); |
| 41 | |
| 42 | QtUtils::resizeAndScalePixmap(&pm, width, height, dpr, QtUtils::ScalingMode::Fit, 100); |
| 43 | QPainter painter; |
| 44 | if (painter.begin(&pm)) |
| 45 | { |
| 46 | QFont font; |
| 47 | font.setPointSize(std::max(static_cast<int>(32.0f * scale), 1)); |
| 48 | painter.setFont(font); |
| 49 | painter.setPen(Qt::white); |
| 50 | |
| 51 | const QRect text_rc(0, 0, static_cast<int>(static_cast<float>(width)), |
| 52 | static_cast<int>(static_cast<float>(height))); |
| 53 | painter.drawText(text_rc, Qt::AlignCenter | Qt::TextWordWrap, QString::fromStdString(title)); |
| 54 | painter.end(); |
| 55 | } |
| 56 | |
| 57 | return pm; |
| 58 | } |
| 59 | |
| 60 | std::optional<GameListModel::Column> GameListModel::getColumnIdForName(const std::string_view name) |
| 61 | { |
no test coverage detected