mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Make mini preview radius 2px.
This commit is contained in:
parent
992d636680
commit
576883ddc8
2 changed files with 24 additions and 1 deletions
|
@ -164,7 +164,29 @@ using ItemPreview = HistoryView::ItemPreview;
|
|||
size,
|
||||
size
|
||||
).convertToFormat(QImage::Format_ARGB32_Premultiplied);
|
||||
Images::prepareRound(square, radius);
|
||||
if (radius == ImageRoundRadius::Small) {
|
||||
struct Cache {
|
||||
base::flat_map<int, std::array<QImage, 4>> all;
|
||||
std::array<QImage, 4> *lastUsed = nullptr;
|
||||
int lastUsedRadius = 0;
|
||||
};
|
||||
static auto cache = Cache();
|
||||
const auto pxRadius = st::dialogsMiniPreviewRadius;
|
||||
if (!cache.lastUsed || cache.lastUsedRadius != pxRadius) {
|
||||
cache.lastUsedRadius = pxRadius;
|
||||
const auto i = cache.all.find(pxRadius);
|
||||
if (i != end(cache.all)) {
|
||||
cache.lastUsed = &i->second;
|
||||
} else {
|
||||
cache.lastUsed = &cache.all.emplace(
|
||||
pxRadius,
|
||||
Images::CornersMask(pxRadius)).first->second;
|
||||
}
|
||||
}
|
||||
Images::prepareRound(square, *cache.lastUsed);
|
||||
} else {
|
||||
Images::prepareRound(square, radius);
|
||||
}
|
||||
square.setDevicePixelRatio(factor);
|
||||
return square;
|
||||
}
|
||||
|
|
|
@ -298,6 +298,7 @@ dialogsScamRadius: 2px;
|
|||
|
||||
dialogsMiniPreviewTop: 1px;
|
||||
dialogsMiniPreview: 16px;
|
||||
dialogsMiniPreviewRadius: 2px;
|
||||
dialogsMiniPreviewSkip: 2px;
|
||||
dialogsMiniPreviewRight: 3px;
|
||||
dialogsMiniPlay: icon{{ "dialogs/dialogs_mini_play", videoPlayIconFg }};
|
||||
|
|
Loading…
Add table
Reference in a new issue