mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-04 16:45:12 +00:00
Optimize many animated emoji repaint requests.
This commit is contained in:
@@ -375,6 +375,13 @@ void HistoryItem::invalidateChatListEntry() {
|
|||||||
history()->lastItemDialogsView.itemInvalidated(this);
|
history()->lastItemDialogsView.itemInvalidated(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HistoryItem::customEmojiRepaint() {
|
||||||
|
if (!_textRepaintScheduled) {
|
||||||
|
_textRepaintScheduled = true;
|
||||||
|
history()->owner().requestItemRepaint(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void HistoryItem::finishEditionToEmpty() {
|
void HistoryItem::finishEditionToEmpty() {
|
||||||
finishEdition(-1);
|
finishEdition(-1);
|
||||||
_history->itemVanished(this);
|
_history->itemVanished(this);
|
||||||
|
@@ -463,6 +463,7 @@ protected:
|
|||||||
MessageFlags _flags = 0;
|
MessageFlags _flags = 0;
|
||||||
|
|
||||||
void invalidateChatListEntry();
|
void invalidateChatListEntry();
|
||||||
|
void customEmojiRepaint();
|
||||||
|
|
||||||
void setGroupId(MessageGroupId groupId);
|
void setGroupId(MessageGroupId groupId);
|
||||||
|
|
||||||
@@ -473,6 +474,7 @@ protected:
|
|||||||
Ui::Text::String _text = { st::msgMinWidth };
|
Ui::Text::String _text = { st::msgMinWidth };
|
||||||
int _textWidth = -1;
|
int _textWidth = -1;
|
||||||
int _textHeight = 0;
|
int _textHeight = 0;
|
||||||
|
bool _textRepaintScheduled = false;
|
||||||
|
|
||||||
struct SavedMediaData {
|
struct SavedMediaData {
|
||||||
TextWithEntities text;
|
TextWithEntities text;
|
||||||
|
@@ -1498,8 +1498,7 @@ void HistoryMessage::setText(const TextWithEntities &textWithEntities) {
|
|||||||
clearIsolatedEmoji();
|
clearIsolatedEmoji();
|
||||||
const auto context = Core::MarkedTextContext{
|
const auto context = Core::MarkedTextContext{
|
||||||
.session = &history()->session(),
|
.session = &history()->session(),
|
||||||
.customEmojiRepaint = [=] {
|
.customEmojiRepaint = [=] { customEmojiRepaint(); },
|
||||||
history()->owner().requestItemRepaint(this); },
|
|
||||||
};
|
};
|
||||||
_text.setMarkedText(
|
_text.setMarkedText(
|
||||||
st::messageTextStyle,
|
st::messageTextStyle,
|
||||||
|
@@ -1258,6 +1258,7 @@ void Message::paintText(
|
|||||||
0,
|
0,
|
||||||
-1,
|
-1,
|
||||||
context.selection);
|
context.selection);
|
||||||
|
item->_textRepaintScheduled = false;
|
||||||
if (!_heavyCustomEmoji && custom) {
|
if (!_heavyCustomEmoji && custom) {
|
||||||
_heavyCustomEmoji = true;
|
_heavyCustomEmoji = true;
|
||||||
history()->owner().registerHeavyViewPart(const_cast<Message*>(this));
|
history()->owner().registerHeavyViewPart(const_cast<Message*>(this));
|
||||||
|
Reference in New Issue
Block a user