From 0ff09244f19433957343e8aede39d3d44d5f317c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 27 Apr 2009 11:10:08 +0000 Subject: [PATCH] Taskbarthumbnail sets texture width and height if there is a shader bound. BUG: 190061 svn path=/trunk/KDE/kdebase/workspace/; revision=959836 --- effects/taskbarthumbnail/taskbarthumbnail.cpp | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/effects/taskbarthumbnail/taskbarthumbnail.cpp b/effects/taskbarthumbnail/taskbarthumbnail.cpp index 956b15c123..1d1dd8f2e9 100644 --- a/effects/taskbarthumbnail/taskbarthumbnail.cpp +++ b/effects/taskbarthumbnail/taskbarthumbnail.cpp @@ -23,6 +23,10 @@ along with this program. If not, see . #include +#ifdef KWIN_HAVE_OPENGL_COMPOSITING + #include +#endif + // This effect shows a preview inside a window that has a special property set // on it that says which window and where to render. It is used by the taskbar @@ -82,6 +86,24 @@ void TaskbarThumbnailEffect::paintWindow( EffectWindow* w, int mask, QRegion reg QRect r; setPositionTransformations( thumbData, r, thumbw, thumb.rect.translated( w->pos()), Qt::KeepAspectRatio ); + +#ifdef KWIN_HAVE_OPENGL_COMPOSITING + if( effects->compositingType() == KWin::OpenGLCompositing && data.shader ) + { + // there is a shader - update texture width and height + int texw = thumbw->width(); + int texh = thumbw->height(); + if( !GLTexture::NPOTTextureSupported() ) + { + kWarning( 1212 ) << "NPOT textures not supported, wasting some memory" ; + texw = nearestPowerOfTwo( texw ); + texh = nearestPowerOfTwo( texh ); + } + thumbData.shader = data.shader; + thumbData.shader->setTextureWidth( (float)texw ); + thumbData.shader->setTextureHeight( (float)texh ); + } +#endif effects->drawWindow( thumbw, mask, r, thumbData ); } }