From a05c7a815a81cb7e31ad45c16dcc02ee37af88e6 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 6 Nov 2017 12:50:54 +0400 Subject: [PATCH] Fix animation lag in info layer wrap. --- .../history/history_admin_log_section.cpp | 1 + Telegram/SourceFiles/info/info_wrap_widget.cpp | 12 +++++++++--- .../SourceFiles/window/window_slide_animation.cpp | 4 ---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Telegram/SourceFiles/history/history_admin_log_section.cpp b/Telegram/SourceFiles/history/history_admin_log_section.cpp index b322ec284..5bd78e2ab 100644 --- a/Telegram/SourceFiles/history/history_admin_log_section.cpp +++ b/Telegram/SourceFiles/history/history_admin_log_section.cpp @@ -440,6 +440,7 @@ void Widget::onScroll() { void Widget::showAnimatedHook( const Window::SectionSlideParams ¶ms) { _fixedBar->setAnimatingMode(true); + if (params.withTopBarShadow) _fixedBarShadow->show(); } void Widget::showFinishedHook() { diff --git a/Telegram/SourceFiles/info/info_wrap_widget.cpp b/Telegram/SourceFiles/info/info_wrap_widget.cpp index 27f30b0bd..7430d6866 100644 --- a/Telegram/SourceFiles/info/info_wrap_widget.cpp +++ b/Telegram/SourceFiles/info/info_wrap_widget.cpp @@ -66,7 +66,10 @@ WrapWidget::WrapWidget( , _wrap(wrap) , _controller(createController(window, memento->content())) , _topShadow(this) { - _topShadow->toggleOn(topShadowToggledValue()); + _topShadow->toggleOn(topShadowToggledValue() + | rpl::filter([](bool shown) { + return true; + })); _wrap.changes() | rpl::start_with_next([this] { setupTop(); @@ -452,7 +455,7 @@ QPixmap WrapWidget::grabForShowAnimation( if (params.withTopBarShadow) { _topShadow->setVisible(false); } else { - _topShadow->toggle(_topShadow->toggled(), anim::type::instant); + _topShadow->setVisible(_topShadow->toggled()); } if (params.withTabs && _topTabs) { _topTabs->hide(); @@ -473,6 +476,9 @@ void WrapWidget::showAnimatedHook( _topTabs->show(); _topTabsBackground->show(); } + if (params.withTopBarShadow) { + _topShadow->setVisible(true); + } } void WrapWidget::doSetInnerFocus() { @@ -544,7 +550,7 @@ void WrapWidget::showNewContent( && newContent->hasTopBarShadow(); animationParams.oldContentCache = grabForShowAnimation( animationParams); -// animationParams.withFade = (wrap() == Wrap::Layer); + animationParams.withFade = (wrap() == Wrap::Layer); } if (saveToStack) { auto item = StackItem(); diff --git a/Telegram/SourceFiles/window/window_slide_animation.cpp b/Telegram/SourceFiles/window/window_slide_animation.cpp index 4f03aaf53..1c0cc5ea4 100644 --- a/Telegram/SourceFiles/window/window_slide_animation.cpp +++ b/Telegram/SourceFiles/window/window_slide_animation.cpp @@ -71,10 +71,6 @@ void SlideAnimation::paintContents(Painter &p, const QRect &update) const { p.setOpacity(progress); st::slideShadow.fill(p, QRect(coordOver - st::slideShadow.width(), 0, st::slideShadow.width(), _cacheOver.height() / retina)); } - if (_topBarShadowEnabled) { - p.setOpacity(1); - p.fillRect(0, st::topBarHeight, _cacheOver.width() / retina, st::lineWidth, st::shadowFg); - } } void SlideAnimation::setDirection(SlideDirection direction) {