From 840818e39ab75d7fe3db675c3f1a56851f85a27d Mon Sep 17 00:00:00 2001 From: Rivo Laks Date: Fri, 21 Sep 2007 13:27:56 +0000 Subject: [PATCH] Add separate option for smooth scaling in XRender mode. It's slow (software scaling), so it's disabled by default. svn path=/trunk/KDE/kdebase/workspace/; revision=715200 --- kcmkwin/kwincompositing/advanced.cpp | 9 +++++++++ kcmkwin/kwincompositing/advanced.ui | 16 ++++++++++++++++ options.cpp | 2 ++ options.h | 3 +++ scene_xrender.cpp | 2 +- 5 files changed, 31 insertions(+), 1 deletion(-) diff --git a/kcmkwin/kwincompositing/advanced.cpp b/kcmkwin/kwincompositing/advanced.cpp index f4ee346c74..1c2e69af79 100644 --- a/kcmkwin/kwincompositing/advanced.cpp +++ b/kcmkwin/kwincompositing/advanced.cpp @@ -62,6 +62,7 @@ void KWinAdvancedCompositingOptions::changed() void KWinAdvancedCompositingOptions::compositingModeChanged() { ui.glGroup->setEnabled(ui.compositingType->currentIndex() == 0); + ui.xrenderGroup->setEnabled(ui.compositingType->currentIndex() == 1); } void KWinAdvancedCompositingOptions::showConfirmDialog() @@ -89,11 +90,16 @@ void KWinAdvancedCompositingOptions::load() KConfigGroup config(mKWinConfig, "Compositing"); QString backend = config.readEntry("Backend", "OpenGL"); ui.compositingType->setCurrentIndex((backend == "XRender") ? 1 : 0); + QString glMode = config.readEntry("GLMode", "TFP"); ui.glMode->setCurrentIndex((glMode == "TFP") ? 0 : ((glMode == "SHM") ? 1 : 2)); ui.glTextureFilter->setCurrentIndex(config.readEntry("GLTextureFilter", 1)); ui.glDirect->setChecked(config.readEntry("GLDirect", mDefaultPrefs->enableDirectRendering())); ui.glVSync->setChecked(config.readEntry("GLVSync", mDefaultPrefs->enableVSync())); + + ui.xrenderSmoothScale->setChecked(config.readEntry("XRenderSmoothScale", false)); + + compositingModeChanged(); } void KWinAdvancedCompositingOptions::save() @@ -108,11 +114,14 @@ void KWinAdvancedCompositingOptions::save() config.writeEntry("Backend", (ui.compositingType->currentIndex() == 0) ? "OpenGL" : "XRender"); QString glModes[] = { "TFP", "SHM", "Fallback" }; + config.writeEntry("GLMode", glModes[ui.glMode->currentIndex()]); config.writeEntry("GLTextureFilter", ui.glTextureFilter->currentIndex()); config.writeEntry("GLDirect", ui.glDirect->isChecked()); config.writeEntry("GLVSync", ui.glVSync->isChecked()); + config.writeEntry("XRenderSmoothScale", ui.xrenderSmoothScale->isChecked()); + enableButtonApply(false); reinitKWinCompositing(); diff --git a/kcmkwin/kwincompositing/advanced.ui b/kcmkwin/kwincompositing/advanced.ui index b72fb10b28..02e23d7930 100644 --- a/kcmkwin/kwincompositing/advanced.ui +++ b/kcmkwin/kwincompositing/advanced.ui @@ -118,6 +118,22 @@ + + + + XRender options + + + + + + Smooth scaling (slower) + + + + + + diff --git a/options.cpp b/options.cpp index dca89a6a11..80433b48a2 100644 --- a/options.cpp +++ b/options.cpp @@ -226,6 +226,8 @@ void Options::reloadCompositingSettings(const CompositingPrefs& prefs) glDirect = config.readEntry("GLDirect", prefs.enableDirectRendering() ); glVSync = config.readEntry("GLVSync", prefs.enableVSync() ); smoothScale = qBound( -1, config.readEntry( "GLTextureFilter", -1 ), 2 ); + + xrenderSmoothScale = config.readEntry("XRenderSmoothScale", false ); } diff --git a/options.h b/options.h index 39c0997d8c..51a526b68b 100644 --- a/options.h +++ b/options.h @@ -297,9 +297,12 @@ class Options : public KDecorationOptions HiddenPreviews hiddenPreviews; uint refreshRate; + // This is for OpenGL mode int smoothScale; // 0 = no, 1 = yes when transformed, // 2 = try trilinear when transformed; else 1, // -1 = auto + // This is for XRender mode + bool xrenderSmoothScale; enum GLMode { GLTFP, GLSHM, GLFallback }; GLMode glMode; diff --git a/scene_xrender.cpp b/scene_xrender.cpp index cf99e2a9c8..3d94dc309f 100644 --- a/scene_xrender.cpp +++ b/scene_xrender.cpp @@ -453,7 +453,7 @@ void SceneXrender::Window::performPaint( int mask, QRegion region, WindowPaintDa if( pic == None ) // The render format can be null for GL and/or Xv visuals return; // set picture filter - if( options->smoothScale > 0 ) // only when forced, it's slow + if( options->xrenderSmoothScale ) // only when forced, it's slow { if( mask & PAINT_WINDOW_TRANSFORMED ) filter = ImageFilterGood;