From ad6890e7ddc3197f14185f536c9631400e8cca76 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sun, 14 Jan 2024 12:59:04 +0300 Subject: [PATCH] Slightly improved progress radial for video messages with ttl. --- .../history/view/media/history_view_gif.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp index 51150dace..ca29639ec 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp @@ -582,18 +582,19 @@ void Gif::draw(Painter &p, const PaintContext &context) const { const auto value = playback->value(); if (value > 0.) { auto pen = st->historyVideoMessageProgressFg()->p; - auto was = p.pen(); + const auto was = p.pen(); pen.setWidth(st::radialLine); pen.setCapStyle(Qt::RoundCap); p.setPen(pen); p.setOpacity(st::historyVideoMessageProgressOpacity); - auto from = arc::kQuarterLength; - auto len = -qRound(arc::kFullLength * value); - auto stepInside = st::radialLine / 2; + const auto from = arc::kQuarterLength; + const auto len = std::round(arc::kFullLength + * (inTTLViewer ? (1. - value) : -value)); + const auto stepInside = st::radialLine / 2; { - PainterHighQualityEnabler hq(p); - p.drawArc(rthumb.marginsRemoved(QMargins(stepInside, stepInside, stepInside, stepInside)), from, len); + auto hq = PainterHighQualityEnabler(p); + p.drawArc(rthumb - Margins(stepInside), from, len); } p.setPen(was);