changeset 890:77c96ba899f9

removing OpenGLCompositor::UpdateSize()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 10 Jul 2019 15:23:13 +0200
parents 6e888cf6a48b
children 0aff28f15ea2
files Framework/Scene2D/OpenGLCompositor.cpp Framework/Scene2D/OpenGLCompositor.h Samples/Sdl/BasicScene.cpp Samples/Sdl/FusionMprSdl.cpp Samples/Sdl/TrackerSampleApp.cpp Samples/WebAssembly/dev.h
diffstat 6 files changed, 7 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Scene2D/OpenGLCompositor.cpp	Wed Jul 10 11:58:38 2019 +0200
+++ b/Framework/Scene2D/OpenGLCompositor.cpp	Wed Jul 10 15:23:13 2019 +0200
@@ -134,7 +134,6 @@
     canvasWidth_(0),
     canvasHeight_(0)
   {
-    UpdateSize();
   }
 
   
@@ -148,20 +147,14 @@
   }
 
   
-  void OpenGLCompositor::UpdateSize()
+  void OpenGLCompositor::Refresh()
   {
     canvasWidth_ = context_.GetCanvasWidth();
     canvasHeight_ = context_.GetCanvasHeight();
 
     context_.MakeCurrent();
+
     glViewport(0, 0, canvasWidth_, canvasHeight_);
-  }
-
-  
-  void OpenGLCompositor::Refresh()
-  {
-    context_.MakeCurrent();
-
     glClearColor(0, 0, 0, 1);
     glClear(GL_COLOR_BUFFER_BIT);
 
--- a/Framework/Scene2D/OpenGLCompositor.h	Wed Jul 10 11:58:38 2019 +0200
+++ b/Framework/Scene2D/OpenGLCompositor.h	Wed Jul 10 15:23:13 2019 +0200
@@ -56,8 +56,6 @@
 
     ~OpenGLCompositor();
 
-    void UpdateSize();
-
     void Refresh();
 
     void SetFont(size_t index,
@@ -80,6 +78,7 @@
       return canvasHeight_;
     }
 
+    // TODO => REMOVE
     ScenePoint2D GetPixelCenterCoordinates(int x, int y) const;
   };
 }
--- a/Samples/Sdl/BasicScene.cpp	Wed Jul 10 11:58:38 2019 +0200
+++ b/Samples/Sdl/BasicScene.cpp	Wed Jul 10 15:23:13 2019 +0200
@@ -333,7 +333,6 @@
                event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
       {
         tracker.reset();
-        compositor.UpdateSize();
       }
       else if (event.type == SDL_KEYDOWN &&
                event.key.repeat == 0 /* Ignore key bounce */)
--- a/Samples/Sdl/FusionMprSdl.cpp	Wed Jul 10 11:58:38 2019 +0200
+++ b/Samples/Sdl/FusionMprSdl.cpp	Wed Jul 10 15:23:13 2019 +0200
@@ -706,7 +706,6 @@
           event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
         {
           DisableTracker(); // was: tracker.reset(NULL);
-          compositor_->UpdateSize();
         }
         else if (event.type == SDL_KEYDOWN &&
           event.key.repeat == 0 /* Ignore key bounce */)
--- a/Samples/Sdl/TrackerSampleApp.cpp	Wed Jul 10 11:58:38 2019 +0200
+++ b/Samples/Sdl/TrackerSampleApp.cpp	Wed Jul 10 15:23:13 2019 +0200
@@ -687,7 +687,6 @@
           event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
         {
           DisableTracker(); // was: tracker.reset(NULL);
-          compositor_->UpdateSize();
         }
         else if (event.type == SDL_KEYDOWN &&
           event.key.repeat == 0 /* Ignore key bounce */)
--- a/Samples/WebAssembly/dev.h	Wed Jul 10 11:58:38 2019 +0200
+++ b/Samples/WebAssembly/dev.h	Wed Jul 10 15:23:13 2019 +0200
@@ -26,11 +26,13 @@
 #include "../../Framework/Scene2D/PanSceneTracker.h"
 #include "../../Framework/Scene2D/RotateSceneTracker.h"
 #include "../../Framework/Scene2D/ZoomSceneTracker.h"
+#include "../../Framework/Scene2DViewport/UndoStack.h"
 #include "../../Framework/Scene2DViewport/ViewportController.h"
 
 #include <Core/OrthancException.h>
 
 #include <emscripten/html5.h>
+#include <boost/make_shared.hpp>
 
 static const unsigned int FONT_SIZE = 32;
 
@@ -52,7 +54,7 @@
     WebAssemblyViewport(MessageBroker& broker,
                         const std::string& canvas) :
       context_(canvas),
-      controller_(new ViewportController(broker)),
+      controller_(new ViewportController(boost::make_shared<UndoStack>(), broker)),
       compositor_(context_, *controller_->GetScene())
     {
       compositor_.SetFont(0, Orthanc::EmbeddedResources::UBUNTU_FONT, 
@@ -73,7 +75,7 @@
     void UpdateSize()
     {
       context_.UpdateSize();
-      compositor_.UpdateSize();
+      //compositor_.UpdateSize();
       Refresh();
     }