From 8638d261561131ef1f7b181a6af96ad2df64d60c Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 29 Dec 2025 20:10:59 +0300 Subject: [PATCH] Slightly optimized repaint of text in messages when it is out of clip. --- Telegram/SourceFiles/history/view/history_view_message.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index 50fe1cbf8a..4c0fcb18e2 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -1860,7 +1860,6 @@ void Message::paintText( const auto stm = context.messageStyle(); p.setPen(stm->historyTextFg); p.setFont(st::msgFont); - prepareCustomEmojiPaint(p, context, text()); if (const auto botTop = Get()) { botTop->text.drawLeftElided( p, @@ -1870,6 +1869,10 @@ void Message::paintText( width()); trect.setY(trect.y() + botTop->height); } + if (!context.clip.intersects(trect)) { + return; + } + prepareCustomEmojiPaint(p, context, text()); auto highlightRequest = context.computeHighlightCache(); text().draw(p, { .position = trect.topLeft(),