diff Framework/Scene2DViewport/ViewportController.cpp @ 1213:86a8266b8888 broker

moving the scene from IViewport to ViewportController
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 04 Dec 2019 17:54:10 +0100
parents 644baa70373d
children 741201eab130
line wrap: on
line diff
--- a/Framework/Scene2DViewport/ViewportController.cpp	Wed Dec 04 16:54:24 2019 +0100
+++ b/Framework/Scene2DViewport/ViewportController.cpp	Wed Dec 04 17:54:10 2019 +0100
@@ -169,24 +169,19 @@
 
   OrthancStone::AffineTransform2D ViewportController::GetCanvasToSceneTransform() const
   {
-    std::auto_ptr<IViewport::ILock> lock(viewport_->Lock());
-    return lock->GetScene().GetCanvasToSceneTransform();
+    return scene_.GetCanvasToSceneTransform();
   }
 
   OrthancStone::AffineTransform2D ViewportController::GetSceneToCanvasTransform() const
   {
-    std::auto_ptr<IViewport::ILock> lock(viewport_->Lock());
-    return lock->GetScene().GetSceneToCanvasTransform();
+    return scene_.GetSceneToCanvasTransform();
   }
 
   void ViewportController::SetSceneToCanvasTransform(const AffineTransform2D& transform)
   {
-    {
-      std::auto_ptr<IViewport::ILock> lock(viewport_->Lock());
-      lock->GetScene().SetSceneToCanvasTransform(transform);
-      canvasToSceneFactor_ = lock->GetScene().GetCanvasToSceneTransform().ComputeZoom();
-    }
-    
+    scene_.SetSceneToCanvasTransform(transform);
+
+    canvasToSceneFactor_ = scene_.GetCanvasToSceneTransform().ComputeZoom();
     BroadcastMessage(SceneTransformChanged(*this));
   }
 
@@ -194,10 +189,10 @@
   {
     {
       std::auto_ptr<IViewport::ILock> lock(viewport_->Lock());
-      lock->FitContent();
-      canvasToSceneFactor_ = lock->GetScene().GetCanvasToSceneTransform().ComputeZoom();
+      lock->FitContent(scene_);
     }
 
+    canvasToSceneFactor_ = scene_.GetCanvasToSceneTransform().ComputeZoom();
     BroadcastMessage(SceneTransformChanged(*this));
   }