mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Slightly refactored userpics stripe to deduplicate userpic preparation.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user