Respect userpic rounding for service messages

This commit is contained in:
blank X 2022-03-20 13:46:01 +07:00
parent e5dcf48d43
commit 1513b7b2dd
No known key found for this signature in database
GPG key ID: CC15FC822C7F61F5

View file

@ -405,7 +405,7 @@ void Photo::paintUserpicFrame(
auto request = ::Media::Streaming::FrameRequest(); auto request = ::Media::Streaming::FrameRequest();
request.outer = size * cIntRetinaFactor(); request.outer = size * cIntRetinaFactor();
request.resize = size * cIntRetinaFactor(); request.resize = size * cIntRetinaFactor();
request.radius = ImageRoundRadius::Ellipse; request.radius = KotatoImageRoundRadius();
if (_streamed->instance.playerLocked()) { if (_streamed->instance.playerLocked()) {
if (_streamed->frozenFrame.isNull()) { if (_streamed->frozenFrame.isNull()) {
_streamed->frozenFrame = _streamed->instance.frame(request); _streamed->frozenFrame = _streamed->instance.frame(request);
@ -423,7 +423,7 @@ void Photo::paintUserpicFrame(
const auto pix = [&] { const auto pix = [&] {
const auto size = QSize(_pixw, _pixh); const auto size = QSize(_pixw, _pixh);
const auto args = Images::PrepareArgs{ const auto args = Images::PrepareArgs{
.options = Images::Option::RoundCircle, .options = KotatoImageRoundOption(),
}; };
if (const auto large = _dataMedia->image(PhotoSize::Large)) { if (const auto large = _dataMedia->image(PhotoSize::Large)) {
return large->pix(size, args); return large->pix(size, args);
@ -453,7 +453,19 @@ void Photo::paintUserpicFrame(
} }
{ {
PainterHighQualityEnabler hq(p); PainterHighQualityEnabler hq(p);
p.drawEllipse(inner); switch (KotatoImageRoundRadius()) {
case ImageRoundRadius::None:
p.drawRoundedRect(inner, 0, 0);
break;
case ImageRoundRadius::Small:
p.drawRoundedRect(inner, st::buttonRadius, st::buttonRadius);
break;
case ImageRoundRadius::Large:
p.drawRoundedRect(inner, st::dateRadius, st::dateRadius);
break;
default:
p.drawEllipse(inner);
}
} }
sti->historyFileThumbPlay.paintInCenter(p, inner); sti->historyFileThumbPlay.paintInCenter(p, inner);
} }