Mercurial > hg > orthanc-stone
diff Framework/Viewport/SdlViewport.h @ 1331:ab81ee8fce1f broker
- Viewport is not passed and stored as a shared_ptr instead
of raw reference.
- ViewportController can now be injected with an undo
stack (not a ctor param anymore, as a preparation for the
move of the undo stack to an interactor)
- Added (temp) flag to disable emscripten events registration
in the WebAssemblyViewport (because legacy client code
deals with them directly)
- Added emscripten_clear_timeout in ~WebGLViewportsRegistry
- Removed GenericToolbox::HoldingRef whose responsibility is
better served with proper callback un-registration.
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 30 Mar 2020 14:23:46 +0200 |
parents | adf234ecaa00 |
children | be614695747d |
line wrap: on
line diff
--- a/Framework/Viewport/SdlViewport.h Mon Mar 30 08:47:30 2020 +0200 +++ b/Framework/Viewport/SdlViewport.h Mon Mar 30 14:23:46 2020 +0200 @@ -53,13 +53,14 @@ { class UndoStack; - class SdlViewport : public IViewport + class SdlViewport : public IViewport, + public boost::enable_shared_from_this<SdlViewport> { private: boost::recursive_mutex mutex_; uint32_t refreshEvent_; boost::shared_ptr<ViewportController> controller_; - std::unique_ptr<ICompositor> compositor_; + std::unique_ptr<ICompositor> compositor_; void SendRefreshEvent(); @@ -102,9 +103,11 @@ void AcquireCompositor(ICompositor* compositor /* takes ownership */); - public: + protected: SdlViewport(); - SdlViewport(boost::weak_ptr<UndoStack> undoStackW); + void PostConstructor(); + + public: bool IsRefreshEvent(const SDL_Event& event) const { @@ -131,17 +134,17 @@ private: SdlOpenGLContext context_; - public: + private: SdlOpenGLViewport(const char* title, unsigned int width, unsigned int height, bool allowDpiScaling = true); + public: + static boost::shared_ptr<SdlOpenGLViewport> Create(const char* title, + unsigned int width, + unsigned int height, + bool allowDpiScaling = true); - SdlOpenGLViewport(const char* title, - boost::weak_ptr<UndoStack> undoStackW, - unsigned int width, - unsigned int height, - bool allowDpiScaling = true); virtual ~SdlOpenGLViewport(); @@ -162,11 +165,17 @@ void CreateSdlSurfaceFromCompositor(CairoCompositor& compositor); - public: + private: SdlCairoViewport(const char* title, unsigned int width, unsigned int height, bool allowDpiScaling = true); + public: + static boost::shared_ptr<SdlCairoViewport> Create(const char* title, + unsigned int width, + unsigned int height, + bool allowDpiScaling = true); + virtual ~SdlCairoViewport();