mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Optimize custom emoji repaints in pinned bar / reply info.
This commit is contained in:
parent
68ee753fc7
commit
754371a295
8 changed files with 24 additions and 6 deletions
|
@ -6410,7 +6410,7 @@ void HistoryWidget::checkPinnedBarState() {
|
|||
_pinnedBar->setContent(HistoryView::PinnedBarContent(
|
||||
&session(),
|
||||
_pinnedTracker->shownMessageId(),
|
||||
[bar = _pinnedBar.get()] { bar->update(); }));
|
||||
[bar = _pinnedBar.get()] { bar->customEmojiRepaint(); }));
|
||||
|
||||
controller()->adaptive().oneColumnValue(
|
||||
) | rpl::start_with_next([=](bool one) {
|
||||
|
@ -7604,11 +7604,17 @@ void HistoryWidget::updateReplyToName() {
|
|||
}
|
||||
|
||||
void HistoryWidget::updateField() {
|
||||
if (_repaintFieldScheduled) {
|
||||
return;
|
||||
}
|
||||
_repaintFieldScheduled = true;
|
||||
const auto fieldAreaTop = _scroll->y() + _scroll->height();
|
||||
rtlupdate(0, fieldAreaTop, width(), height() - fieldAreaTop);
|
||||
}
|
||||
|
||||
void HistoryWidget::drawField(Painter &p, const QRect &rect) {
|
||||
_repaintFieldScheduled = false;
|
||||
|
||||
auto backy = _field->y() - st::historySendPadding;
|
||||
auto backh = _field->height() + 2 * st::historySendPadding;
|
||||
auto hasForward = readyToForward();
|
||||
|
|
|
@ -650,6 +650,7 @@ private:
|
|||
int _requestsBarHeight = 0;
|
||||
|
||||
bool _preserveScrollTop = false;
|
||||
bool _repaintFieldScheduled = false;
|
||||
|
||||
mtpRequestId _saveEditMsgRequestId = 0;
|
||||
|
||||
|
|
|
@ -397,7 +397,7 @@ void RepliesWidget::setupRootView() {
|
|||
RootViewContent(
|
||||
_history,
|
||||
_rootId,
|
||||
[bar = _rootView.get()] { bar->update(); }),
|
||||
[bar = _rootView.get()] { bar->customEmojiRepaint(); }),
|
||||
_rootVisible.value()
|
||||
) | rpl::map([=](Ui::MessageBarContent &&content, bool shown) {
|
||||
return shown ? std::move(content) : Ui::MessageBarContent();
|
||||
|
|
|
@ -56,12 +56,21 @@ MessageBar::MessageBar(
|
|||
}, _widget.lifetime());
|
||||
}
|
||||
|
||||
void MessageBar::customEmojiRepaint() {
|
||||
if (_customEmojiRepaintScheduled) {
|
||||
return;
|
||||
}
|
||||
_customEmojiRepaintScheduled = true;
|
||||
_widget.update();
|
||||
}
|
||||
|
||||
void MessageBar::setup() {
|
||||
_widget.resize(0, st::historyReplyHeight);
|
||||
_widget.paintRequest(
|
||||
) | rpl::start_with_next([=](QRect rect) {
|
||||
auto p = Painter(&_widget);
|
||||
p.setInactive(_customEmojiPaused());
|
||||
_customEmojiRepaintScheduled = false;
|
||||
paint(p);
|
||||
}, _widget.lifetime());
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ public:
|
|||
return &_widget;
|
||||
}
|
||||
|
||||
void customEmojiRepaint();
|
||||
void finishAnimating();
|
||||
|
||||
private:
|
||||
|
@ -110,6 +111,7 @@ private:
|
|||
Ui::Text::String _title, _text;
|
||||
QPixmap _image, _topBarGradient, _bottomBarGradient;
|
||||
std::unique_ptr<Animation> _animation;
|
||||
bool _customEmojiRepaintScheduled = false;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -207,9 +207,9 @@ void PinnedBar::raise() {
|
|||
_shadow->raise();
|
||||
}
|
||||
|
||||
void PinnedBar::update() {
|
||||
void PinnedBar::customEmojiRepaint() {
|
||||
if (_bar) {
|
||||
_bar->widget()->update();
|
||||
_bar->customEmojiRepaint();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
void show();
|
||||
void hide();
|
||||
void raise();
|
||||
void update();
|
||||
void customEmojiRepaint();
|
||||
void finishAnimating();
|
||||
|
||||
void setShadowGeometryPostprocess(Fn<QRect(QRect)> postprocess);
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 9cb7bb58f658d7603f9493b9d051cf8a78a2cd41
|
||||
Subproject commit ec76a4c0bb9131ab14fe676630a1f465bfc05ee2
|
Loading…
Add table
Reference in a new issue