diff Framework/Toolbox/ImageGeometry.cpp @ 507:ce49eae4c887 bgo-commands-codegen

Codegen + Warning fixes
author Benjamin Golinvaux <bgo@osimis.io>
date Fri, 01 Mar 2019 16:18:38 +0100
parents b70e9be013e4
children 2d8ab34c8c91
line wrap: on
line diff
--- a/Framework/Toolbox/ImageGeometry.cpp	Tue Feb 26 21:33:16 2019 +0100
+++ b/Framework/Toolbox/ImageGeometry.cpp	Fri Mar 01 16:18:38 2019 +0100
@@ -76,9 +76,7 @@
     }
     else
     {
-      int tmp;
-
-      tmp = std::floor(extent.GetX1());
+      int tmp = static_cast<int>(std::floor(extent.GetX1()));
       if (tmp < 0)
       {
         x1 = 0;
@@ -88,7 +86,7 @@
         x1 = static_cast<unsigned int>(tmp);
       }
 
-      tmp = std::floor(extent.GetY1());
+      tmp = static_cast<int>(std::floor(extent.GetY1()));
       if (tmp < 0)
       {
         y1 = 0;
@@ -98,7 +96,7 @@
         y1 = static_cast<unsigned int>(tmp);
       }
 
-      tmp = std::ceil(extent.GetX2());
+      tmp = static_cast<int>(std::ceil(extent.GetX2()));
       if (tmp < 0)
       {
         return false;
@@ -112,7 +110,7 @@
         x2 = static_cast<unsigned int>(tmp);
       }
 
-      tmp = std::ceil(extent.GetY2());
+      tmp = static_cast<int>(std::ceil(extent.GetY2()));
       if (tmp < 0)
       {
         return false;
@@ -395,8 +393,8 @@
     Reader reader(source);
     unsigned int x1, y1, x2, y2;
 
-    const float floatWidth = source.GetWidth();
-    const float floatHeight = source.GetHeight();
+    const float floatWidth = static_cast<float>(source.GetWidth());
+    const float floatHeight = static_cast<float>(source.GetHeight());
 
     if (GetProjectiveTransformExtent(x1, y1, x2, y2, a,
                                      source.GetWidth(), source.GetHeight(),