Use sizes like iOS for premium sticker effects.

This commit is contained in:
John Preston 2022-06-08 19:00:48 +04:00
parent 17b2d043cb
commit 7ba997259c
4 changed files with 11 additions and 7 deletions

View File

@ -37,7 +37,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace { namespace {
constexpr auto kPremiumShift = 0.082; constexpr auto kPremiumShift = 21. / 240;
constexpr auto kShiftDuration = crl::time(200); constexpr auto kShiftDuration = crl::time(200);
constexpr auto kReactionsPerRow = 5; constexpr auto kReactionsPerRow = 5;
constexpr auto kDisabledOpacity = 0.5; constexpr auto kDisabledOpacity = 0.5;
@ -201,7 +201,9 @@ void PreloadSticker(const std::shared_ptr<Data::DocumentMedia> &media) {
// : 1; // : 1;
p.drawImage(r, frame.image); p.drawImage(r, frame.image);
p.drawImage(result->rect(), effect.image); p.drawImage(
QRect(QPoint(), effect.image.size() / factor),
effect.image);
if (!frame.image.isNull()/* if (!frame.image.isNull()/*
&& ((frame.index % effectsCount) <= effect.index)*/) { && ((frame.index % effectsCount) <= effect.index)*/) {

View File

@ -25,7 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace HistoryView { namespace HistoryView {
namespace { namespace {
constexpr auto kPremiumShift = 0.082; constexpr auto kPremiumShift = 21. / 240;
constexpr auto kMaxPlays = 5; constexpr auto kMaxPlays = 5;
constexpr auto kMaxPlaysWithSmallDelay = 3; constexpr auto kMaxPlaysWithSmallDelay = 3;
constexpr auto kSmallDelay = crl::time(200); constexpr auto kSmallDelay = crl::time(200);

View File

@ -39,7 +39,7 @@ namespace {
constexpr auto kMaxSizeFixed = 512; constexpr auto kMaxSizeFixed = 512;
constexpr auto kMaxEmojiSizeFixed = 256; constexpr auto kMaxEmojiSizeFixed = 256;
constexpr auto kPremiumMultiplier = 1.5; constexpr auto kPremiumMultiplier = (1 + 0.245 * 2);
constexpr auto kEmojiMultiplier = 3; constexpr auto kEmojiMultiplier = 3;
[[nodiscard]] QImage CacheDiceImage( [[nodiscard]] QImage CacheDiceImage(

View File

@ -29,8 +29,8 @@ namespace Window {
namespace { namespace {
constexpr auto kStickerPreviewEmojiLimit = 10; constexpr auto kStickerPreviewEmojiLimit = 10;
constexpr auto kPremiumShift = 0.082; constexpr auto kPremiumShift = 21. / 240;
constexpr auto kPremiumMultiplier = 1.5; constexpr auto kPremiumMultiplier = (1 + 0.245 * 2);
constexpr auto kPremiumDownscale = 1.25; constexpr auto kPremiumDownscale = 1.25;
} // namespace } // namespace
@ -102,7 +102,9 @@ void MediaPreviewWidget::paintEvent(QPaintEvent *e) {
p.drawImage(QRect(position, QSize(w, h)), image); p.drawImage(QRect(position, QSize(w, h)), image);
} }
if (!effectImage.isNull()) { if (!effectImage.isNull()) {
p.drawImage(outerPosition({ w, h }), effectImage); p.drawImage(
QRect(outerPosition({ w, h }), effectImage.size() / factor),
effectImage);
} }
if (!_emojiList.empty()) { if (!_emojiList.empty()) {
const auto emojiCount = _emojiList.size(); const auto emojiCount = _emojiList.size();