Mercurial > hg > orthanc-stone
diff OrthancStone/Sources/Viewport/SdlViewport.h @ 1576:92fca2b3ba3d
sanitizing the handling of canvas size
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 24 Sep 2020 16:40:30 +0200 |
parents | 85e117739eca |
children |
line wrap: on
line diff
--- a/OrthancStone/Sources/Viewport/SdlViewport.h Wed Sep 23 17:25:25 2020 +0200 +++ b/OrthancStone/Sources/Viewport/SdlViewport.h Thu Sep 24 16:40:30 2020 +0200 @@ -95,6 +95,11 @@ { that_.SendRefreshEvent(); } + + virtual void RefreshCanvasSize() ORTHANC_OVERRIDE + { + that_.RefreshCanvasSize(); + } }; void ClearCompositor() @@ -104,12 +109,14 @@ void AcquireCompositor(ICompositor* compositor /* takes ownership */); + virtual void RefreshCanvasSize() = 0; + protected: SdlViewport(); + void PostConstructor(); public: - bool IsRefreshEvent(const SDL_Event& event) const { return (event.type == refreshEvent_); @@ -122,8 +129,8 @@ virtual uint32_t GetSdlWindowId() = 0; - virtual void UpdateSize(unsigned int width, - unsigned int height) = 0; + void UpdateSize(unsigned int width, + unsigned int height); virtual void ToggleMaximize() = 0; @@ -137,11 +144,14 @@ private: SdlOpenGLContext context_; - private: SdlOpenGLViewport(const std::string& title, unsigned int width, unsigned int height, bool allowDpiScaling = true); + + protected: + virtual void RefreshCanvasSize() ORTHANC_OVERRIDE; + public: static boost::shared_ptr<SdlOpenGLViewport> Create(const std::string&, unsigned int width, @@ -155,9 +165,6 @@ virtual void Paint() ORTHANC_OVERRIDE; - virtual void UpdateSize(unsigned int width, - unsigned int height) ORTHANC_OVERRIDE; - virtual void ToggleMaximize() ORTHANC_OVERRIDE; }; @@ -170,11 +177,14 @@ void CreateSdlSurfaceFromCompositor(const CairoCompositor& compositor); - private: SdlCairoViewport(const char* title, unsigned int width, unsigned int height, bool allowDpiScaling = true); + + protected: + virtual void RefreshCanvasSize() ORTHANC_OVERRIDE; + public: static boost::shared_ptr<SdlCairoViewport> Create(const char* title, unsigned int width, @@ -188,9 +198,6 @@ virtual void Paint() ORTHANC_OVERRIDE; - virtual void UpdateSize(unsigned int width, - unsigned int height) ORTHANC_OVERRIDE; - virtual void ToggleMaximize() ORTHANC_OVERRIDE; }; }