From 29fe2b9c6affea929ed161d2e50ded2a7056c51d Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Wed, 28 Nov 2012 07:43:38 +0000
Subject: [PATCH] fix for sizes < actual

---
 Common/CreateFile.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Common/CreateFile.cpp b/Common/CreateFile.cpp
index ca514a49af..ce3cae778c 100644
--- a/Common/CreateFile.cpp
+++ b/Common/CreateFile.cpp
@@ -130,11 +130,13 @@ static PixelBuffer *GetCompositePixelBuffer(GLenum format, GLenum type)
     GLint width = FlGui::instance()->getCurrentOpenglWindow()->w();
     GLint height = FlGui::instance()->getCurrentOpenglWindow()->h();
     if(CTX::instance()->print.width <= 0){
-      width *= CTX::instance()->print.height / height;
+      double w = width * CTX::instance()->print.height / (double)height;
+      width = (int)w;
       height = CTX::instance()->print.height;
     }
     else if(CTX::instance()->print.height <= 0){
-      height *= CTX::instance()->print.width / width;
+      double h = height * CTX::instance()->print.width / (double)width;
+      height = (int)h;
       width = CTX::instance()->print.width;
     }
     else{
-- 
GitLab