From c9f7da6e821e04b525fe8421f33bf6462579a7aa Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Tue, 3 Sep 2024 14:54:23 +0300 Subject: [PATCH] Added ability to paint icons in center of QRectF. --- Telegram/SourceFiles/boxes/edit_privacy_box.cpp | 2 +- Telegram/SourceFiles/boxes/filters/edit_filter_links.cpp | 5 +++-- Telegram/SourceFiles/boxes/peers/edit_peer_invite_links.cpp | 2 +- Telegram/SourceFiles/history/view/history_view_message.cpp | 6 +++--- .../info/statistics/info_statistics_list_controllers.cpp | 2 +- .../SourceFiles/settings/business/settings_chat_links.cpp | 3 ++- Telegram/lib_ui | 2 +- 7 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Telegram/SourceFiles/boxes/edit_privacy_box.cpp b/Telegram/SourceFiles/boxes/edit_privacy_box.cpp index c8536d944e..6352c5b51d 100644 --- a/Telegram/SourceFiles/boxes/edit_privacy_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_privacy_box.cpp @@ -195,7 +195,7 @@ PaintRoundImageCallback PremiumsRow::generatePaintUserpicCallback( const auto radius = size * Ui::ForumUserpicRadiusMultiplier(); p.drawRoundedRect(x, y, size, size, radius, radius); } - st::settingsPrivacyPremium.paintInCenter(p, { x, y, size, size }); + st::settingsPrivacyPremium.paintInCenter(p, QRect(x, y, size, size)); }; } diff --git a/Telegram/SourceFiles/boxes/filters/edit_filter_links.cpp b/Telegram/SourceFiles/boxes/filters/edit_filter_links.cpp index 13f5b146d4..7dc09ae3a0 100644 --- a/Telegram/SourceFiles/boxes/filters/edit_filter_links.cpp +++ b/Telegram/SourceFiles/boxes/filters/edit_filter_links.cpp @@ -31,6 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/wrap/vertical_layout.h" #include "ui/wrap/slide_wrap.h" #include "ui/painter.h" +#include "ui/rect.h" #include "ui/vertical_list.h" #include "window/window_session_controller.h" #include "styles/style_info.h" @@ -965,9 +966,9 @@ void LinksController::rowPaintIcon( p.setBrush(*bg); { auto hq = PainterHighQualityEnabler(p); - p.drawEllipse(QRect(0, 0, inner, inner)); + p.drawEllipse(Rect(Size(inner))); } - st::inviteLinkIcon.paintInCenter(p, { 0, 0, inner, inner }); + st::inviteLinkIcon.paintInCenter(p, Rect(Size(inner))); } p.drawImage(x + skip, y + skip, icon); } diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_invite_links.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_invite_links.cpp index 7cdc292246..86d8e35956 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_invite_links.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_invite_links.cpp @@ -734,7 +734,7 @@ void LinksController::rowPaintIcon( } else { (color == Color::Revoked ? st::inviteLinkRevokedIcon - : st::inviteLinkIcon).paintInCenter(p, { 0, 0, inner, inner }); + : st::inviteLinkIcon).paintInCenter(p, Rect(Size(inner))); } } p.drawImage(x + skip, y + skip, icon); diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index 074cc41eb3..146f868945 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -3831,10 +3831,10 @@ void Message::drawRightAction( } else if (_rightAction->second) { st->historyFastCloseIcon().paintInCenter( p, - { left, top, size->width(), size->width() }); + QRect(left, top, size->width(), size->width())); st->historyFastMoreIcon().paintInCenter( p, - { left, size->width() + top, size->width(), size->width() }); + QRect(left, size->width() + top, size->width(), size->width())); } else { const auto &icon = data()->isSponsored() ? st->historyFastCloseIcon() @@ -3843,7 +3843,7 @@ void Message::drawRightAction( && this->context() != Context::SavedSublist) ? st->historyFastShareIcon() : st->historyGoToOriginalIcon(); - icon.paintInCenter(p, { left, top, size->width(), size->height() }); + icon.paintInCenter(p, Rect(left, top, *size)); } } diff --git a/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp b/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp index e9171dd186..050ff4a971 100644 --- a/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp +++ b/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp @@ -536,7 +536,7 @@ PaintRoundImageCallback BoostRow::generatePaintUserpicCallback(bool force) { ? st::boostsListUnclaimedIcon : st::boostsListUnknownIcon).paintInCenter( p, - { x, y, size, size }); + Rect(x, y, Size(size))); }; } diff --git a/Telegram/SourceFiles/settings/business/settings_chat_links.cpp b/Telegram/SourceFiles/settings/business/settings_chat_links.cpp index 796701b225..e984b9b233 100644 --- a/Telegram/SourceFiles/settings/business/settings_chat_links.cpp +++ b/Telegram/SourceFiles/settings/business/settings_chat_links.cpp @@ -37,6 +37,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/wrap/slide_wrap.h" #include "ui/wrap/vertical_layout.h" #include "ui/painter.h" +#include "ui/rect.h" #include "ui/vertical_list.h" #include "window/window_session_controller.h" #include "styles/style_chat.h" @@ -688,7 +689,7 @@ void LinksController::rowPaintIcon( auto rect = QRect(0, 0, inner, inner); p.drawEllipse(rect); } - st::inviteLinkIcon.paintInCenter(p, { 0, 0, inner, inner }); + st::inviteLinkIcon.paintInCenter(p, Rect(Size(inner))); } p.drawImage(x + skip, y + skip, _icon); } diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 1508241e09..9d2c1836eb 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 1508241e092dc240ee984f2b15da972c2c5fcae1 +Subproject commit 9d2c1836ebdf48f37d1f461b19e2d4cbb60b1c2f