From df935e0477d0cab353dd079f68782559d441ac53 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 2 Sep 2024 01:22:26 +0300 Subject: [PATCH] Improved code style of gifMaxStatusWidth static function. --- .../history/view/media/history_view_gif.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp index 2d62e464d..c6b5addb4 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp @@ -64,9 +64,12 @@ constexpr auto kMaxGifForwardedBarLines = 4; constexpr auto kUseNonBlurredThreshold = 240; constexpr auto kMaxInlineArea = 1920 * 1080; -int gifMaxStatusWidth(DocumentData *document) { - auto result = st::normalFont->width(Ui::FormatDownloadText(document->size, document->size)); - accumulate_max(result, st::normalFont->width(Ui::FormatGifAndSizeText(document->size))); +[[nodiscard]] int GifMaxStatusWidth(not_null document) { + auto result = st::normalFont->width( + Ui::FormatDownloadText(document->size, document->size)); + accumulate_max( + result, + st::normalFont->width(Ui::FormatGifAndSizeText(document->size))); return result; } @@ -264,7 +267,10 @@ QSize Gif::countOptimalSize() { thumbMaxWidth); auto minHeight = qMax(scaled.height(), st::minPhotoSize); if (!activeCurrentStreamed()) { - accumulate_max(maxWidth, gifMaxStatusWidth(_data) + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x())); + accumulate_max( + maxWidth, + GifMaxStatusWidth(_data) + + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x())); } if (_parent->hasBubble()) { maxWidth = qMax(maxWidth, _parent->textualMaxWidth()); @@ -298,7 +304,10 @@ QSize Gif::countCurrentSize(int newWidth) { thumbMaxWidth); auto newHeight = qMax(scaled.height(), st::minPhotoSize); if (!activeCurrentStreamed()) { - accumulate_max(newWidth, gifMaxStatusWidth(_data) + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x())); + accumulate_max( + newWidth, + GifMaxStatusWidth(_data) + + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x())); } if (_parent->hasBubble()) { accumulate_max(newWidth, _parent->minWidthForMedia());