Fix editing animated emoji messages.
This commit is contained in:
parent
76596f42c7
commit
822c0434e8
|
@ -172,7 +172,9 @@ PointState Media::pointState(QPoint point) const {
|
|||
: PointState::Outside;
|
||||
}
|
||||
|
||||
std::unique_ptr<Lottie::SinglePlayer> Media::stickerTakeLottie() {
|
||||
std::unique_ptr<Lottie::SinglePlayer> Media::stickerTakeLottie(
|
||||
not_null<DocumentData*> data,
|
||||
const Lottie::ColorReplacements *replacements) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ using SharedMediaTypesMask = base::enum_mask<SharedMediaType>;
|
|||
|
||||
namespace Lottie {
|
||||
class SinglePlayer;
|
||||
struct ColorReplacements;
|
||||
} // namespace Lottie
|
||||
|
||||
namespace HistoryView {
|
||||
|
@ -145,7 +146,9 @@ public:
|
|||
}
|
||||
virtual void stickerClearLoopPlayed() {
|
||||
}
|
||||
virtual std::unique_ptr<Lottie::SinglePlayer> stickerTakeLottie();
|
||||
virtual std::unique_ptr<Lottie::SinglePlayer> stickerTakeLottie(
|
||||
not_null<DocumentData*> data,
|
||||
const Lottie::ColorReplacements *replacements);
|
||||
virtual void checkAnimation() {
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,9 @@ constexpr auto kMaxForwardedBarLines = 4;
|
|||
|
||||
} // namespace
|
||||
|
||||
auto UnwrappedMedia::Content::stickerTakeLottie()
|
||||
auto UnwrappedMedia::Content::stickerTakeLottie(
|
||||
not_null<DocumentData*> data,
|
||||
const Lottie::ColorReplacements *replacements)
|
||||
-> std::unique_ptr<Lottie::SinglePlayer> {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -383,8 +385,10 @@ TextState UnwrappedMedia::textState(QPoint point, StateRequest request) const {
|
|||
return result;
|
||||
}
|
||||
|
||||
std::unique_ptr<Lottie::SinglePlayer> UnwrappedMedia::stickerTakeLottie() {
|
||||
return _content->stickerTakeLottie();
|
||||
std::unique_ptr<Lottie::SinglePlayer> UnwrappedMedia::stickerTakeLottie(
|
||||
not_null<DocumentData*> data,
|
||||
const Lottie::ColorReplacements *replacements) {
|
||||
return _content->stickerTakeLottie(data, replacements);
|
||||
}
|
||||
|
||||
int UnwrappedMedia::calculateFullRight(const QRect &inner) const {
|
||||
|
|
|
@ -34,7 +34,9 @@ public:
|
|||
}
|
||||
virtual void stickerClearLoopPlayed() {
|
||||
}
|
||||
virtual std::unique_ptr<Lottie::SinglePlayer> stickerTakeLottie();
|
||||
virtual std::unique_ptr<Lottie::SinglePlayer> stickerTakeLottie(
|
||||
not_null<DocumentData*> data,
|
||||
const Lottie::ColorReplacements *replacements);
|
||||
virtual bool hasHeavyPart() const {
|
||||
return false;
|
||||
}
|
||||
|
@ -85,7 +87,9 @@ public:
|
|||
void stickerClearLoopPlayed() override {
|
||||
_content->stickerClearLoopPlayed();
|
||||
}
|
||||
std::unique_ptr<Lottie::SinglePlayer> stickerTakeLottie() override;
|
||||
std::unique_ptr<Lottie::SinglePlayer> stickerTakeLottie(
|
||||
not_null<DocumentData*> data,
|
||||
const Lottie::ColorReplacements *replacements) override;
|
||||
|
||||
bool hasHeavyPart() const override {
|
||||
return _content->hasHeavyPart();
|
||||
|
|
|
@ -71,7 +71,7 @@ Sticker::Sticker(
|
|||
_data->loadThumbnail(parent->data()->fullId());
|
||||
}
|
||||
if (const auto media = replacing ? replacing->media() : nullptr) {
|
||||
_lottie = media->stickerTakeLottie();
|
||||
_lottie = media->stickerTakeLottie(_data, _replacements);
|
||||
if (_lottie) {
|
||||
lottieCreated();
|
||||
}
|
||||
|
@ -341,8 +341,12 @@ void Sticker::unloadLottie() {
|
|||
_parent->checkHeavyPart();
|
||||
}
|
||||
|
||||
std::unique_ptr< Lottie::SinglePlayer> Sticker::stickerTakeLottie() {
|
||||
return std::move(_lottie);
|
||||
std::unique_ptr<Lottie::SinglePlayer> Sticker::stickerTakeLottie(
|
||||
not_null<DocumentData*> data,
|
||||
const Lottie::ColorReplacements *replacements) {
|
||||
return (data == _data && replacements == _replacements)
|
||||
? std::move(_lottie)
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
} // namespace HistoryView
|
||||
|
|
|
@ -50,7 +50,9 @@ public:
|
|||
void stickerClearLoopPlayed() override {
|
||||
_lottieOncePlayed = false;
|
||||
}
|
||||
std::unique_ptr<Lottie::SinglePlayer> stickerTakeLottie() override;
|
||||
std::unique_ptr<Lottie::SinglePlayer> stickerTakeLottie(
|
||||
not_null<DocumentData*> data,
|
||||
const Lottie::ColorReplacements *replacements) override;
|
||||
|
||||
bool hasHeavyPart() const override;
|
||||
void unloadHeavyPart() override;
|
||||
|
|
Loading…
Reference in New Issue