mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Optimize many animated emoji repaint requests.
This commit is contained in:
parent
6db3a0ec98
commit
c796dd142b
4 changed files with 11 additions and 2 deletions
|
@ -375,6 +375,13 @@ void HistoryItem::invalidateChatListEntry() {
|
|||
history()->lastItemDialogsView.itemInvalidated(this);
|
||||
}
|
||||
|
||||
void HistoryItem::customEmojiRepaint() {
|
||||
if (!_textRepaintScheduled) {
|
||||
_textRepaintScheduled = true;
|
||||
history()->owner().requestItemRepaint(this);
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryItem::finishEditionToEmpty() {
|
||||
finishEdition(-1);
|
||||
_history->itemVanished(this);
|
||||
|
|
|
@ -463,6 +463,7 @@ protected:
|
|||
MessageFlags _flags = 0;
|
||||
|
||||
void invalidateChatListEntry();
|
||||
void customEmojiRepaint();
|
||||
|
||||
void setGroupId(MessageGroupId groupId);
|
||||
|
||||
|
@ -473,6 +474,7 @@ protected:
|
|||
Ui::Text::String _text = { st::msgMinWidth };
|
||||
int _textWidth = -1;
|
||||
int _textHeight = 0;
|
||||
bool _textRepaintScheduled = false;
|
||||
|
||||
struct SavedMediaData {
|
||||
TextWithEntities text;
|
||||
|
|
|
@ -1498,8 +1498,7 @@ void HistoryMessage::setText(const TextWithEntities &textWithEntities) {
|
|||
clearIsolatedEmoji();
|
||||
const auto context = Core::MarkedTextContext{
|
||||
.session = &history()->session(),
|
||||
.customEmojiRepaint = [=] {
|
||||
history()->owner().requestItemRepaint(this); },
|
||||
.customEmojiRepaint = [=] { customEmojiRepaint(); },
|
||||
};
|
||||
_text.setMarkedText(
|
||||
st::messageTextStyle,
|
||||
|
|
|
@ -1258,6 +1258,7 @@ void Message::paintText(
|
|||
0,
|
||||
-1,
|
||||
context.selection);
|
||||
item->_textRepaintScheduled = false;
|
||||
if (!_heavyCustomEmoji && custom) {
|
||||
_heavyCustomEmoji = true;
|
||||
history()->owner().registerHeavyViewPart(const_cast<Message*>(this));
|
||||
|
|
Loading…
Add table
Reference in a new issue