From 72ad5dc8948c6b53bda7909656bf39ce835713d6 Mon Sep 17 00:00:00 2001 From: Vlad Zagorodniy Date: Sun, 23 Sep 2018 15:04:20 +0300 Subject: [PATCH] [effects/slide] Delete redundant checks Summary: If isActive() returns false, neither paintScreen nor paintWindow nor postPaintScreen will be called. So, `if (m_active)` checks are redundant. Reviewers: #kwin, davidedmundson Reviewed By: #kwin, davidedmundson Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D15708 --- effects/slide/slide.cpp | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/effects/slide/slide.cpp b/effects/slide/slide.cpp index 9e0e8a4344..bc42c5c6ce 100644 --- a/effects/slide/slide.cpp +++ b/effects/slide/slide.cpp @@ -128,11 +128,6 @@ inline QRegion buildClipRegion(const QPoint &pos, int w, int h) void SlideEffect::paintScreen(int mask, QRegion region, ScreenPaintData &data) { - if (!m_active) { - effects->paintScreen(mask, region, data); - return; - } - const bool wrap = effects->optionRollOverDesktops(); const int w = workspaceWidth(); const int h = workspaceHeight(); @@ -265,23 +260,21 @@ bool SlideEffect::isPainted(const EffectWindow *w) const void SlideEffect::prePaintWindow(EffectWindow *w, WindowPrePaintData &data, int time) { - if (m_active) { - const bool painted = isPainted(w); - if (painted) { - w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DESKTOP); - } else { - w->disablePainting(EffectWindow::PAINT_DISABLED_BY_DESKTOP); - } - if (painted && isTranslated(w)) { - data.setTransformed(); - } + const bool painted = isPainted(w); + if (painted) { + w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DESKTOP); + } else { + w->disablePainting(EffectWindow::PAINT_DISABLED_BY_DESKTOP); + } + if (painted && isTranslated(w)) { + data.setTransformed(); } effects->prePaintWindow(w, data, time); } void SlideEffect::paintWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data) { - if (m_active && isTranslated(w)) { + if (isTranslated(w)) { data += m_paintCtx.translation; } effects->paintWindow(w, mask, region, data);