Skip to content

Commit

Permalink
slightly improved userpic corners
Browse files Browse the repository at this point in the history
  • Loading branch information
xmdnx committed Jun 21, 2024
1 parent f6032fa commit 9e0bfde
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 28 deletions.
1 change: 0 additions & 1 deletion Telegram/SourceFiles/boxes/peer_list_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,6 @@ void PeerListRow::paintDisabledCheckUserpic(
p.setPen(userpicBorderPen);
p.setBrush(Qt::NoBrush);
p.drawEllipse(userpicEllipse);
// p.drawRoundedRect(userpicEllipse, RabbitSettings::JsonSettings::GetInt("userpic_roundness"), RabbitSettings::JsonSettings::GetInt("userpic_roundness"));

p.setPen(iconBorderPen);
p.setBrush(st.disabledCheckFg);
Expand Down
1 change: 0 additions & 1 deletion Telegram/SourceFiles/calls/calls_userpic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ void Userpic::paint() {
_muteSize,
_muteSize);
p.drawEllipse(rect);
// p.drawRoundedRect(rect, RabbitSettings::JsonSettings::GetInt("userpic_roundness"), RabbitSettings::JsonSettings::GetInt("userpic_roundness"));
st::callMutedPeerIcon.paintInCenter(p, rect);
}
}
Expand Down
4 changes: 2 additions & 2 deletions Telegram/SourceFiles/data/data_folder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ void Folder::paintUserpic(
p.setBrush(overrideBg ? *overrideBg : st::historyPeerArchiveUserpicBg);
{
PainterHighQualityEnabler hq(p);
// p.drawEllipse(x, y, size, size);
p.drawRoundedRect(x, y, size, size, size * (RabbitSettings::JsonSettings::GetInt("userpic_roundness")) / 100, size * (RabbitSettings::JsonSettings::GetInt("userpic_roundness")) / 100);
auto radius = RabbitSettings::JsonSettings::GetInt("userpic_roundness") / 100. * size;
p.drawRoundedRect(x, y, size, size, radius, radius);
}
if (size == st::defaultDialogRow.photoSize) {
const auto rect = QRect{ x, y, size, size };
Expand Down
5 changes: 2 additions & 3 deletions Telegram/SourceFiles/data/data_peer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,12 +353,11 @@ void PeerData::paintUserpic(
QImage image = view.cached;
roundedRect.addRoundedRect(
QRect(x, y, size, size),
size * RabbitSettings::JsonSettings::GetInt("userpic_roundness") / 100,
size * RabbitSettings::JsonSettings::GetInt("userpic_roundness") / 100);
size * RabbitSettings::JsonSettings::GetInt("userpic_roundness") / 100.,
size * RabbitSettings::JsonSettings::GetInt("userpic_roundness") / 100.);
p.setClipPath(roundedRect);
p.drawImage(x, y, image);
p.restore();
/* p.drawImage(QRect(x, y, size, size), view.cached); */
}

void PeerData::loadUserpic() {
Expand Down
5 changes: 2 additions & 3 deletions Telegram/SourceFiles/dialogs/ui/dialogs_video_userpic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,12 @@ void VideoUserpic::paintLeft(
QImage image = _video->current(request(size), now);
roundedRect.addRoundedRect(
QRect(x, y, image.height(), image.width()),
image.height() * RabbitSettings::JsonSettings::GetInt("userpic_roundness") / 100,
image.width() * RabbitSettings::JsonSettings::GetInt("userpic_roundness") / 100);
image.width() * RabbitSettings::JsonSettings::GetInt("userpic_roundness") / 100,
image.height() * RabbitSettings::JsonSettings::GetInt("userpic_roundness") / 100);
p.setClipPath(roundedRect);
p.drawImage(x, y, image);

p.restore();
/* p.drawImage(x, y, _video->current(request(size), now)); */
} else {
_peer->paintUserpicLeft(p, view, x, y, w, size);
}
Expand Down
4 changes: 2 additions & 2 deletions Telegram/SourceFiles/history/view/media/history_view_poll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -919,8 +919,8 @@ void Poll::paintRecentVoters(
p.setPen(pen);
p.setBrush(Qt::NoBrush);
PainterHighQualityEnabler hq(p);
p.drawEllipse(x, y, size, size);
// p.drawRoundedRect(x, y, size, size, RabbitSettings::JsonSettings::GetInt("userpic_roundness"), RabbitSettings::JsonSettings::GetInt("userpic_roundness"));
auto radius = RabbitSettings::JsonSettings::GetInt("userpic_roundness") / 100. * size;
p.drawRoundedRect(x, y, size, size, radius, radius);
};
if (usesBubblePattern(context)) {
const auto add = st::lineWidth * 2;
Expand Down
14 changes: 6 additions & 8 deletions Telegram/SourceFiles/ui/effects/outline_segments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ void PaintOutlineSegments(

p.setBrush(Qt::NoBrush);
const auto count = std::min(int(segments.size()), kOutlineSegmentsMax);
// if (count == 1 /* || (RabbitSettings::JsonSettings::GetInt("userpic_roundness") != 100) */) {
p.setPen(QPen(segments.front().brush, segments.front().width));
// p.drawEllipse(ellipse);
p.drawRoundedRect(
ellipse,
ellipse.height() * RabbitSettings::JsonSettings::GetInt("userpic_roundness") * 0.0102,
ellipse.width() * RabbitSettings::JsonSettings::GetInt("userpic_roundness") * 0.0102);
return;
p.setPen(QPen(segments.front().brush, segments.front().width));
p.drawRoundedRect(
ellipse,
ellipse.height() * RabbitSettings::JsonSettings::GetInt("userpic_roundness") * 0.0102,
ellipse.width() * RabbitSettings::JsonSettings::GetInt("userpic_roundness") * 0.0102);
return;
// }
/* const auto small = 160;
const auto full = arc::kFullLength;
Expand Down
1 change: 0 additions & 1 deletion Telegram/SourceFiles/ui/effects/round_checkbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ void RoundImageCheckbox::paint(Painter &p, int x, int y, int outerWidth) const {
segments ? _segments.front().width : _st.selectWidth);
p.setPen(pen);
if (!radius) {
// p.drawEllipse(outline);
p.drawRoundedRect(
outline,
outline.height() * RabbitSettings::JsonSettings::GetInt("userpic_roundness") / 100,
Expand Down
6 changes: 0 additions & 6 deletions Telegram/SourceFiles/ui/empty_userpic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,6 @@ void EmptyUserpic::paintCircle(
int y,
int outerWidth,
int size) const {
/* paint(p, x, y, outerWidth, size, [&] {
p.drawEllipse(x, y, size, size);
}); */

paint(p, x, y, outerWidth, size, [&] {
double customRadius = (double) size * ((double) RabbitSettings::JsonSettings::GetInt("userpic_roundness") / 100);
p.drawRoundedRect(x, y, size, size,
Expand Down Expand Up @@ -391,7 +387,6 @@ void EmptyUserpic::PaintSavedMessages(
PainterHighQualityEnabler hq(p);
p.setBrush(std::move(bg));
p.setPen(Qt::NoPen);
// p.drawEllipse(x, y, size, size);
double customRadius = (double) size * ((double) RabbitSettings::JsonSettings::GetInt("userpic_roundness") / 100);
p.drawRoundedRect(x, y, size, size,
customRadius, customRadius);
Expand Down Expand Up @@ -433,7 +428,6 @@ void EmptyUserpic::PaintRepliesMessages(
PainterHighQualityEnabler hq(p);
p.setBrush(bg);
p.setPen(Qt::NoPen);
// p.drawEllipse(x, y, size, size);
double customRadius = (double) size * ((double) RabbitSettings::JsonSettings::GetInt("userpic_roundness") / 100);
p.drawRoundedRect(x, y, size, size,
customRadius, customRadius);
Expand Down
2 changes: 1 addition & 1 deletion Telegram/build/setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define MyAppId "4356CE01-4137-4C55-9F8B-FB4EEBB6EC0C"
#define CurrentYear GetDateTimeString('yyyy','','')
#define MyBuildTarget "win64"
#define MyAppVersionFull "5.1.8-18062024"
#define MyAppVersionFull "5.1.8-20062024"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
Expand Down

0 comments on commit 9e0bfde

Please sign in to comment.