From dbb234097c08b4e142eca3cfcd0332f5443e4161 Mon Sep 17 00:00:00 2001 From: AlexeyZavar Date: Mon, 1 Jul 2024 21:33:02 +0300 Subject: [PATCH] feat: round stickers in list --- Telegram/SourceFiles/ayu/ui/ayu_styles.style | 2 ++ .../chat_helpers/stickers_list_widget.cpp | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/Telegram/SourceFiles/ayu/ui/ayu_styles.style b/Telegram/SourceFiles/ayu/ui/ayu_styles.style index 2b03c40b8..9cdeedf12 100644 --- a/Telegram/SourceFiles/ayu/ui/ayu_styles.style +++ b/Telegram/SourceFiles/ayu/ui/ayu_styles.style @@ -27,6 +27,8 @@ recentStickersLimitPadding: margins(22px, 4px, 22px, 8px); imageViewPadding: margins(22px, 10px, 22px, 10px); imageViewInnerPadding: margins(16px, 16px, 16px, 16px); +stickerRoundingSize: 5px; + messageShotPadding: 4px; topBarAdmins: IconButton { diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp index 6768054a4..1aca8af02 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp @@ -57,6 +57,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL // AyuGram includes #include "ayu/ayu_settings.h" +#include "styles/style_ayu_styles.h" #include "boxes/abstract_box.h" #include "base/unixtime.h" @@ -1434,6 +1435,16 @@ void StickersListWidget::paintSticker( (_singleSize.height() - size.height()) / 2); auto lottieFrame = QImage(); + + QPainterPath path; + path.addRoundedRect(QRectF(ppos, size), st::stickerRoundingSize, st::stickerRoundingSize); + + p.save(); + + p.setRenderHint(QPainter::Antialiasing, true); + p.setClipPath(path); + p.setRenderHint(QPainter::Antialiasing, false); + if (sticker.lottie && sticker.lottie->ready()) { auto request = Lottie::FrameRequest(); request.box = boundingBoxSize() * style::DevicePixelRatio(); @@ -1488,6 +1499,8 @@ void StickersListWidget::paintSticker( } } + p.restore(); + if (selected && stickerHasDeleteButton(set, index)) { auto xPos = pos + QPoint(_singleSize.width() - st::stickerPanDeleteIconBg.width(), 0); p.setOpacity(deleteSelected ? st::stickerPanDeleteOpacityBgOver : st::stickerPanDeleteOpacityBg);