diff OrthancStone/Sources/Scene2D/Internals/OpenGLTextureProgram.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 244ad1e4e76a
children 4fb8fdf03314
line wrap: on
line diff
--- a/OrthancStone/Sources/Scene2D/Internals/OpenGLTextureProgram.cpp	Wed Sep 23 17:25:25 2020 +0200
+++ b/OrthancStone/Sources/Scene2D/Internals/OpenGLTextureProgram.cpp	Thu Sep 24 16:40:30 2020 +0200
@@ -45,7 +45,9 @@
   namespace Internals
   {
     void OpenGLTextureProgram::InitializeExecution(OpenGL::OpenGLTexture& texture,
-                                                   const AffineTransform2D& transform)
+                                                   const AffineTransform2D& transform,
+                                                   unsigned int canvasWidth,
+                                                   unsigned int canvasHeight)
     {
       if (!context_.IsContextLost())
       {
@@ -58,7 +60,7 @@
         AffineTransform2D t = AffineTransform2D::Combine(transform, scale);
 
         float m[16];
-        t.ConvertToOpenGLMatrix(m, context_.GetCanvasWidth(), context_.GetCanvasHeight());
+        t.ConvertToOpenGLMatrix(m, canvasWidth, canvasHeight);
 
         texture.Bind(program_->GetUniformLocation("u_texture"));
         glUniformMatrix4fv(program_->GetUniformLocation("u_matrix"), 1, GL_FALSE, m);