Skip to content

Commit 02f06f9

Browse files
m-kuhnmhugent
authored andcommitted
Enable backbuffering / incremental drawing features only on supported platforms
Correct typo
1 parent 295c464 commit 02f06f9

File tree

5 files changed

+25
-7
lines changed

5 files changed

+25
-7
lines changed

src/app/qgsoptions.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
7676
connect( spinFontSize, SIGNAL( valueChanged( const QString& ) ), this, SLOT( fontSizeChanged( const QString& ) ) );
7777

7878
connect( chkUseStandardDeviation, SIGNAL( stateChanged( int ) ), this, SLOT( toggleStandardDeviation( int ) ) );
79-
79+
#ifdef Q_WS_X11
8080
connect( chkEnableBackbuffer, SIGNAL( stateChanged( int ) ), this, SLOT( toggleEnableBackbuffer( int ) ) );
81+
#endif
8182

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

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

232-
// Set the enable backbuffer state
233+
// Set the enable backbuffer state for X11 (linux) systems only
234+
// TODO: remove this when threading is implemented
233235
#ifdef Q_WS_X11
234236
chkEnableBackbuffer->setChecked( settings.value( "/Map/enableBackbuffer" ).toBool() );
235237
toggleEnableBackbuffer( chkEnableBackbuffer->checkState() );
238+
#elif Q_WS_MAC
239+
chkEnableBackbuffer->setChecked( true );
240+
chkEnableBackbuffer->setEnabled( false );
241+
labelUpdateThreshold->setEnabled( false );
242+
spinBoxUpdateThreshold->setEnabled( false );
243+
#else // Q_WS_WIN32
244+
chkEnableBackbuffer->setChecked( true );
245+
chkEnableBackbuffer->setEnabled( false );
236246
#endif
237247

238248
// set the display update threshold

src/app/qgsoptions.h

+2
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,11 @@ class QgsOptions : public QDialog, private Ui::QgsOptionsBase
7474

7575
void toggleStandardDeviation( int );
7676

77+
#ifdef Q_WS_X11
7778
//! Slot to change backbuffering. This is handled when the user changes
7879
// the value of the checkbox
7980
void toggleEnableBackbuffer( int );
81+
#endif
8082

8183
/**
8284
* Return the desired state of newly added layers. If a layer

src/core/qgsvectorlayer.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -734,8 +734,10 @@ void QgsVectorLayer::drawRendererV2( QgsRenderContext& rendererContext, bool lab
734734
break;
735735
}
736736
#ifndef Q_WS_MAC //MH: disable this on Mac for now to avoid problems with resizing
737+
#ifdef Q_WS_X11
737738
if ( !mEnableBackbuffer ) // do not handle events, as we're already inside a paint event
738739
{
740+
#endif // Q_WS_X11
739741
if ( mUpdateThreshold > 0 && 0 == featureCount % mUpdateThreshold )
740742
{
741743
emit screenUpdateRequested();
@@ -747,8 +749,10 @@ void QgsVectorLayer::drawRendererV2( QgsRenderContext& rendererContext, bool lab
747749
// emit drawingProgress( featureCount, totalFeatures );
748750
qApp->processEvents();
749751
}
752+
#ifdef Q_WS_X11
750753
}
751-
#endif //Q_WS_MAC
754+
#endif // Q_WS_X11
755+
#endif // Q_WS_MAC
752756

753757
bool sel = mSelectedFeatureIds.contains( fet.id() );
754758
bool drawMarker = ( mEditable && ( !vertexMarkerOnlyForSelection || sel ) );

src/gui/qgsmapcanvas.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -377,10 +377,11 @@ void QgsMapCanvas::refresh()
377377
bool enableBackbufferSetting = 0;
378378
#endif
379379

380-
//disable the update that leads to the resize crash
380+
#ifdef Q_WS_X11
381+
#ifndef ANDROID
382+
// disable the update that leads to the resize crash on X11 systems
381383
if ( viewport() )
382384
{
383-
#ifndef ANDROID
384385
if ( enableBackbufferSetting != mBackbufferEnabled )
385386
{
386387
qDebug() << "Enable back buffering: " << enableBackbufferSetting;
@@ -394,8 +395,9 @@ void QgsMapCanvas::refresh()
394395
}
395396
mBackbufferEnabled = enableBackbufferSetting;
396397
}
397-
#endif //ANDROID
398398
}
399+
#endif // ANDROID
400+
#endif // Q_WS_X11
399401

400402
mDrawing = true;
401403

src/ui/qgsoptionsbase.ui

+1-1
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,7 @@
977977
<item row="2" column="0">
978978
<widget class="QCheckBox" name="chkEnableBackbuffer">
979979
<property name="text">
980-
<string>Enable back buffer (Better graphics performance at the cost loosing the possibiliti to cancel rendering and incremental feature drawing)</string>
980+
<string>Enable back buffer (Better graphics performance at the cost of loosing the possibility to cancel rendering and incremental feature drawing)</string>
981981
</property>
982982
</widget>
983983
</item>

0 commit comments

Comments
 (0)