From b08e409a9e5c72fa4a8b69a3d854f65cb630cc9d Mon Sep 17 00:00:00 2001
From: Julien Michel <julien.michel@c-s.fr>
Date: Tue, 20 Feb 2007 08:32:36 +0000
Subject: [PATCH] Correction FA52.

---
 Code/Visu/otbImageViewer.txx | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/Code/Visu/otbImageViewer.txx b/Code/Visu/otbImageViewer.txx
index bb2363e7c2..6164c2262a 100644
--- a/Code/Visu/otbImageViewer.txx
+++ b/Code/Visu/otbImageViewer.txx
@@ -224,10 +224,21 @@ namespace otb
 	  }
 	// Create the quicklook
 	m_Shrink->SetInput(m_InputImage);
-	m_ShrinkFactor = static_cast<unsigned int>((size[0]/hscroll < size[1]/wscroll ? 
-						    static_cast<double>(size[0])/static_cast<double>(hscroll)
-						    : static_cast<double>(size[1])/static_cast<double>(wscroll))
-						   /m_QuicklookRatioCoef);
+// 	m_ShrinkFactor = static_cast<unsigned int>((size[0]/wscroll < size[1]/hscroll ? 
+// 						    static_cast<double>(size[0])/static_cast<double>(hscroll)
+// 						    : static_cast<double>(size[1])/static_cast<double>(wscroll))
+// 						   /m_QuicklookRatioCoef);
+	if(size[0]/hscroll < size[1]/wscroll)
+	  {
+	    m_ShrinkFactor = static_cast<unsigned int>(vcl_ceil((static_cast<double>(size[0])/static_cast<double>(wscroll))/m_QuicklookRatioCoef));
+	  }
+	else
+	  {
+	    m_ShrinkFactor = static_cast<unsigned int>(vcl_ceil((static_cast<double>(size[1])/static_cast<double>(hscroll))/m_QuicklookRatioCoef));
+	  }
+
+
+
 	otbMsgDebugMacro("Shrink factor: "<<m_ShrinkFactor);
 	m_Shrink->SetShrinkFactor(m_ShrinkFactor);
 	typedef otb::FltkFilterWatcher WatcherType;
-- 
GitLab