Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions src/QtComponents/RenderingManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ RenderingManager& RenderingManager::ColorTable::getRenderingManager ( )
RenderingManager::DisplayLocker::DisplayLocker (RenderingManager& w, bool forceRenderAtEnd)
: _3dwidget (&w), _forceRenderAtEnd (forceRenderAtEnd)
{
w.lockDisplay (true);
w.lockDisplay ( );
} // RenderingManager::DisplayLocker


Expand All @@ -306,7 +306,7 @@ RenderingManager::DisplayLocker::~DisplayLocker ( )
{
if (0 != _3dwidget)
{
_3dwidget->lockDisplay (false);
_3dwidget->unlockDisplay ( );
if (true == _forceRenderAtEnd)
_3dwidget->forceRender ( );
} // if (0 != _3dwidget)
Expand Down Expand Up @@ -692,15 +692,15 @@ vector<RenderingManager::RepresentationID>

RenderingManager::RenderingManager ( )
: SelectionManagerObserver (0),
_context (0), _displayLocked (false), _useGlobalDisplayProperties (true), _displayedTypes (FilterEntity::NoneEntity), _topoUseGeomColor (false),
_context (0), _displayLocksCount (0), _useGlobalDisplayProperties (true), _displayedTypes (FilterEntity::NoneEntity), _topoUseGeomColor (false),
_structuredDataThreshold (-NumericServices::doubleMachInfinity ( ))
{
} // RenderingManager::RenderingManager


RenderingManager::RenderingManager (const RenderingManager&)
: SelectionManagerObserver (0),
_context (0), _displayLocked (false), _useGlobalDisplayProperties (true), _displayedTypes (FilterEntity::NoneEntity), _topoUseGeomColor (false),
_context (0), _displayLocksCount (0), _useGlobalDisplayProperties (true), _displayedTypes (FilterEntity::NoneEntity), _topoUseGeomColor (false),
_structuredDataThreshold (-NumericServices::doubleMachInfinity ( ))
{
MGX_FORBIDDEN ("RenderingManager copy constructor is not allowed.");
Expand Down Expand Up @@ -1218,16 +1218,14 @@ void RenderingManager::selectionCleared ( )
return;

const bool locked = displayLocked ( );
lockDisplay (true);
lockDisplay ( );

const vector<Entity*> entities = getSelectionManager ( )->getEntities ( );
entitiesRemovedFromSelection (entities, true);

unlockDisplay ( );
if (false == locked)
{
lockDisplay (false);
forceRender ( );
} // if (false == locked)
} // RenderingManager::selectionCleared


Expand Down Expand Up @@ -1561,16 +1559,22 @@ const unsigned long typesMask = GraphicalEntityRepresentation::getDefaultReprese

bool RenderingManager::displayLocked ( ) const
{
return _displayLocked;
return 0 != _displayLocksCount ? true : false;
} // RenderingManager::displayLocked


void RenderingManager::lockDisplay (bool lock)
void RenderingManager::lockDisplay ( )
{
_displayLocked = lock;
++_displayLocksCount;
} // RenderingManager::lockDisplay


void RenderingManager::unlockDisplay ( )
{
--_displayLocksCount;
} // RenderingManager::unlockDisplay


// ============================================================================
// FONCTIONS STATIQUES
// ============================================================================
Expand Down
20 changes: 16 additions & 4 deletions src/QtComponents/protected/QtComponents/RenderingManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@


#include <TkUtil/Timer.h>

#include <atomic>

/**
* Macro-commandes pour faire du profiling sur le rendu graphique.
*/
Expand Down Expand Up @@ -1253,10 +1256,18 @@ class RenderingManager : public Internal::SelectionManagerObserver
);

/**
* \param <I>true</I> si les opérations d'affichage sont à inhiber, <I>false</I> dans le cas contraire.
* \param Incrémente le compteur d'inhibitions des opérations d'affichage.
* \see displayLocked
* \see unlockDisplay
*/
virtual void lockDisplay ( );

/**
* \param Décrémente le compteur d'inhibitions des opérations d'affichage.
* \see displayLocked
* \see unlockDisplay
*/
virtual void lockDisplay (bool lock);
virtual void unlockDisplay ( );



Expand All @@ -1265,6 +1276,7 @@ class RenderingManager : public Internal::SelectionManagerObserver
/**
* \return <I>true</I> si les opérations d'affichage sont inhibées (optimisation).
* \see lockDisplay
* \see unlockDisplay
*/
virtual bool displayLocked ( ) const;

Expand All @@ -1278,9 +1290,9 @@ class RenderingManager : public Internal::SelectionManagerObserver
/** Le contexte de session associé. */
Mgx3D::Internal::Context* _context;

/** Si <I>true</I> ne pas effectuer d'opération d'affichage (optimisation).
/** Si <I>non nul</I> ne pas effectuer d'opération d'affichage (optimisation).
*/
bool _displayLocked;
std::atomic<unsigned long> _displayLocksCount;

/** Si <I>true</I> l'affichage des entités utilise des propriétés d'affichage communes. Si <I>false</I> se sont des propriétés
* individuelles qui sont utilisées.
Expand Down
Loading