aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCasian Andrei <skeletk13@gmail.com>2013-01-05 03:39:02 (GMT)
committerCasian Andrei <skeletk13@gmail.com>2013-01-13 17:10:54 (GMT)
commit6cd210f611b7527922d62bc389dfe38b49566349 (patch)
tree88faa60293426b542f8034e29e9d2e6088d4b098
parent70601dd657efb9066c62e649693f271764523823 (diff)
Fix premultiplied alpha issue with color correction
When correcting a color that was with premultiplied alpha, the alpha value was not multiplied back again as a final step. This was breaking color correction when the blend function was GL_ONE, GL_ONE_MINUS_SRC_ALPHA. The blend function was changed for normal windows (a workaround), but not for effect frames, i.e. the effect frames were broken with color correction enabled. Removes the blend function workaround. Removes a useless setupForOutput. BUG: 311319 REVIEW: 108189
-rw-r--r--kwin/libkwineffects/kwinglcolorcorrection.cpp2
-rw-r--r--kwin/scene_opengl.cpp14
2 files changed, 5 insertions, 11 deletions
diff --git a/kwin/libkwineffects/kwinglcolorcorrection.cpp b/kwin/libkwineffects/kwinglcolorcorrection.cpp
index 4b43de5..0f46189 100644
--- a/kwin/libkwineffects/kwinglcolorcorrection.cpp
+++ b/kwin/libkwineffects/kwinglcolorcorrection.cpp
@@ -235,7 +235,7 @@ void ColorServerInterface::callFinishedSlot(QDBusPendingCallWatcher *watcher)
static const char s_ccVars[] =
"uniform sampler3D u_ccLookupTexture;\n";
static const char s_ccAlteration[] =
- "gl_FragColor.rgb = texture3D(u_ccLookupTexture, gl_FragColor.rgb / gl_FragColor.a).rgb;\n";
+ "gl_FragColor.rgb = texture3D(u_ccLookupTexture, gl_FragColor.rgb / gl_FragColor.a).rgb * gl_FragColor.a;\n";
/*
diff --git a/kwin/scene_opengl.cpp b/kwin/scene_opengl.cpp
index d463631..b73e606 100644
--- a/kwin/scene_opengl.cpp
+++ b/kwin/scene_opengl.cpp
@@ -1240,8 +1240,6 @@ void SceneOpenGL2Window::beginRenderWindow(int mask, const WindowPaintData &data
}
shader->setUniform(GLShader::WindowTransformation, transformation(mask, data));
-
- static_cast<SceneOpenGL2*>(m_scene)->colorCorrection()->setupForOutput(data.screen());
}
void SceneOpenGL2Window::endRenderWindow(const WindowPaintData &data)
@@ -1270,15 +1268,11 @@ void SceneOpenGL2Window::prepareStates(TextureType type, qreal opacity, qreal br
}
if (!opaque) {
glEnable(GL_BLEND);
- if (static_cast<SceneOpenGL2*>(m_scene)->colorCorrection()->isEnabled()) {
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ if (alpha) {
+ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
} else {
- if (alpha) {
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- } else {
- glBlendColor((float)opacity, (float)opacity, (float)opacity, (float)opacity);
- glBlendFunc(GL_ONE, GL_ONE_MINUS_CONSTANT_ALPHA);
- }
+ glBlendColor((float)opacity, (float)opacity, (float)opacity, (float)opacity);
+ glBlendFunc(GL_ONE, GL_ONE_MINUS_CONSTANT_ALPHA);
}
}
m_blendingEnabled = !opaque;