Slightly refactored userpics stripe to deduplicate userpic preparation.

This commit is contained in:
23rd
2026-03-18 20:50:43 +03:00
parent c24a58672b
commit 49e75e1ab0
2 changed files with 29 additions and 0 deletions
@@ -83,6 +83,25 @@ bool NeedRegenerateUserpics(
return false;
}
PreparedUserpicsInRow PrepareUserpicsInRow(
const std::vector<not_null<PeerData*>> &peers,
const style::GroupCallUserpics &st,
int limit) {
auto rows = std::vector<UserpicInRow>();
rows.reserve(peers.size());
for (const auto &peer : peers) {
rows.push_back({ .peer = peer });
}
auto result = PreparedUserpicsInRow();
if (!rows.empty()) {
GenerateUserpicsInRow(result.image, rows, st, limit);
}
result.width = result.image.isNull()
? 0
: (result.image.width() / style::DevicePixelRatio());
return result;
}
rpl::producer<Ui::GroupCallBarContent> GroupCallBarContentByCall(
not_null<Data::GroupCall*> call,
int userpicSize) {
@@ -41,6 +41,16 @@ void GenerateUserpicsInRow(
const QImage &image,
const std::vector<UserpicInRow> &list);
struct PreparedUserpicsInRow {
QImage image;
int width = 0;
};
[[nodiscard]] PreparedUserpicsInRow PrepareUserpicsInRow(
const std::vector<not_null<PeerData*>> &peers,
const style::GroupCallUserpics &st,
int limit = 0);
[[nodiscard]] auto GroupCallBarContentByCall(
not_null<Data::GroupCall*> call,
int userpicSize)