From 96ac6a506bbe59421a619bf82ed6f37f0205c637 Mon Sep 17 00:00:00 2001 From: Vlad Zagorodniy Date: Thu, 5 Sep 2019 19:06:03 +0300 Subject: [PATCH] Drop redundant Compositor::hasScene() Summary: Compositor::hasScene() is redundant. Depending on use case, it can be replaced by checking either m_state or Compositor::scene(). Reviewers: #kwin Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D23744 --- composite.cpp | 16 ++++++++++------ composite.h | 3 --- dbusinterface.cpp | 2 +- platform.cpp | 2 +- workspace.cpp | 2 +- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/composite.cpp b/composite.cpp index 58d57fac70..fd7f93069e 100644 --- a/composite.cpp +++ b/composite.cpp @@ -534,32 +534,36 @@ void Compositor::reinitialize() void Compositor::addRepaint(int x, int y, int w, int h) { - if (!hasScene()) + if (m_state != State::On) { return; + } repaints_region += QRegion(x, y, w, h); scheduleRepaint(); } void Compositor::addRepaint(const QRect& r) { - if (!hasScene()) + if (m_state != State::On) { return; + } repaints_region += r; scheduleRepaint(); } void Compositor::addRepaint(const QRegion& r) { - if (!hasScene()) + if (m_state != State::On) { return; + } repaints_region += r; scheduleRepaint(); } void Compositor::addRepaintFull() { - if (!hasScene()) + if (m_state != State::On) { return; + } const QSize &s = screens()->size(); repaints_region = QRegion(0, 0, s.width(), s.height()); scheduleRepaint(); @@ -976,7 +980,7 @@ void X11Compositor::performCompositing() bool X11Compositor::checkForOverlayWindow(WId w) const { - if (!hasScene()) { + if (!scene()) { // No scene, so it cannot be the overlay window. return false; } @@ -990,7 +994,7 @@ bool X11Compositor::checkForOverlayWindow(WId w) const bool X11Compositor::isOverlayWindowVisible() const { - if (!hasScene()) { + if (!scene()) { return false; } if (!scene()->overlayWindow()) { diff --git a/composite.h b/composite.h index e1799127cf..9f9e52d7e5 100644 --- a/composite.h +++ b/composite.h @@ -92,9 +92,6 @@ public: bool isActive(); virtual int refreshRate() const = 0; - bool hasScene() const { - return m_scene != NULL; - } Scene *scene() const { return m_scene; } diff --git a/dbusinterface.cpp b/dbusinterface.cpp index a152c00142..5b9d6e9c7c 100644 --- a/dbusinterface.cpp +++ b/dbusinterface.cpp @@ -267,7 +267,7 @@ QString CompositorDBusInterface::compositingNotPossibleReason() const QString CompositorDBusInterface::compositingType() const { - if (!m_compositor->hasScene()) { + if (!m_compositor->scene()) { return QStringLiteral("none"); } switch (m_compositor->scene()->compositingType()) { diff --git a/platform.cpp b/platform.cpp index 1fa8b509a6..ab0267373c 100644 --- a/platform.cpp +++ b/platform.cpp @@ -529,7 +529,7 @@ OutlineVisual *Platform::createOutline(Outline *outline) Decoration::Renderer *Platform::createDecorationRenderer(Decoration::DecoratedClientImpl *client) { - if (Compositor::self()->hasScene()) { + if (Compositor::self()->scene()) { return Compositor::self()->scene()->createDecorationRenderer(client); } return nullptr; diff --git a/workspace.cpp b/workspace.cpp index 9a6ef1781b..59367a5f95 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -1759,7 +1759,7 @@ Toplevel *Workspace::findInternal(QWindow *w) const bool Workspace::compositing() const { - return m_compositor && m_compositor->hasScene(); + return m_compositor && m_compositor->scene(); } void Workspace::markXStackingOrderAsDirty()