From 4607cab829761cb0f802d41e5f68f949e74569c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Sun, 3 Dec 2006 13:38:57 +0000 Subject: [PATCH] Config option for whether zooming should be smooth or fast. svn path=/branches/work/kwin_composite/; revision=610138 --- options.cpp | 2 ++ options.h | 2 ++ scene_opengl.cpp | 10 ++++++++++ scene_xrender.cpp | 4 ++++ 4 files changed, 18 insertions(+) diff --git a/options.cpp b/options.cpp index 70a619b0ec..d46f5bf43a 100644 --- a/options.cpp +++ b/options.cpp @@ -195,6 +195,8 @@ unsigned long Options::updateSettings() onlyDecoTranslucent = config->readEntry("OnlyDecoTranslucent", QVariant(false)).toBool(); refreshRate = config->readEntry( "RefreshRate", 0 ); + smoothScale = qBound( -1, config->readEntry( "SmoothScale", -1 ), 1 ); + QString glmode = config->readEntry("GLMode", "TFP" ).upper(); if( glmode == "TFP" ) glMode = GLTFP; diff --git a/options.h b/options.h index 621fb7aba9..f86e249cd1 100644 --- a/options.h +++ b/options.h @@ -301,6 +301,8 @@ class Options : public KDecorationOptions bool onlyDecoTranslucent; uint refreshRate; + int smoothScale; // 0 = no, 1 = yes, -1 = auto + enum GLMode { GLTFP, GLSHM, GLFallback }; GLMode glMode; bool glAlwaysRebind; diff --git a/scene_opengl.cpp b/scene_opengl.cpp index 788291bb47..2d24653727 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -806,6 +806,16 @@ void SceneOpenGL::Window::enableTexture() assert( bound_pixmap != None ); glXBindTexImageEXT( display(), bound_glxpixmap, GLX_FRONT_LEFT_EXT, NULL ); } + if( options->smoothScale != 0 ) // default to yes + { + glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + } + else + { + glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); + glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); + } } void SceneOpenGL::Window::disableTexture() diff --git a/scene_xrender.cpp b/scene_xrender.cpp index 3f604defae..28eadc02e2 100644 --- a/scene_xrender.cpp +++ b/scene_xrender.cpp @@ -394,6 +394,8 @@ void SceneXrender::Window::performPaint( int mask, QRegion region, WindowPaintDa XRenderSetPictureTransform( display(), pic, &xform ); width = (int)(width * xscale); height = (int)(height * yscale); + if( options->smoothScale == 1 ) // only when forced, it's slow + XRenderSetPictureFilter( display(), pic, "good", NULL, 0 ); } if( opaque ) { @@ -414,6 +416,8 @@ void SceneXrender::Window::performPaint( int mask, QRegion region, WindowPaintDa { XDoubleToFixed( 0 ), XDoubleToFixed( 0 ), XDoubleToFixed( 1 ) } }}; XRenderSetPictureTransform( display(), pic, &xform ); + if( options->smoothScale == 1 ) + XRenderSetPictureFilter( display(), pic, "fast", NULL, 0 ); } XFixesSetPictureClipRegion( display(), buffer, 0, 0, None ); }