Skip to content
Permalink
Browse files

Enable backbuffering / incremental drawing features only on supported…

… platforms

Correct typo
  • Loading branch information
m-kuhn authored and mhugent committed Aug 9, 2012
1 parent 295c464 commit 02f06f99686a17182bf9cda71ae08d1596292290
Showing with 25 additions and 7 deletions.
  1. +12 −2 src/app/qgsoptions.cpp
  2. +2 −0 src/app/qgsoptions.h
  3. +5 −1 src/core/qgsvectorlayer.cpp
  4. +5 −3 src/gui/qgsmapcanvas.cpp
  5. +1 −1 src/ui/qgsoptionsbase.ui
@@ -76,8 +76,9 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
connect( spinFontSize, SIGNAL( valueChanged( const QString& ) ), this, SLOT( fontSizeChanged( const QString& ) ) );

connect( chkUseStandardDeviation, SIGNAL( stateChanged( int ) ), this, SLOT( toggleStandardDeviation( int ) ) );

#ifdef Q_WS_X11
connect( chkEnableBackbuffer, SIGNAL( stateChanged( int ) ), this, SLOT( toggleEnableBackbuffer( int ) ) );
#endif

connect( this, SIGNAL( accepted() ), this, SLOT( saveOptions() ) );

@@ -229,10 +230,19 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
if ( index == -1 ) index = 1;
cmbScanZipInBrowser->setCurrentIndex( index );

// Set the enable backbuffer state
// Set the enable backbuffer state for X11 (linux) systems only
// TODO: remove this when threading is implemented
#ifdef Q_WS_X11
chkEnableBackbuffer->setChecked( settings.value( "/Map/enableBackbuffer" ).toBool() );
toggleEnableBackbuffer( chkEnableBackbuffer->checkState() );
#elif Q_WS_MAC
chkEnableBackbuffer->setChecked( true );
chkEnableBackbuffer->setEnabled( false );
labelUpdateThreshold->setEnabled( false );
spinBoxUpdateThreshold->setEnabled( false );
#else // Q_WS_WIN32
chkEnableBackbuffer->setChecked( true );
chkEnableBackbuffer->setEnabled( false );
#endif

// set the display update threshold
@@ -74,9 +74,11 @@ class QgsOptions : public QDialog, private Ui::QgsOptionsBase

void toggleStandardDeviation( int );

#ifdef Q_WS_X11
//! Slot to change backbuffering. This is handled when the user changes
// the value of the checkbox
void toggleEnableBackbuffer( int );
#endif

/**
* Return the desired state of newly added layers. If a layer
@@ -734,8 +734,10 @@ void QgsVectorLayer::drawRendererV2( QgsRenderContext& rendererContext, bool lab
break;
}
#ifndef Q_WS_MAC //MH: disable this on Mac for now to avoid problems with resizing
#ifdef Q_WS_X11
if ( !mEnableBackbuffer ) // do not handle events, as we're already inside a paint event
{
#endif // Q_WS_X11
if ( mUpdateThreshold > 0 && 0 == featureCount % mUpdateThreshold )
{
emit screenUpdateRequested();
@@ -747,8 +749,10 @@ void QgsVectorLayer::drawRendererV2( QgsRenderContext& rendererContext, bool lab
// emit drawingProgress( featureCount, totalFeatures );
qApp->processEvents();
}
#ifdef Q_WS_X11
}
#endif //Q_WS_MAC
#endif // Q_WS_X11
#endif // Q_WS_MAC

bool sel = mSelectedFeatureIds.contains( fet.id() );
bool drawMarker = ( mEditable && ( !vertexMarkerOnlyForSelection || sel ) );
@@ -377,10 +377,11 @@ void QgsMapCanvas::refresh()
bool enableBackbufferSetting = 0;
#endif

//disable the update that leads to the resize crash
#ifdef Q_WS_X11
#ifndef ANDROID
// disable the update that leads to the resize crash on X11 systems
if ( viewport() )
{
#ifndef ANDROID
if ( enableBackbufferSetting != mBackbufferEnabled )
{
qDebug() << "Enable back buffering: " << enableBackbufferSetting;
@@ -394,8 +395,9 @@ void QgsMapCanvas::refresh()
}
mBackbufferEnabled = enableBackbufferSetting;
}
#endif //ANDROID
}
#endif // ANDROID
#endif // Q_WS_X11

mDrawing = true;

@@ -977,7 +977,7 @@
<item row="2" column="0">
<widget class="QCheckBox" name="chkEnableBackbuffer">
<property name="text">
<string>Enable back buffer (Better graphics performance at the cost loosing the possibiliti to cancel rendering and incremental feature drawing)</string>
<string>Enable back buffer (Better graphics performance at the cost of loosing the possibility to cancel rendering and incremental feature drawing)</string>
</property>
</widget>
</item>

0 comments on commit 02f06f9

Please sign in to comment.
You can’t perform that action at this time.