Skip to content

Commit

Permalink
Lock render method with mutex. Usefull e.g. for globe plugin which re…
Browse files Browse the repository at this point in the history
…nders in threads
  • Loading branch information
mhugent committed Jul 2, 2011
1 parent 8e5cd40 commit 71443b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/qgsmaprenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#include <QDomDocument>
#include <QDomNode>
#include <QMutexLocker>
#include <QPainter>
#include <QListIterator>
#include <QSettings>
Expand Down Expand Up @@ -214,6 +215,9 @@ void QgsMapRenderer::adjustExtentToSize()

void QgsMapRenderer::render( QPainter* painter )
{
//Lock render method for concurrent threads (e.g. from globe)
QMutexLocker renderLock( &mRenderMutex );

//flag to see if the render context has changed
//since the last time we rendered. If it hasnt changed we can
//take some shortcuts with rendering
Expand Down
4 changes: 4 additions & 0 deletions src/core/qgsmaprenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#ifndef QGSMAPRENDER_H
#define QGSMAPRENDER_H

#include <QMutex>
#include <QSize>
#include <QStringList>
#include <QVector>
Expand Down Expand Up @@ -318,6 +319,9 @@ class CORE_EXPORT QgsMapRenderer : public QObject

//! Labeling engine (NULL by default)
QgsLabelingEngineInterface* mLabelingEngine;

//! Locks rendering loop for concurrent draws
QMutex mRenderMutex;
};

#endif
Expand Down

0 comments on commit 71443b1

Please sign in to comment.