From be8729105f62ffeebf0ccedce90d4995c9ad1107 Mon Sep 17 00:00:00 2001 From: Vlad Zagorodniy Date: Wed, 6 Feb 2019 00:40:47 +0200 Subject: [PATCH] Move lanczos filter away from KWin core Summary: Lanczos filter shouldn't be in KWin core because it's quite specific about rendering backend. Test Plan: Windows in the desktop grid look normal. Reviewers: #kwin, davidedmundson Reviewed By: #kwin, davidedmundson Subscribers: mart, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D18774 --- CMakeLists.txt | 3 --- plugins/scenes/opengl/CMakeLists.txt | 9 +++++++-- .../scenes/opengl/lanczosfilter.cpp | 12 +++++++----- .../scenes/opengl/lanczosfilter.h | 6 +----- resources.qrc => plugins/scenes/opengl/resources.qrc | 5 ++--- .../opengl/shaders}/1.10/lanczos-fragment.glsl | 0 .../opengl/shaders}/1.40/lanczos-fragment.glsl | 0 7 files changed, 17 insertions(+), 18 deletions(-) rename lanczosfilter.cpp => plugins/scenes/opengl/lanczosfilter.cpp (97%) rename lanczosfilter.h => plugins/scenes/opengl/lanczosfilter.h (95%) rename resources.qrc => plugins/scenes/opengl/resources.qrc (74%) rename {shaders => plugins/scenes/opengl/shaders}/1.10/lanczos-fragment.glsl (100%) rename {shaders => plugins/scenes/opengl/shaders}/1.40/lanczos-fragment.glsl (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e43e79e37..9d2e0bba23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -437,7 +437,6 @@ set(kwin_KDEINIT_SRCS scene.cpp screenlockerwatcher.cpp thumbnailitem.cpp - lanczosfilter.cpp deleted.cpp effects.cpp effectloader.cpp @@ -552,8 +551,6 @@ qt5_add_dbus_interface( kwin_KDEINIT_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/org.freede qt5_add_dbus_interface( kwin_KDEINIT_SRCS org.kde.kappmenu.xml appmenu_interface ) -qt5_add_resources( kwin_KDEINIT_SRCS resources.qrc ) - ki18n_wrap_ui(kwin_KDEINIT_SRCS debug_console.ui shortcutdialog.ui diff --git a/plugins/scenes/opengl/CMakeLists.txt b/plugins/scenes/opengl/CMakeLists.txt index a01a265336..1134f06440 100644 --- a/plugins/scenes/opengl/CMakeLists.txt +++ b/plugins/scenes/opengl/CMakeLists.txt @@ -1,4 +1,7 @@ -set(SCENE_OPENGL_SRCS scene_opengl.cpp) +set(SCENE_OPENGL_SRCS + scene_opengl.cpp + lanczosfilter.cpp +) include(ECMQtDeclareLoggingCategory) ecm_qt_declare_logging_category( @@ -12,7 +15,9 @@ ecm_qt_declare_logging_category( Critical ) -add_library(KWinSceneOpenGL MODULE scene_opengl.cpp) +qt5_add_resources(SCENE_OPENGL_SRCS resources.qrc) + +add_library(KWinSceneOpenGL MODULE ${SCENE_OPENGL_SRCS}) set_target_properties(KWinSceneOpenGL PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/org.kde.kwin.scenes/") target_link_libraries(KWinSceneOpenGL kwin diff --git a/lanczosfilter.cpp b/plugins/scenes/opengl/lanczosfilter.cpp similarity index 97% rename from lanczosfilter.cpp rename to plugins/scenes/opengl/lanczosfilter.cpp index fbd4a393ba..c02158dd65 100644 --- a/lanczosfilter.cpp +++ b/plugins/scenes/opengl/lanczosfilter.cpp @@ -28,6 +28,8 @@ along with this program. If not, see . #include "options.h" #include "workspace.h" +#include + #include #include @@ -65,7 +67,7 @@ void LanczosFilter::init() m_inited = true; const bool force = (qstrcmp(qgetenv("KWIN_FORCE_LANCZOS"), "1") == 0); if (force) { - qCWarning(KWIN_CORE) << "Lanczos Filter forced on by environment variable"; + qCWarning(KWIN_OPENGL) << "Lanczos Filter forced on by environment variable"; } if (!force && options->glSmoothScale() != 2) @@ -87,10 +89,10 @@ void LanczosFilter::init() } } QFile ff(gl->glslVersion() >= kVersionNumber(1, 40) ? - QStringLiteral(":/resources/shaders/1.40/lanczos-fragment.glsl") : - QStringLiteral(":/resources/shaders/1.10/lanczos-fragment.glsl")); + QStringLiteral(":/scenes/opengl/shaders/1.40/lanczos-fragment.glsl") : + QStringLiteral(":/scenes/opengl/shaders/1.10/lanczos-fragment.glsl")); if (!ff.open(QIODevice::ReadOnly)) { - qCDebug(KWIN_CORE) << "Failed to open lanczos shader"; + qCDebug(KWIN_OPENGL) << "Failed to open lanczos shader"; return; } m_shader.reset(ShaderManager::instance()->generateCustomShader(ShaderTrait::MapTexture, QByteArray(), ff.readAll())); @@ -99,7 +101,7 @@ void LanczosFilter::init() m_uKernel = m_shader->uniformLocation("kernel"); m_uOffsets = m_shader->uniformLocation("offsets"); } else { - qCDebug(KWIN_CORE) << "Shader is not valid"; + qCDebug(KWIN_OPENGL) << "Shader is not valid"; m_shader.reset(); } } diff --git a/lanczosfilter.h b/plugins/scenes/opengl/lanczosfilter.h similarity index 95% rename from lanczosfilter.h rename to plugins/scenes/opengl/lanczosfilter.h index 90dff420c2..66481a770d 100644 --- a/lanczosfilter.h +++ b/plugins/scenes/opengl/lanczosfilter.h @@ -28,9 +28,6 @@ along with this program. If not, see . #include #include -#include -#include - namespace KWin { @@ -41,8 +38,7 @@ class GLTexture; class GLRenderTarget; class GLShader; -class KWIN_EXPORT LanczosFilter - : public QObject +class LanczosFilter : public QObject { Q_OBJECT diff --git a/resources.qrc b/plugins/scenes/opengl/resources.qrc similarity index 74% rename from resources.qrc rename to plugins/scenes/opengl/resources.qrc index 11616caf05..8fbd27d16a 100644 --- a/resources.qrc +++ b/plugins/scenes/opengl/resources.qrc @@ -1,7 +1,6 @@ - + shaders/1.10/lanczos-fragment.glsl - shaders/1.40/lanczos-fragment.glsl - + diff --git a/shaders/1.10/lanczos-fragment.glsl b/plugins/scenes/opengl/shaders/1.10/lanczos-fragment.glsl similarity index 100% rename from shaders/1.10/lanczos-fragment.glsl rename to plugins/scenes/opengl/shaders/1.10/lanczos-fragment.glsl diff --git a/shaders/1.40/lanczos-fragment.glsl b/plugins/scenes/opengl/shaders/1.40/lanczos-fragment.glsl similarity index 100% rename from shaders/1.40/lanczos-fragment.glsl rename to plugins/scenes/opengl/shaders/1.40/lanczos-fragment.glsl