Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Option][WIP] Profile pic rounding
Browse files Browse the repository at this point in the history
EricKotato committed Jul 1, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 6177ad0 commit a6614e2
Showing 23 changed files with 277 additions and 35 deletions.
2 changes: 2 additions & 0 deletions Telegram/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1009,6 +1009,8 @@ PRIVATE
kotato/boxes/kotato_unpin_box.h
kotato/kotato_lang.cpp
kotato/kotato_lang.h
kotato/kotato_radius.cpp
kotato/kotato_radius.h
kotato/kotato_settings.cpp
kotato/kotato_settings.h
kotato/kotato_settings_menu.cpp
5 changes: 2 additions & 3 deletions Telegram/SourceFiles/boxes/peer_list_box.cpp
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ For license and copyright information please follow this link:
*/
#include "boxes/peer_list_box.h"

#include "kotato/kotato_radius.h"
#include "kotato/kotato_lang.h"
#include "history/history.h" // chatListNameSortKey.
#include "main/session/session_show.h"
@@ -904,9 +905,7 @@ void PeerListRow::createCheckbox(
const style::RoundImageCheckbox &st,
Fn<void()> updateCallback) {
const auto generateRadius = [=](int size) {
return (!special() && peer()->isForum())
? int(size * Ui::ForumUserpicRadiusMultiplier())
: std::optional<int>();
return int(size * Kotato::UserpicRadius(!special() && peer()->isForum()));
};
_checkbox = std::make_unique<Ui::RoundImageCheckbox>(
st,
2 changes: 2 additions & 0 deletions Telegram/SourceFiles/core/launcher.cpp
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ For license and copyright information please follow this link:
*/
#include "core/launcher.h"

#include "kotato/kotato_radius.h"
#include "kotato/kotato_settings.h"
#include "kotato/kotato_version.h"
#include "platform/platform_launcher.h"
@@ -375,6 +376,7 @@ int Launcher::exec() {
Logs::start();
base::options::init(cWorkingDir() + "tdata/experimental_options.json");
Kotato::JsonSettings::Load();
Kotato::RefreshRadius();

// Must be called after options are inited.
initHighDpi();
24 changes: 22 additions & 2 deletions Telegram/SourceFiles/data/data_peer.cpp
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ For license and copyright information please follow this link:
*/
#include "data/data_peer.h"

#include "kotato/kotato_radius.h"
#include "data/data_user.h"
#include "data/data_chat.h"
#include "data/data_chat_participant_status.h"
@@ -382,6 +383,7 @@ QImage PeerData::generateUserpicImage(
Ui::PeerUserpicView &view,
int size,
std::optional<int> radius) const {
const auto radiusOption = Kotato::UserpicRadius(isForum());
if (const auto userpic = userpicCloudImage(view)) {
auto image = userpic->scaled(
{ size, size },
@@ -393,7 +395,13 @@ QImage PeerData::generateUserpicImage(
Images::CornersMask(radius / style::DevicePixelRatio()));
};
if (radius == 0) {
return image;
if (radiusOption == 0.0) {
return image;
} else if (radiusOption) {
return round(size * radiusOption);
} else {
return Images::Circle(std::move(image));
}
} else if (radius) {
return round(*radius);
} else if (isForum()) {
@@ -409,7 +417,19 @@ QImage PeerData::generateUserpicImage(

Painter p(&result);
if (radius == 0) {
ensureEmptyUserpic()->paintSquare(p, 0, 0, size, size);
if (radiusOption == 0.0) {
ensureEmptyUserpic()->paintSquare(p, 0, 0, size, size);
} else if (radiusOption) {
ensureEmptyUserpic()->paintRounded(
p,
0,
0,
size,
size,
size * radiusOption);
} else {
ensureEmptyUserpic()->paintCircle(p, 0, 0, size, size);
}
} else if (radius) {
ensureEmptyUserpic()->paintRounded(p, 0, 0, size, size, *radius);
} else if (isForum()) {
3 changes: 2 additions & 1 deletion Telegram/SourceFiles/dialogs/dialogs_row.cpp
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ For license and copyright information please follow this link:
*/
#include "dialogs/dialogs_row.h"

#include "kotato/kotato_radius.h"
#include "ui/chat/chat_theme.h" // CountAverageColor.
#include "ui/color_contrast.h"
#include "ui/effects/outline_segments.h"
@@ -416,7 +417,7 @@ void Row::PaintCornerBadgeFrame(
: st::dialogsCallBadgeSize;
const auto stroke = st::dialogsOnlineBadgeStroke;
const auto skip = online
? st::dialogsOnlineBadgeSkip
? Kotato::UserpicOnlineBadgeSkip()
: st::dialogsCallBadgeSkip;
const auto shrink = (size / 2) * (1. - topLayerProgress);

5 changes: 3 additions & 2 deletions Telegram/SourceFiles/dialogs/ui/dialogs_stories_list.cpp
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ For license and copyright information please follow this link:
*/
#include "dialogs/ui/dialogs_stories_list.h"

#include "kotato/kotato_radius.h"
#include "base/event_filter.h"
#include "base/qt_signal_producer.h"
#include "lang/lang_keys.h"
@@ -528,7 +529,7 @@ void List::paint(
if (!fullUnreadCount) {
p.setPen(QPen(gradient, line));
p.setBrush(Qt::NoBrush);
p.drawEllipse(outer);
Kotato::DrawUserpicShape(p, outer, outerAdd);
} else {
validateSegments(itemFull, gradient, line, true);
Ui::PaintOutlineSegments(
@@ -569,7 +570,7 @@ void List::paint(
p.setCompositionMode(QPainter::CompositionMode_Source);
p.setPen(Qt::NoPen);
p.setBrush(st::transparent);
p.drawEllipse(rect);
Kotato::DrawUserpicShape(p, rect, add);
p.setCompositionMode(QPainter::CompositionMode_SourceOver);
}
if (hasReadLine) {
3 changes: 2 additions & 1 deletion Telegram/SourceFiles/dialogs/ui/dialogs_video_userpic.cpp
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ For license and copyright information please follow this link:
*/
#include "dialogs/ui/dialogs_video_userpic.h"

#include "kotato/kotato_radius.h"
#include "core/file_location.h"
#include "data/data_peer.h"
#include "data/data_photo.h"
@@ -100,7 +101,7 @@ Media::Clip::FrameRequest VideoUserpic::request(int size) const {
.frame = { size, size },
.outer = { size, size },
.factor = cIntRetinaFactor(),
.radius = ImageRoundRadius::Ellipse,
.radius = Kotato::UserpicRadius(),
};
}

Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ For license and copyright information please follow this link:
*/
#include "history/view/history_view_group_call_bar.h"

#include "kotato/kotato_radius.h"
#include "data/data_channel.h"
#include "data/data_user.h"
#include "data/data_changes.h"
@@ -59,7 +60,7 @@ void GenerateUserpicsInRow(
q.setCompositionMode(QPainter::CompositionMode_Source);
q.setBrush(Qt::NoBrush);
q.setPen(pen);
q.drawEllipse(x, 0, single, single);
Kotato::DrawUserpicShape(q, x, 0, single, single, single);
x -= single - shift;
}
}
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ For license and copyright information please follow this link:
*/
#include "history/view/reactions/history_view_reactions.h"

#include "kotato/kotato_radius.h"
#include "history/history_item.h"
#include "history/history.h"
#include "history/view/history_view_message.h"
@@ -623,7 +624,7 @@ void InlineList::paintSingleBg(
float64 opacity) const {
p.setOpacity(opacity);
if (!areTags()) {
const auto radius = fill.height() / 2.;
const auto radius = fill.height() * Kotato::UserpicRadius();
p.setBrush(color);
p.drawRoundedRect(fill, radius, radius);
return;
143 changes: 143 additions & 0 deletions Telegram/SourceFiles/kotato/kotato_radius.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
/*
This file is part of Kotatogram Desktop,
the unofficial app based on Telegram Desktop.
For license and copyright information please follow this link:
https://github.com/kotatogram/kotatogram-desktop/blob/dev/LEGAL
*/
#include "kotato/kotato_radius.h"

#include "kotato/kotato_settings.h"
#include "ui/painter.h"
#include "styles/style_chat.h"
#include "styles/style_dialogs.h"

namespace Kotato {
namespace {

struct Radius {
float64 userpicRadius = 0.5;
float64 forumUserpicRadius = 0.3;
bool useDefaultRadiusForForum = false;
style::point onlineBadgeSkip = st::dialogsOnlineBadgeSkip;
};

Radius radius;

} // namespace

void RefreshRadius() {
radius.userpicRadius = float64(JsonSettings::GetInt("userpic_corner_radius")) / 100.0;
radius.forumUserpicRadius = float64(JsonSettings::GetInt("userpic_corner_radius_forum")) / 100.0;
radius.useDefaultRadiusForForum = JsonSettings::GetBool("userpic_corner_radius_forum_use_default");
radius.onlineBadgeSkip = {
style::ConvertScale(int(2 * radius.userpicRadius) - 1),
style::ConvertScale(int(6 * radius.userpicRadius) - 1),
};
}

float64 UserpicRadius(bool isForum) {
if (isForum && !radius.useDefaultRadiusForForum) {
return radius.forumUserpicRadius;
}
return radius.userpicRadius;
}

void DrawUserpicShape(
QPainter &p,
QRect rect,
float64 size,
bool isForum) {
const auto r = UserpicRadius(isForum);
if (r >= 0.5) {
p.drawEllipse(rect);
} else if (r) {
p.drawRoundedRect(rect, size * r, size * r);
} else {
p.fillRect(rect, p.brush());
}
}

void DrawUserpicShape(
QPainter &p,
QRectF rect,
float64 size,
bool isForum) {
const auto r = UserpicRadius(isForum);
if (r >= 0.5) {
p.drawEllipse(rect);
} else if (r) {
p.drawRoundedRect(rect, size * r, size * r);
} else {
p.fillRect(rect, p.brush());
}
}

void DrawUserpicShape(
QPainter &p,
int x,
int y,
int w,
int h,
float64 size,
bool isForum) {
const auto r = UserpicRadius(isForum);
if (r >= 0.5) {
p.drawEllipse(x, y, w, h);
} else if (r) {
p.drawRoundedRect(x, y, w, h, size * r, size * r);
} else {
p.fillRect(x, y, w, h, p.brush());
}
}

style::point UserpicOnlineBadgeSkip() {
return radius.onlineBadgeSkip;
}

QPixmap MessageTailLeft(style::color color) {
const auto tail = st::historyBubbleTailInLeft;
QImage rect(tail.width(), tail.height(), QImage::Format_ARGB32_Premultiplied);
rect.fill(color->c);
{
auto p = QPainter(&rect);
PainterHighQualityEnabler hq(p);

p.setCompositionMode(QPainter::CompositionMode_Source);
p.setPen(Qt::NoPen);
p.setBrush(Qt::transparent);
p.drawRoundedRect(
tail.width()-st::msgPhotoSize+style::ConvertScale(1),
tail.height()-st::msgPhotoSize+style::ConvertScale(2),
st::msgPhotoSize,
st::msgPhotoSize,
st::msgPhotoSize * radius.userpicRadius,
st::msgPhotoSize * radius.userpicRadius);
}
return QPixmap::fromImage(rect);
}

QPixmap MessageTailRight(style::color color) {
const auto tail = st::historyBubbleTailInRight;
QImage rect(tail.width(), tail.height(), QImage::Format_ARGB32_Premultiplied);
rect.fill(color->c);
{
auto p = QPainter(&rect);
PainterHighQualityEnabler hq(p);

p.setCompositionMode(QPainter::CompositionMode_Source);
p.setPen(Qt::NoPen);
p.setBrush(Qt::transparent);
p.drawRoundedRect(
-style::ConvertScale(1),
tail.height()-st::msgPhotoSize+style::ConvertScale(2),
st::msgPhotoSize,
st::msgPhotoSize,
st::msgPhotoSize * radius.userpicRadius,
st::msgPhotoSize * radius.userpicRadius);
}
return QPixmap::fromImage(rect);
}


} // namespace Kotato
38 changes: 38 additions & 0 deletions Telegram/SourceFiles/kotato/kotato_radius.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
This file is part of Kotatogram Desktop,
the unofficial app based on Telegram Desktop.
For license and copyright information please follow this link:
https://github.com/kotatogram/kotatogram-desktop/blob/dev/LEGAL
*/
#pragma once

namespace Kotato {

void RefreshRadius();
float64 UserpicRadius(bool isForum = false);
void DrawUserpicShape(
QPainter &p,
QRect rect,
float64 size,
bool isForum = false);
void DrawUserpicShape(
QPainter &p,
QRectF rect,
float64 size,
bool isForum = false);
void DrawUserpicShape(
QPainter &p,
int x,
int y,
int w,
int h,
float64 size,
bool isForum = false);

style::point UserpicOnlineBadgeSkip();

QPixmap MessageTailLeft(style::color color);
QPixmap MessageTailRight(style::color color);

} // namespace Kotato
11 changes: 11 additions & 0 deletions Telegram/SourceFiles/kotato/kotato_settings.cpp
Original file line number Diff line number Diff line change
@@ -333,6 +333,17 @@ const std::map<QString, Definition, std::greater<QString>> DefinitionMap {
.type = SettingType::IntSetting,
.defaultValue = 20,
.limitHandler = IntLimit(0, 200, 20), }},
{ "userpic_corner_radius", {
.type = SettingType::IntSetting,
.defaultValue = 50,
.limitHandler = IntLimit(0, 50), }},
{ "userpic_corner_radius_forum", {
.type = SettingType::IntSetting,
.defaultValue = 30,
.limitHandler = IntLimit(0, 50), }},
{ "userpic_corner_radius_forum_use_default", {
.type = SettingType::BoolSetting,
.defaultValue = false, }},
{ "always_show_top_userpic", {
.type = SettingType::BoolSetting,
.defaultValue = false, }},
5 changes: 2 additions & 3 deletions Telegram/SourceFiles/media/clip/media_clip_reader.cpp
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ QImage PrepareFrame(
const auto needResize = (original.size() != request.frame);
const auto needOuterFill = request.outer.isValid()
&& (request.outer != request.frame);
const auto needRounding = (request.radius != ImageRoundRadius::None);
const auto needRounding = (request.radius > 0.0);
const auto colorizing = (request.colored.alpha() != 0);
if (!needResize
&& !needOuterFill
@@ -98,8 +98,7 @@ QImage PrepareFrame(
if (needRounding) {
cache = Images::Round(
std::move(cache),
request.radius,
request.corners);
Images::CornersMask((cache.width() * request.radius) / style::DevicePixelRatio()));
}
if (colorizing) {
cache = Images::Colored(std::move(cache), request.colored);
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/media/clip/media_clip_reader.h
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ struct FrameRequest {
QSize frame;
QSize outer;
int factor = 0;
ImageRoundRadius radius = ImageRoundRadius::None;
float64 radius = 0.0;
RectParts corners = RectPart::AllCorners;
QColor colored = QColor(0, 0, 0, 0);
bool keepAlpha = false;
Original file line number Diff line number Diff line change
@@ -94,7 +94,7 @@ crl::time LastSettingsQueryMs/* = 0*/;
<toast launch="action=open&amp;)" + wid + LR"(">
<visual>
<binding template="ToastGeneric">
<image placement="appLogoOverride" hint-crop="circle" src=""/>
<image placement="appLogoOverride" src=""/>
<text hint-maxLines="1"></text>
<text></text>
<text></text>
3 changes: 2 additions & 1 deletion Telegram/SourceFiles/settings/settings_information.cpp
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ For license and copyright information please follow this link:
*/
#include "settings/settings_information.h"

#include "kotato/kotato_radius.h"
#include "kotato/kotato_lang.h"
#include "ui/wrap/vertical_layout.h"
#include "ui/wrap/vertical_layout_reorder.h"
@@ -639,7 +640,7 @@ void SetupAccountsWrap(
pen.setWidthF(line);
p.setPen(pen);
p.setBrush(Qt::NoBrush);
p.drawEllipse(rect);
Kotato::DrawUserpicShape(p, rect, size);
}
}, state->userpic.lifetime());

4 changes: 3 additions & 1 deletion Telegram/SourceFiles/ui/chat/choose_send_as.cpp
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ For license and copyright information please follow this link:
*/
#include "ui/chat/choose_send_as.h"

#include "kotato/kotato_radius.h"
#include "boxes/peer_list_box.h"
#include "data/data_peer.h"
#include "data/data_channel.h"
@@ -283,7 +284,8 @@ void SetupSendAsButton(
) | rpl::map([=](not_null<PeerData*> chosen) {
return Data::PeerUserpicImageValue(
chosen,
st::sendAsButton.size * style::DevicePixelRatio());
st::sendAsButton.size * style::DevicePixelRatio(),
st::sendAsButton.size * Kotato::UserpicRadius());
}) | rpl::flatten_latest();
}) | rpl::flatten_latest();

3 changes: 2 additions & 1 deletion Telegram/SourceFiles/ui/chat/group_call_userpics.cpp
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ For license and copyright information please follow this link:
*/
#include "ui/chat/group_call_userpics.h"

#include "kotato/kotato_radius.h"
#include "ui/paint/blobs.h"
#include "ui/painter.h"
#include "ui/power_saving.h"
@@ -273,7 +274,7 @@ void GroupCallUserpics::validateCache(Userpic &userpic) {
p.setCompositionMode(QPainter::CompositionMode_Source);
p.setBrush(Qt::transparent);
p.setPen(pen);
p.drawEllipse(skip - size + shift, skip, size, size);
Kotato::DrawUserpicShape(p, skip - size + shift, skip, size, size, size);
}
}
}
7 changes: 6 additions & 1 deletion Telegram/SourceFiles/ui/chat/message_bubble.cpp
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ For license and copyright information please follow this link:
*/
#include "ui/chat/message_bubble.h"

#include "kotato/kotato_radius.h"
#include "ui/cached_round_corners.h"
#include "ui/image/image_prepare.h"
#include "ui/chat/chat_style.h"
@@ -240,7 +241,11 @@ void PaintSolidBubble(QPainter &p, const SimpleBubble &args) {
: st.msgBgCornersSmall;
p.drawPixmap(x, y, corners.p[index]);
}, [&](const QPoint &bottomPosition) {
tail.paint(p, bottomPosition - tailShift, args.outerWidth);
p.drawPixmap(
bottomPosition - tailShift,
(args.rounding.bottomRight == Corner::Tail)
? Kotato::MessageTailRight(bg)
: Kotato::MessageTailLeft(bg));
return tail.width();
});
}
14 changes: 8 additions & 6 deletions Telegram/SourceFiles/ui/controls/userpic_button.cpp
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ For license and copyright information please follow this link:
*/
#include "ui/controls/userpic_button.h"

#include "kotato/kotato_radius.h"
#include "base/call_delayed.h"
#include "ui/effects/ripple_animation.h"
#include "ui/empty_userpic.h"
@@ -135,7 +136,7 @@ void SetupSubButtonBackground(
auto hq = PainterHighQualityEnabler(p);
p.setBrush(st::boxBg);
p.setPen(Qt::NoPen);
p.drawEllipse(background->rect());
Kotato::DrawUserpicShape(p, background->rect(), background->rect().width());
}, background->lifetime());

upload->positionValue(
@@ -579,9 +580,9 @@ void UserpicButton::paintUserpicFrame(Painter &p, QPoint photoPosition) {
auto size = QSize{ _st.photoSize, _st.photoSize };
const auto ratio = style::DevicePixelRatio();
request.outer = request.resize = size * ratio;
if (useForumShape()) {
const auto radius = int(_st.photoSize
* Ui::ForumUserpicRadiusMultiplier());
const auto radiusOption = Kotato::UserpicRadius(useForumShape());
if (radiusOption < 0.5) {
const auto radius = int(_st.photoSize * radiusOption);
if (_roundingCorners[0].width() != radius * ratio) {
_roundingCorners = Images::CornersMask(radius);
}
@@ -988,8 +989,9 @@ void UserpicButton::fillShape(QPainter &p, const style::color &color) const {
p.setPen(Qt::NoPen);
p.setBrush(color);
const auto size = _st.photoSize;
if (useForumShape()) {
const auto radius = size * Ui::ForumUserpicRadiusMultiplier();
const auto radiusOption = Kotato::UserpicRadius(useForumShape());
if (radiusOption < 0.5) {
const auto radius = size * radiusOption;
p.drawRoundedRect(0, 0, size, size, radius, radius);
} else {
p.drawEllipse(0, 0, size, size);
5 changes: 3 additions & 2 deletions Telegram/SourceFiles/ui/empty_userpic.cpp
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ For license and copyright information please follow this link:
#include "ui/empty_userpic.h"

#include "ui/chat/chat_style.h"
#include "kotato/kotato_radius.h"
#include "ui/effects/animation_value.h"
#include "ui/emoji_config.h"
#include "ui/painter.h"
@@ -378,7 +379,7 @@ void EmptyUserpic::PaintSavedMessages(
PainterHighQualityEnabler hq(p);
p.setBrush(std::move(bg));
p.setPen(Qt::NoPen);
p.drawEllipse(x, y, size, size);
Kotato::DrawUserpicShape(p, x, y, size, size, size);

PaintSavedMessagesInner(p, x, y, size, fg);
}
@@ -417,7 +418,7 @@ void EmptyUserpic::PaintRepliesMessages(
PainterHighQualityEnabler hq(p);
p.setBrush(bg);
p.setPen(Qt::NoPen);
p.drawEllipse(x, y, size, size);
Kotato::DrawUserpicShape(p, x, y, size, size, size);

PaintRepliesMessagesInner(p, x, y, size, fg);
}
24 changes: 17 additions & 7 deletions Telegram/SourceFiles/ui/userpic_view.cpp
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ For license and copyright information please follow this link:
*/
#include "ui/userpic_view.h"

#include "kotato/kotato_radius.h"
#include "ui/empty_userpic.h"
#include "ui/image/image_prepare.h"

@@ -28,10 +29,12 @@ void ValidateUserpicCache(
bool forum) {
Expects(cloud != nullptr || empty != nullptr);

const auto radius = Kotato::UserpicRadius(forum);
const auto full = QSize(size, size);
const auto version = style::PaletteVersion();
const auto forumValue = forum ? 1 : 0;
const auto regenerate = (view.cached.size() != QSize(size, size))
|| (view.radius != radius)
|| (view.forum != forumValue)
|| (cloud && !view.empty.null())
|| (empty && empty != view.empty.get())
@@ -48,14 +51,14 @@ void ValidateUserpicCache(
full,
Qt::IgnoreAspectRatio,
Qt::SmoothTransformation);
if (forum) {
if (radius >= 0.5) {
view.cached = Images::Circle(std::move(view.cached));
} else if (radius) {
view.cached = Images::Round(
std::move(view.cached),
Images::CornersMask(size
* Ui::ForumUserpicRadiusMultiplier()
* radius
/ style::DevicePixelRatio()));
} else {
view.cached = Images::Circle(std::move(view.cached));
}
} else {
if (view.cached.size() != full) {
@@ -64,16 +67,23 @@ void ValidateUserpicCache(
view.cached.fill(Qt::transparent);

auto p = QPainter(&view.cached);
if (forum) {
if (radius >= 0.5) {
empty->paintCircle(p, 0, 0, size, size);
} else if (radius) {
empty->paintRounded(
p,
0,
0,
size,
size,
size * Ui::ForumUserpicRadiusMultiplier());
size * radius);
} else {
empty->paintCircle(p, 0, 0, size, size);
empty->paintSquare(
p,
0,
0,
size,
size);
}
}
}
1 change: 1 addition & 0 deletions Telegram/SourceFiles/ui/userpic_view.h
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@ struct PeerUserpicView {
base::weak_ptr<const EmptyUserpic> empty;
uint32 paletteVersion : 31 = 0;
uint32 forum : 1 = 0;
float64 radius = -1.0;
};

[[nodiscard]] bool PeerUserpicLoading(const PeerUserpicView &view);

0 comments on commit a6614e2

Please sign in to comment.