comparison Framework/Viewport/ViewportBase.h @ 947:1091b2adeb5a toa2019081001

Fixed animation frame stopping when returning false + big work on the OpenGL objects to make them lost context-safe + debug code to forcefully tag a context as lost + debug macros
author Benjamin Golinvaux <bgo@osimis.io>
date Sat, 10 Aug 2019 13:07:31 +0200
parents 685c9a2d115f
children a7351ad54960
comparison
equal deleted inserted replaced
946:dbe3e1e47019 947:1091b2adeb5a
26 26
27 namespace OrthancStone 27 namespace OrthancStone
28 { 28 {
29 class ViewportBase : public IViewport 29 class ViewportBase : public IViewport
30 { 30 {
31 private:
32 std::string identifier_;
33 boost::shared_ptr<Scene2D> scene_;
34
35 public: 31 public:
36 ViewportBase(const std::string& identifier); 32 ViewportBase(const std::string& identifier);
37 33
38 ViewportBase(const std::string& identifier, 34 ViewportBase(const std::string& identifier,
39 boost::shared_ptr<Scene2D>& scene); 35 boost::shared_ptr<Scene2D>& scene);
48 return identifier_; 44 return identifier_;
49 } 45 }
50 46
51 virtual ScenePoint2D GetPixelCenterCoordinates(int x, int y) const ORTHANC_OVERRIDE; 47 virtual ScenePoint2D GetPixelCenterCoordinates(int x, int y) const ORTHANC_OVERRIDE;
52 48
53 virtual void Refresh() ORTHANC_OVERRIDE
54 {
55 GetCompositor().Refresh();
56 }
57
58 virtual unsigned int GetCanvasWidth() const ORTHANC_OVERRIDE 49 virtual unsigned int GetCanvasWidth() const ORTHANC_OVERRIDE
59 { 50 {
60 return GetCompositor().GetCanvasWidth(); 51 if (GetCompositor())
52 return GetCompositor()->GetCanvasWidth();
53 else
54 return 0;
61 } 55 }
62 56
63 virtual unsigned int GetCanvasHeight() const ORTHANC_OVERRIDE 57 virtual unsigned int GetCanvasHeight() const ORTHANC_OVERRIDE
64 { 58 {
65 return GetCompositor().GetCanvasHeight(); 59 if (GetCompositor())
60 return GetCompositor()->GetCanvasHeight();
61 else
62 return 0;
66 } 63 }
67 64
68 #if ORTHANC_ENABLE_LOCALE == 1 65 #if ORTHANC_ENABLE_LOCALE == 1
69 virtual void SetFont(size_t index, 66 virtual void SetFont(size_t index,
70 Orthanc::EmbeddedResources::FileResourceId resource, 67 Orthanc::EmbeddedResources::FileResourceId resource,
71 unsigned int fontSize, 68 unsigned int fontSize,
72 Orthanc::Encoding codepage) ORTHANC_OVERRIDE 69 Orthanc::Encoding codepage) ORTHANC_OVERRIDE
73 { 70 {
74 return GetCompositor().SetFont(index, resource, fontSize, codepage); 71 return GetCompositor()->SetFont(index, resource, fontSize, codepage);
75 } 72 }
76 #endif 73 #endif
74
75 private:
76 std::string identifier_;
77 boost::shared_ptr<Scene2D> scene_;
78 protected:
79 virtual void RestoreCompositor() = 0;
80 virtual void DisableCompositor() = 0;
77 }; 81 };
78 } 82 }