mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-01 09:55:24 +00:00
feat: avatar corners
This commit is contained in:
@@ -54,6 +54,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "storage/storage_facade.h"
|
||||
#include "storage/storage_shared_media.h"
|
||||
|
||||
// AyuGram includes
|
||||
#include "ayu/ui/ayu_userpic.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr auto kUpdateFullPeerTimeout = crl::time(5000); // Not more than once in 5 seconds.
|
||||
@@ -484,6 +488,14 @@ QImage PeerData::GenerateUserpicImage(
|
||||
Ui::PeerUserpicView &view,
|
||||
int size,
|
||||
std::optional<int> radius) {
|
||||
if (!radius) {
|
||||
const auto shape = peer->isForum()
|
||||
? Ui::PeerUserpicShape::Forum
|
||||
: Ui::PeerUserpicShape::Circle;
|
||||
if (AyuUserpic::ShouldOverrideShape(shape)) {
|
||||
radius = AyuUserpic::ComputeRadius(size);
|
||||
}
|
||||
}
|
||||
if (const auto userpic = peer->userpicCloudImage(view)) {
|
||||
auto image = userpic->scaled(
|
||||
{ size, size },
|
||||
|
||||
Reference in New Issue
Block a user