Mercurial > hg > orthanc-stone
diff Framework/Viewport/SdlViewport.h @ 1053:32b403a47b19
simplifying IViewport
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 10 Oct 2019 15:24:48 +0200 |
parents | efc5b62b9539 |
children | af456106576c |
line wrap: on
line diff
--- a/Framework/Viewport/SdlViewport.h Thu Oct 10 14:37:23 2019 +0200 +++ b/Framework/Viewport/SdlViewport.h Thu Oct 10 15:24:48 2019 +0200 @@ -48,21 +48,21 @@ public: SdlViewport(const std::string& identifier) : ViewportBase(identifier) - {} + { + } SdlViewport(const std::string& identifier, boost::shared_ptr<Scene2D>& scene) : ViewportBase(identifier, scene) { - } virtual SdlWindow& GetWindow() = 0; virtual void UpdateSize(unsigned int width, unsigned int height) = 0; + }; - }; class SdlOpenGLViewport : public SdlViewport { @@ -87,16 +87,21 @@ return context_.GetWindow(); } + virtual void Refresh() ORTHANC_OVERRIDE; + virtual void UpdateSize(unsigned int width, unsigned int height) ORTHANC_OVERRIDE { // nothing to do in OpenGL, the OpenGLCompositor::UpdateSize will be called automatically } - virtual void Refresh() ORTHANC_OVERRIDE; - protected: - virtual ICompositor* GetCompositor() ORTHANC_OVERRIDE + virtual bool HasCompositor() const ORTHANC_OVERRIDE { - return compositor_.get(); + return true; + } + + virtual ICompositor& GetCompositor() ORTHANC_OVERRIDE + { + return *compositor_.get(); } }; @@ -108,6 +113,10 @@ CairoCompositor compositor_; SDL_Surface* sdlSurface_; + private: + void UpdateSdlSurfaceSize(unsigned int width, + unsigned int height); + public: SdlCairoViewport(const char* title, unsigned int width, @@ -126,19 +135,20 @@ { return window_; } - + virtual void Refresh() ORTHANC_OVERRIDE; virtual void UpdateSize(unsigned int width, unsigned int height) ORTHANC_OVERRIDE; - protected: - virtual ICompositor* GetCompositor() ORTHANC_OVERRIDE + + virtual bool HasCompositor() const ORTHANC_OVERRIDE { - return &compositor_; + return true; } - private: - void UpdateSdlSurfaceSize(unsigned int width, - unsigned int height); + virtual ICompositor& GetCompositor() ORTHANC_OVERRIDE + { + return compositor_; + } }; }