feat: round stickers in list

This commit is contained in:
AlexeyZavar 2024-07-01 21:33:02 +03:00
parent c185f40acd
commit dbb234097c
2 changed files with 15 additions and 0 deletions

View file

@ -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 {

View file

@ -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);