2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Added ability to show song cover in HistoryView and Overview::Layout.

This commit is contained in:
23rd
2021-01-09 22:52:55 +03:00
parent a483eb98a1
commit 8fffe7d128
7 changed files with 93 additions and 18 deletions

View File

@@ -343,7 +343,8 @@ const QPixmap &Image::pixBlurredSingle(
int outerw,
int outerh,
ImageRoundRadius radius,
RectParts corners) const {
RectParts corners,
const style::color *colored) const {
if (w <= 0 || !width() || !height()) {
w = width() * cIntRetinaFactor();
} else {
@@ -365,11 +366,14 @@ const QPixmap &Image::pixBlurredSingle(
} else if (radius == ImageRoundRadius::Ellipse) {
options |= Option::Circled | cornerOptions(corners);
}
if (colored) {
options |= Option::Colored;
}
auto k = SinglePixKey(options);
auto i = _cache.find(k);
if (i == _cache.cend() || i->second.width() != (outerw * cIntRetinaFactor()) || i->second.height() != (outerh * cIntRetinaFactor())) {
auto p = pixNoCache(w, h, options, outerw, outerh);
auto p = pixNoCache(w, h, options, outerw, outerh, colored);
p.setDevicePixelRatio(cRetinaFactor());
i = _cache.emplace_or_assign(k, p).first;
}