Add Color Correction support

This commit is contained in:
Antonis Tsiapaliokas 2013-09-12 14:55:25 +03:00 committed by Martin Gräßlin
parent 748d2d327f
commit bd3219b5a7
3 changed files with 26 additions and 3 deletions

View file

@ -113,6 +113,12 @@ int Compositing::glSwapStrategy() const
}
}
bool Compositing::glColorCorrection() const
{
KConfigGroup kwinConfig(KSharedConfig::openConfig("kwinrc"), "Compositing");
return kwinConfig.readEntry("GLColorCorrection", false);
}
CompositingType::CompositingType(QObject *parent)
: QAbstractItemModel(parent) {
@ -221,7 +227,7 @@ int CompositingType::currentOpenGLType()
}
void CompositingType::syncConfig(int openGLType, int animationSpeed, int windowThumbnail, int glSclaleFilter, bool xrSclaleFilter,
bool unredirectFullscreen, int glSwapStrategy)
bool unredirectFullscreen, int glSwapStrategy, bool glColorCorrection)
{
QString glSwapStrategyValue;
QString backend;
@ -282,6 +288,7 @@ void CompositingType::syncConfig(int openGLType, int animationSpeed, int windowT
kwinConfig.writeEntry("XRenderSmoothScale", xrSclaleFilter);
kwinConfig.writeEntry("UnredirectFullscreen", unredirectFullscreen);
kwinConfig.writeEntry("GLPreferBufferSwap", glSwapStrategyValue);
kwinConfig.writeEntry("GLColorCorrection", glColorCorrection);
kwinConfig.sync();
}

View file

@ -38,6 +38,7 @@ class Compositing : public QObject
Q_PROPERTY(bool xrSclaleFilter READ xrSclaleFilter CONSTANT);
Q_PROPERTY(bool unredirectFullscreen READ unredirectFullscreen CONSTANT);
Q_PROPERTY(int glSwapStrategy READ glSwapStrategy CONSTANT);
Q_PROPERTY(bool glColorCorrection READ glColorCorrection CONSTANT);
public:
explicit Compositing(QObject *parent = 0);
@ -49,6 +50,7 @@ public:
bool xrSclaleFilter() const;
bool unredirectFullscreen() const;
int glSwapStrategy() const;
bool glColorCorrection() const;
private:
@ -93,7 +95,7 @@ public:
Q_INVOKABLE int currentOpenGLType();
Q_INVOKABLE void syncConfig(int openGLType, int animationSpeed, int windowThumbnail, int glSclaleFilter, bool xrSclaleFilter,
bool unredirectFullscreen, int glSwapStrategy);
bool unredirectFullscreen, int glSwapStrategy, bool glColorCorrection);
private:
void generateCompositing();

View file

@ -70,6 +70,7 @@ Item {
apply.enabled = true;
glScaleFilter.visible = currentIndex != 3;
xrScaleFilter.visible = currentIndex == 3;
glColorCorrection.enabled = currentIndex !=3 && glColorCorrection !=4;
}
}
@ -188,6 +189,18 @@ Item {
onCurrentIndexChanged: apply.enabled = true;
}
CheckBox {
id: glColorCorrection
text: i18n("Enable color correction (experimental)")
checked: compositing.glColorCorrection
enabled: openGLType.currentIndex != 3 && openGLType.currentIndex != 4
anchors {
top: glSwapStrategy.bottom
left: col.right
}
onClicked: apply.enabled = true
}
ColumnLayout {
id: col
height: parent.height
@ -267,7 +280,8 @@ Item {
onClicked: {
searchModel.syncConfig();
apply.enabled = false;
compositingType.syncConfig(openGLType.currentIndex, animationSpeed.value, windowThumbnail.currentIndex, glScaleFilter.currentIndex, xrScaleFilter.currentIndex == 1, unredirectFullScreen.checked, glSwapStrategy.currentIndex);
compositingType.syncConfig(openGLType.currentIndex, animationSpeed.value, windowThumbnail.currentIndex, glScaleFilter.currentIndex, xrScaleFilter.currentIndex == 1,
unredirectFullScreen.checked, glSwapStrategy.currentIndex, glColorCorrection.checked);
}
}