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
This commit is contained in:
Vlad Zagorodniy 2019-02-06 00:40:47 +02:00
parent 16a2799b3a
commit be8729105f
7 changed files with 17 additions and 18 deletions

View file

@ -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

View file

@ -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

View file

@ -28,6 +28,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "options.h"
#include "workspace.h"
#include <logging.h>
#include <kwinglutils.h>
#include <kwinglplatform.h>
@ -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();
}
}

View file

@ -28,9 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QVector2D>
#include <QVector4D>
#include <kwinconfig.h>
#include <kwin_export.h>
namespace KWin
{
@ -41,8 +38,7 @@ class GLTexture;
class GLRenderTarget;
class GLShader;
class KWIN_EXPORT LanczosFilter
: public QObject
class LanczosFilter : public QObject
{
Q_OBJECT

View file

@ -1,7 +1,6 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/resources">
<qresource prefix="/scenes/opengl">
<file>shaders/1.10/lanczos-fragment.glsl</file>
<file>shaders/1.40/lanczos-fragment.glsl</file>
</qresource>
</qresource>
</RCC>