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
This commit is contained in:
Rivo Laks 2007-09-21 13:27:56 +00:00
parent 090855777a
commit 840818e39a
5 changed files with 31 additions and 1 deletions

View file

@ -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();

View file

@ -118,6 +118,22 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="xrenderGroup" >
<property name="title" >
<string>XRender options</string>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QCheckBox" name="xrenderSmoothScale" >
<property name="text" >
<string>Smooth scaling (slower)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >

View file

@ -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 );
}

View file

@ -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;

View file

@ -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;