diff --git a/effects/taskbarthumbnail/taskbarthumbnail.cpp b/effects/taskbarthumbnail/taskbarthumbnail.cpp index 9ec67542bf..934c59db9d 100644 --- a/effects/taskbarthumbnail/taskbarthumbnail.cpp +++ b/effects/taskbarthumbnail/taskbarthumbnail.cpp @@ -47,14 +47,6 @@ TaskbarThumbnailEffect::TaskbarThumbnailEffect() unsigned char dummy = 0; XChangeProperty( display(), rootWindow(), atom, atom, 8, PropModeReplace, &dummy, 1 ); - // With the NVIDIA driver the alpha values are set to 0 when drawing a window texture - // without an alpha channel on an FBO that has an alpha channel. - // This creates problems when the FBO is drawn on the backbuffer with blending enabled, - // so for now we only do high quality scaling with windows with alpha channels with - // the NVIDIA driver. - const QByteArray vendor = (const char *) glGetString( GL_VENDOR ); - alphaWindowsOnly = vendor.startsWith("NVIDIA"); - if ( GLShader::fragmentShaderSupported() && GLShader::vertexShaderSupported() && GLRenderTarget::supported() ) @@ -193,13 +185,13 @@ void TaskbarThumbnailEffect::paintWindow( EffectWindow* w, int mask, QRegion reg if( thumbw == NULL ) continue; WindowPaintData thumbData( thumbw ); - thumbData.opacity = data.opacity; + thumbData.opacity *= data.opacity; QRect r; #ifdef KWIN_HAVE_OPENGL_COMPOSITING if( effects->compositingType() == KWin::OpenGLCompositing ) { - if ( shader && (!alphaWindowsOnly || thumbw->hasAlpha()) ) + if ( shader ) { int tx = thumb.rect.x() + w->x(); int ty = thumb.rect.y() + w->y(); diff --git a/effects/taskbarthumbnail/taskbarthumbnail.h b/effects/taskbarthumbnail/taskbarthumbnail.h index 507e35285e..b62dac57d3 100644 --- a/effects/taskbarthumbnail/taskbarthumbnail.h +++ b/effects/taskbarthumbnail/taskbarthumbnail.h @@ -67,7 +67,6 @@ class TaskbarThumbnailEffect int uOffsets; int uKernel; int uKernelSize; - bool alphaWindowsOnly; }; } // namespace diff --git a/scene_opengl.cpp b/scene_opengl.cpp index 2cfd18db0e..d75ffa6abc 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -1838,6 +1838,16 @@ void SceneOpenGL::Window::prepareRenderStates( TextureType type, double opacity, glTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant ); } } + else if( !alpha && opaque ) + { + float constant[] = { 1.0, 1.0, 1.0, 1.0 }; + glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE ); + glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE ); + glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE ); + glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE ); + glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_CONSTANT ); + glTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant ); + } } void SceneOpenGL::Window::restoreStates( TextureType type, double opacity, double brightness, double saturation, GLShader* shader ) @@ -1893,9 +1903,9 @@ void SceneOpenGL::Window::restoreRenderStates( TextureType type, double opacity, glDisable( tex->target()); glActiveTexture(GL_TEXTURE0); } - glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE ); - glColor4f( 0, 0, 0, 0 ); } + glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE ); + glColor4f( 0, 0, 0, 0 ); glPopAttrib(); // ENABLE_BIT }