Mercurial > hg > orthanc-stone
diff OrthancStone/Sources/Scene2D/OpenGLCompositor.cpp @ 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 | 8563ea5d8ae4 |
line wrap: on
line diff
--- a/OrthancStone/Sources/Scene2D/OpenGLCompositor.cpp Wed Sep 23 17:25:25 2020 +0200 +++ b/OrthancStone/Sources/Scene2D/OpenGLCompositor.cpp Thu Sep 24 16:40:30 2020 +0200 @@ -137,12 +137,6 @@ canvasWidth_(0), canvasHeight_(0) { - if (!context_.IsContextLost()) - { - canvasWidth_ = context_.GetCanvasWidth(); - canvasHeight_ = context_.GetCanvasHeight(); - } - ResetScene(); } @@ -187,8 +181,6 @@ if (!context_.IsContextLost()) { context_.MakeCurrent(); // this can throw if context lost! - canvasWidth_ = context_.GetCanvasWidth(); - canvasHeight_ = context_.GetCanvasHeight(); glViewport(0, 0, canvasWidth_, canvasHeight_); glClearColor(0, 0, 0, 1); @@ -245,14 +237,10 @@ #endif - void OpenGLCompositor::RefreshCanvasSize() + void OpenGLCompositor::SetCanvasSize(unsigned int canvasWidth, + unsigned int canvasHeight) { - if (!context_.IsContextLost()) - { - context_.MakeCurrent(); // this can throw if context lost! - context_.RefreshCanvasSize(); // Difference with Refresh(scene) - canvasWidth_ = context_.GetCanvasWidth(); - canvasHeight_ = context_.GetCanvasHeight(); - } + canvasWidth_ = canvasWidth; + canvasHeight_ = canvasHeight; } }