comparison Framework/Viewport/WebAssemblyViewport.h @ 1239:ce3052f28f2e toa2019122001

Added a lazy size update system in WebAssemblyOpenGLViewport::Refresh
author Benjamin Golinvaux <bgo@osimis.io>
date Fri, 20 Dec 2019 15:44:20 +0100
parents 391fb6d6905d
children a4bb8c2dd211 2d8ab34c8c91
comparison
equal deleted inserted replaced
1238:e257b91fae2c 1239:ce3052f28f2e
32 { 32 {
33 private: 33 private:
34 std::string canvasIdentifier_; 34 std::string canvasIdentifier_;
35 35
36 public: 36 public:
37 WebAssemblyViewport(const std::string& canvasIdentifier) : 37 WebAssemblyViewport(const std::string& canvasIdentifier)
38 canvasIdentifier_(canvasIdentifier) 38 : canvasIdentifier_(canvasIdentifier)
39 { 39 {
40 } 40 }
41 41
42 WebAssemblyViewport(const std::string& canvasIdentifier, 42 WebAssemblyViewport(const std::string& canvasIdentifier,
43 boost::shared_ptr<Scene2D>& scene) : 43 boost::shared_ptr<Scene2D>& scene)
44 ViewportBase(scene), 44 : ViewportBase(scene)
45 canvasIdentifier_(canvasIdentifier) 45 , canvasIdentifier_(canvasIdentifier)
46 { 46 {
47 } 47 }
48 48
49 const std::string& GetCanvasIdentifier() const 49 const std::string& GetCanvasIdentifier() const
50 { 50 {
56 class WebAssemblyOpenGLViewport : public WebAssemblyViewport 56 class WebAssemblyOpenGLViewport : public WebAssemblyViewport
57 { 57 {
58 private: 58 private:
59 OpenGL::WebAssemblyOpenGLContext context_; 59 OpenGL::WebAssemblyOpenGLContext context_;
60 std::auto_ptr<OpenGLCompositor> compositor_; 60 std::auto_ptr<OpenGLCompositor> compositor_;
61 double cssWidth_;
62 double cssHeight_;
63 int pixelWidth_;
64 int pixelHeight_;
65
66 private:
67 void UpdateSizeIfNeeded();
61 68
62 public: 69 public:
63 WebAssemblyOpenGLViewport(const std::string& canvas); 70 WebAssemblyOpenGLViewport(const std::string& canvas);
64 71
65 WebAssemblyOpenGLViewport(const std::string& canvas, 72 WebAssemblyOpenGLViewport(const std::string& canvas,