diff --git a/Telegram/SourceFiles/ui/effects/message_sending_animation_controller.cpp b/Telegram/SourceFiles/ui/effects/message_sending_animation_controller.cpp index ae2750d078..6469568d9b 100644 --- a/Telegram/SourceFiles/ui/effects/message_sending_animation_controller.cpp +++ b/Telegram/SourceFiles/ui/effects/message_sending_animation_controller.cpp @@ -22,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/painter.h" #include "ui/rect.h" #include "ui/rp_widget.h" +#include "ui/power_saving.h" #include "ui/text/text_isolated_emoji.h" #include "window/window_session_controller.h" #include "styles/style_chat.h" @@ -365,8 +366,8 @@ void Content::createBubble() { _bubble.widget->stackUnder(this); _bubble.widget->paintRequest( - ) | rpl::start_with_next([=](const QRect &r) { - Painter p(_bubble.widget); + ) | rpl::start_with_next([=, raw = _bubble.widget.get()](const QRect &r) { + auto p = Painter(raw); p.fillRect(r, Qt::transparent); @@ -393,7 +394,15 @@ void Content::createBubble() { context.skipDrawingParts = Context::SkipDrawingParts::Content; context.outbg = currentView->hasOutLayout(); - context.translate(paintOffsetLeft, -context.viewport.y()); + const auto diff = context.viewport.height() - raw->height(); + auto bottom = anim::interpolate(_from.y(), _to.y(), progress); + if (bottom > diff) { + bottom = diff; + } + if (bottom < raw->height()) { + bottom = raw->height(); + } + context.translate(paintOffsetLeft, -context.viewport.y() - bottom); p.translate(-paintOffsetLeft, 0); currentView->draw(p, context); @@ -438,7 +447,8 @@ void MessageSendingAnimationController::appendSending( } void MessageSendingAnimationController::startAnimation(SendingInfoTo &&to) { - if (anim::Disabled()) { + if (anim::Disabled() + || PowerSaving::On(PowerSaving::Flag::kChatEffects)) { return; } const auto container = _controller->content();